11import { ActiveBadge , InactiveBadge , NotApplicableBadge } from "@/submodules/react-components/components/Badges"
22import { Link , Tooltip } from "@nextui-org/react" ;
3- import { IconAlertCircle , IconAlertTriangleFilled , IconCircleCheckFilled , IconExternalLink , IconFileDownload , IconInfoCircle , IconInfoSquare , IconLoader , IconNotes , IconTag , IconThumbDownFilled , IconThumbUpFilled , IconTrash , IconUserX } from "@tabler/icons-react" ;
3+ import { IconAlertCircle , IconAlertTriangleFilled , IconArrowRight , IconCircleCheckFilled , IconExternalLink , IconFileDownload , IconInfoCircle , IconInfoSquare , IconLoader , IconNotes , IconTag , IconThumbDownFilled , IconThumbUpFilled , IconTrash , IconUserX } from "@tabler/icons-react" ;
44import KernDropdown from "../KernDropdown" ;
55import { Application } from "../../hooks/web-socket/constants" ;
66import SVGIcon from "../SVGIcon" ;
7- import { useCallback } from "react" ;
7+ import { useCallback , useMemo } from "react" ;
88import KernButton from "../kern-button/KernButton" ;
99import { AdminMessageLevel } from "../../types/admin-messages" ;
1010import { FeedbackType , ModelsDownloadedStatus } from "@/submodules/javascript-functions/enums/enums" ;
1111import LoadingIcon from "@/submodules/react-components/components/LoadingIcon" ;
12+ import { EvaluationRunState } from "@/src/types/components/projects/projectId/settings/playground" ;
1213
1314function OrganizationAndUsersCell ( { organization } ) {
1415 return (
@@ -243,4 +244,50 @@ function LabelCell({ sourceContainer }) {
243244 </ span >
244245}
245246
246- export { OrganizationAndUsersCell , MaxRowsColsCharsCell , CommentsCell , ExportConsumptionAndDeleteCell , BadgeCell , OrganizationUserCell , DeleteUserCell , LevelCell , ArchiveReasonCell , ProjectNameTaskCell , CancelTaskCell , IconCell , ConfigCell , EditDeleteOrgButtonCell , ViewStackCell , AbortSessionButtonCell , FeedbackMessageCell , FeedbackMessageTextCell , JumpToConversationCell , RemoteVersionCell , ExternalLinkCell , ModelDateCell , FileSizeCell , StatusModelCell , DeleteModelCell , LabelCell }
247+ function ViewCell ( { onClick, disabled } ) {
248+ const clickView = useCallback ( ( ) => {
249+ if ( onClick ) onClick ( ) ;
250+ } , [ onClick ] ) ;
251+ return < KernButton text = "View" onClick = { clickView } disabled = { disabled } />
252+ }
253+
254+ function EvaluationRunStateCell ( { value } ) {
255+ const color = useMemo ( ( ) => {
256+ switch ( value ) {
257+ case EvaluationRunState . INITIATED :
258+ return 'gray' ;
259+ case EvaluationRunState . RUNNING :
260+ return 'yellow' ;
261+ case EvaluationRunState . SUCCESS :
262+ return 'green' ;
263+ case EvaluationRunState . FAILED :
264+ return 'red' ;
265+ }
266+ } , [ value ] ) ;
267+
268+ const className = useMemo ( ( ) => {
269+ return `inline-flex items-center px-2 py-0.5 rounded text-xs font-medium ${ color === 'green'
270+ ? 'bg-green-300'
271+ : 'bg-' + color + '-100 text-' + color + '-800' } `;
272+ } , [ color ] ) ;
273+
274+ return (
275+ < span className = { className } >
276+ < svg className = { `mr-1.5 h-2 w-2 ${ 'text-' + color + '-400' } ` } fill = "currentColor" viewBox = "0 0 8 8" >
277+ < circle cx = "4" cy = "4" r = "3" />
278+ </ svg >
279+ < span className = { ' text-' + color + '-800' } > { value } </ span >
280+ </ span >
281+ ) ;
282+ }
283+
284+ function EvaluationRunDetailsCell ( { onClick, disabled } ) {
285+ return < button type = "button" className = "text-green-800 text-sm font-medium disabled:opacity-50 disabled:cursor-not-allowed"
286+ onClick = { onClick } disabled = { disabled } >
287+ < span className = "leading-5" > Details</ span >
288+ < IconArrowRight className = "h-5 w-5 inline-block text-green-800" />
289+ </ button >
290+ }
291+
292+
293+ export { OrganizationAndUsersCell , MaxRowsColsCharsCell , CommentsCell , ExportConsumptionAndDeleteCell , BadgeCell , OrganizationUserCell , DeleteUserCell , LevelCell , ArchiveReasonCell , ProjectNameTaskCell , CancelTaskCell , IconCell , ConfigCell , EditDeleteOrgButtonCell , ViewStackCell , AbortSessionButtonCell , FeedbackMessageCell , FeedbackMessageTextCell , JumpToConversationCell , RemoteVersionCell , ExternalLinkCell , ModelDateCell , FileSizeCell , StatusModelCell , DeleteModelCell , LabelCell , ViewCell , EvaluationRunStateCell , EvaluationRunDetailsCell }
0 commit comments