forked from zmc/pulpito-ng
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Other minor additions: 1. In nodes table, add links in 'name' column 2. Add 'hideFooter' prop in DataGrid component Signed-off-by: Vallari <[email protected]>
- Loading branch information
Showing
7 changed files
with
113 additions
and
13 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
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
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
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,61 @@ | ||
import { useParams } from "react-router-dom"; | ||
import { useQueryParams, NumberParam } from "use-query-params"; | ||
import Typography from "@mui/material/Typography"; | ||
import { Helmet } from "react-helmet"; | ||
|
||
import DataGrid from "../../components/DataGrid"; | ||
import JobList from "../../components/JobList"; | ||
import { nodeRowClass, columns as nodeColumns} from "../../components/NodeList"; | ||
import type { RunParams } from "../../lib/paddles.d"; | ||
|
||
import { useNode, useNodeJobs } from "../../lib/paddles"; | ||
|
||
export default function Node() { | ||
const [params, setParams] = useQueryParams({ | ||
page: NumberParam, | ||
pageSize: NumberParam, | ||
}); | ||
const { name } = useParams<RunParams>(); | ||
const detailsQuery = useNode(name === undefined ? "" : name); | ||
const jobsQuery = useNodeJobs(name === undefined ? "" : name, params); | ||
|
||
if (detailsQuery === null) return <Typography>404</Typography>; | ||
if (detailsQuery.isError) return null; | ||
|
||
if (jobsQuery === null) return <Typography>404</Typography>; | ||
if (jobsQuery.isError) return null; | ||
|
||
return ( | ||
<div> | ||
<Helmet> | ||
<title>Node - Pulpito</title> | ||
</Helmet> | ||
<Typography variant="h6" style={{ marginBottom: "20px" }}> | ||
Node: {name} | ||
</Typography> | ||
|
||
<div style={{ height: "auto", display: "flex" }}> | ||
<div style={{ display: "flex", flexWrap: "wrap", marginLeft: "auto", gap: 30 }}> | ||
<DataGrid | ||
columns={nodeColumns} | ||
rows={[{ id: name, ...detailsQuery.data}] || []} | ||
loading={detailsQuery.isLoading || detailsQuery.isFetching} | ||
initialState={{ | ||
sorting: { | ||
sortModel: [ | ||
{ | ||
field: "machine_type", | ||
sort: "asc", | ||
}, | ||
], | ||
}, | ||
}} | ||
hideFooter={true} | ||
getRowClassName={nodeRowClass} | ||
/> | ||
<JobList query={jobsQuery} params={params} setter={setParams} /> | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
} |