-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: namananand/ins 1356 update metic table on pipeline page for das…
…hboard (#483) Because - we need new table on pipeline page for dashboard This commit - new table on pipeline page for dashboard
- Loading branch information
1 parent
4894b1a
commit c5cc941
Showing
8 changed files
with
440 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,128 @@ | ||
import { DataTable } from "@instill-ai/design-system"; | ||
import { | ||
GeneralStateCell, | ||
PipelineTriggerRecord, | ||
TableError, | ||
convertTimestamp, | ||
convertToSecondsAndMilliseconds, | ||
parseTriggerStatusLabel, | ||
} from "@instill-ai/toolkit"; | ||
import { ColumnDef } from "@tanstack/react-table"; | ||
import * as React from "react"; | ||
import { TriggersTablePlaceholder } from "./table/TriggersTablePlaceholder"; | ||
|
||
export type PipelineTriggersTableProps = { | ||
pipelineTriggers: PipelineTriggerRecord[]; | ||
isError: boolean; | ||
isLoading: boolean; | ||
}; | ||
|
||
export const PipelineTriggersTable = (props: PipelineTriggersTableProps) => { | ||
const { pipelineTriggers, isError, isLoading } = props; | ||
|
||
const columns: ColumnDef<PipelineTriggerRecord>[] = [ | ||
{ | ||
accessorKey: "trigger_time", | ||
header: () => <div className="min-w-[400px] text-left">Pipeline Id</div>, | ||
cell: ({ row }) => { | ||
return ( | ||
<div className="flex flex-row gap-x-2"> | ||
{convertTimestamp(row.getValue("trigger_time"))} | ||
</div> | ||
); | ||
}, | ||
}, | ||
{ | ||
accessorKey: "status", | ||
header: () => <div className="max-w-[100px] text-center">Status</div>, | ||
cell: ({ row }) => { | ||
return ( | ||
<div className="text-center"> | ||
<GeneralStateCell | ||
width={null} | ||
state={row.getValue("status")} | ||
padding="py-2" | ||
label={parseTriggerStatusLabel(row.getValue("status"))} | ||
/> | ||
</div> | ||
); | ||
}, | ||
}, | ||
{ | ||
accessorKey: "compute_time_duration", | ||
header: () => { | ||
return ( | ||
<div className="min-w-[150px] text-center">Trigger Duration</div> | ||
); | ||
}, | ||
cell: ({ row }) => { | ||
return ( | ||
<div className="text-center"> | ||
<p className="truncate text-semantic-fg-secondary product-body-text-3-regular"> | ||
{convertToSecondsAndMilliseconds( | ||
row.getValue("compute_time_duration") | ||
)} | ||
</p> | ||
</div> | ||
); | ||
}, | ||
}, | ||
{ | ||
accessorKey: "pipeline_trigger_id", | ||
header: () => <div className="min-w-[350px] text-center">Trigger ID</div>, | ||
cell: ({ row }) => { | ||
return ( | ||
<div className="text-center"> | ||
<p className="truncate text-semantic-fg-secondary product-body-text-3-regular"> | ||
{row.getValue("pipeline_trigger_id")} | ||
</p> | ||
</div> | ||
); | ||
}, | ||
}, | ||
]; | ||
|
||
if (isError) { | ||
return ( | ||
<DataTable | ||
columns={columns} | ||
data={pipelineTriggers} | ||
pageSize={6} | ||
searchPlaceholder={null} | ||
searchKey={null} | ||
isLoading={isLoading} | ||
loadingRows={6} | ||
> | ||
<TableError /> | ||
</DataTable> | ||
); | ||
} | ||
|
||
if (pipelineTriggers.length === 0 && !isLoading) { | ||
return ( | ||
<DataTable | ||
columns={columns} | ||
data={pipelineTriggers} | ||
pageSize={6} | ||
searchPlaceholder={null} | ||
searchKey={null} | ||
isLoading={isLoading} | ||
loadingRows={6} | ||
> | ||
<TriggersTablePlaceholder enableCreateButton={false} /> | ||
</DataTable> | ||
); | ||
} | ||
|
||
return ( | ||
<DataTable | ||
columns={columns} | ||
data={pipelineTriggers} | ||
pageSize={6} | ||
searchPlaceholder={null} | ||
searchKey={null} | ||
isLoading={isLoading} | ||
loadingRows={6} | ||
/> | ||
); | ||
}; |
Oops, something went wrong.