Skip to content

Commit

Permalink
Node: Sort jobs chronologically
Browse files Browse the repository at this point in the history
Signed-off-by: Zack Cerza <[email protected]>
  • Loading branch information
zmc committed Feb 2, 2024
1 parent 7bba058 commit f6f9a7a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 5 additions & 4 deletions src/components/JobList/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -197,9 +197,10 @@ function JobDetailPanel(props: JobDetailPanelProps): ReactNode {

type JobListProps = {
query: UseQueryResult<Run> | UseQueryResult<NodeJobs>;
sortMode?: "time" | "id";
}

export default function JobList({ query }: JobListProps) {
export default function JobList({ query, sortMode }: JobListProps) {
const options = useDefaultTableOptions<Job>();
const data = query.data?.jobs || [];
const table = useMaterialReactTable({
Expand All @@ -213,7 +214,7 @@ export default function JobList({ query }: JobListProps) {
columnVisibility: {
posted: false,
updated: false,
runtime: false,
duration: false,
waiting: false,
},
pagination: {
Expand All @@ -222,8 +223,8 @@ export default function JobList({ query }: JobListProps) {
},
sorting: [
{
id: "job_id",
desc: false,
id: sortMode === "time"? "started" : "job_id",
desc: true,
},
],
},
Expand Down
2 changes: 1 addition & 1 deletion src/pages/Node/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export default function Node() {
<div>
<div>
<NodeList query={detailsQuery} />
<JobList query={jobsQuery} />
<JobList query={jobsQuery} sortMode={"time"} />
</div>
</div>
</div>
Expand Down

0 comments on commit f6f9a7a

Please sign in to comment.