Skip to content

Commit 8abbca6

Browse files
New cell for expired tokens (#51)
1 parent 94c030a commit 8abbca6

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

components/kern-table/CellComponents.tsx

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import { FeedbackType, ModelsDownloadedStatus } from "@/submodules/javascript-fu
1010
import LoadingIcon from "@/submodules/react-components/components/LoadingIcon";
1111
import { EvaluationRunState } from "../../types/evaluationRun";
1212
import { MemoIconAlertCircle, MemoIconAlertTriangleFilled, MemoIconArrowRight, MemoIconCircleCheckFilled, MemoIconExternalLink, MemoIconFileDownload, MemoIconInfoCircle, MemoIconInfoSquare, MemoIconLoader, MemoIconNotes, MemoIconTag, MemoIconThumbDownFilled, MemoIconThumbUpFilled, MemoIconTrash, MemoIconUserX } from "../kern-icons/icons";
13+
import { convertUTCTimeStringToLocalTimeString } from "@/src/services/environmentVariable";
1314

1415

1516
function OrganizationAndUsersCell({ organization }) {
@@ -316,4 +317,17 @@ function EditIntegrationCell({ onClick }) {
316317
return <KernButton text="Edit" onClick={clickEdit} className="text-gray-700" />
317318
}
318319

319-
export { OrganizationAndUsersCell, MaxRowsColsCharsCell, CommentsCell, ExportConsumptionAndDeleteCell, BadgeCell, OrganizationUserCell, DeleteCell, LevelCell, ArchiveReasonCell, ProjectNameTaskCell, CancelTaskCell, IconCell, ConfigCell, EditDeleteOrgButtonCell, ViewStackCell, AbortSessionButtonCell, FeedbackMessageCell, FeedbackMessageTextCell, JumpToConversationCell, RemoteVersionCell, ExternalLinkCell, ModelDateCell, FileSizeCell, StatusModelCell, DeleteModelCell, LabelCell, ViewCell, EvaluationRunStateCell, EvaluationRunDetailsCell, EtlApiTokenCell, EmailCell, EditIntegrationCell }
320+
function ExpiredTokenCell({ value }) {
321+
const valueIsExpired = useMemo(() => {
322+
return new Date(value) < new Date();
323+
}, [value]);
324+
325+
return <div className="flex justify-center">
326+
{convertUTCTimeStringToLocalTimeString(value, null)}
327+
{valueIsExpired && <Tooltip content="Expired Token" color="invert" placement="top" className="cursor-auto">
328+
<MemoIconAlertCircle className="h-6 w-6 text-red-500" />
329+
</Tooltip>}
330+
</div>
331+
}
332+
333+
export { OrganizationAndUsersCell, MaxRowsColsCharsCell, CommentsCell, ExportConsumptionAndDeleteCell, BadgeCell, OrganizationUserCell, DeleteCell, LevelCell, ArchiveReasonCell, ProjectNameTaskCell, CancelTaskCell, IconCell, ConfigCell, EditDeleteOrgButtonCell, ViewStackCell, AbortSessionButtonCell, FeedbackMessageCell, FeedbackMessageTextCell, JumpToConversationCell, RemoteVersionCell, ExternalLinkCell, ModelDateCell, FileSizeCell, StatusModelCell, DeleteModelCell, LabelCell, ViewCell, EvaluationRunStateCell, EvaluationRunDetailsCell, EtlApiTokenCell, EmailCell, EditIntegrationCell, ExpiredTokenCell }

components/kern-table/KernTable.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import SortArrows from "@/submodules/react-components/components/kern-table/SortArrows";
22
import { KernTableProps } from "../../types/kern-table";
3-
import { AbortSessionButtonCell, ArchiveReasonCell, BadgeCell, CancelTaskCell, CommentsCell, ConfigCell, DeleteModelCell, DeleteCell, EditDeleteOrgButtonCell, EmailCell, EtlApiTokenCell, EvaluationRunDetailsCell, EvaluationRunStateCell, ExportConsumptionAndDeleteCell, ExternalLinkCell, FeedbackMessageCell, FeedbackMessageTextCell, FileSizeCell, IconCell, JumpToConversationCell, LabelCell, LevelCell, MaxRowsColsCharsCell, ModelDateCell, OrganizationAndUsersCell, OrganizationUserCell, ProjectNameTaskCell, RemoteVersionCell, StatusModelCell, ViewCell, ViewStackCell, EditIntegrationCell } from "./CellComponents";
3+
import { AbortSessionButtonCell, ArchiveReasonCell, BadgeCell, CancelTaskCell, CommentsCell, ConfigCell, DeleteModelCell, DeleteCell, EditDeleteOrgButtonCell, EmailCell, EtlApiTokenCell, EvaluationRunDetailsCell, EvaluationRunStateCell, ExportConsumptionAndDeleteCell, ExternalLinkCell, FeedbackMessageCell, FeedbackMessageTextCell, FileSizeCell, IconCell, JumpToConversationCell, LabelCell, LevelCell, MaxRowsColsCharsCell, ModelDateCell, OrganizationAndUsersCell, OrganizationUserCell, ProjectNameTaskCell, RemoteVersionCell, StatusModelCell, ViewCell, ViewStackCell, EditIntegrationCell, ExpiredTokenCell } from "./CellComponents";
44
import { Fragment, useMemo } from "react";
55
import KernDropdown from "../KernDropdown";
66
import { NotApplicableBadge } from "@/submodules/react-components/components/Badges";
@@ -156,6 +156,8 @@ function ComponentMapper(cell: any) {
156156
return <EmailCell {...cell} />;
157157
case 'EditIntegrationCell':
158158
return <EditIntegrationCell {...cell} />;
159+
case 'ExpiredTokenCell':
160+
return <ExpiredTokenCell {...cell} />;
159161
}
160162
case 'text':
161163
return <span>{cell.value ?? <NotApplicableBadge />}</span>

0 commit comments

Comments
 (0)