-
Notifications
You must be signed in to change notification settings - Fork 111
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: edge sidebar and other fixes (#1110)
Signed-off-by: bbehnke <[email protected]>
- Loading branch information
Showing
15 changed files
with
298 additions
and
25 deletions.
There are no files selected for viewing
119 changes: 114 additions & 5 deletions
119
ui/src/components/common/SlidingSidebar/partials/EdgeDetails/index.tsx
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 |
---|---|---|
@@ -1,15 +1,124 @@ | ||
import React from "react"; | ||
import React, { useState, useEffect, useMemo } from "react"; | ||
import Box from "@mui/material/Box"; | ||
import TableContainer from "@mui/material/TableContainer"; | ||
import Table from "@mui/material/Table"; | ||
import TableBody from "@mui/material/TableBody"; | ||
import TableCell from "@mui/material/TableCell"; | ||
import TableHead from "@mui/material/TableHead"; | ||
import TableRow from "@mui/material/TableRow"; | ||
import CircularProgress from "@mui/material/CircularProgress"; | ||
import { usePiplelineWatermarksFetch } from "../../../../../utils/fetchWrappers/piplelineWatermarksFetch"; | ||
import { PipelineWatermarks } from "../../../../../types/declarations/pipeline"; | ||
|
||
import "./style.css"; | ||
|
||
|
||
export interface EdgeDetailsProps { | ||
namespaceId: string; // TODO | ||
namespaceId: string; | ||
pipelineId: string; | ||
edgeId: string; | ||
} | ||
|
||
export function EdgeDetails({ namespaceId, edgeId }: EdgeDetailsProps) { | ||
export function EdgeDetails({ | ||
namespaceId, | ||
pipelineId, | ||
edgeId, | ||
}: EdgeDetailsProps) { | ||
const [edgeWatermarks, setEdgeWatermarks] = useState< | ||
PipelineWatermarks | undefined | ||
>(); | ||
const { data, loading, error } = usePiplelineWatermarksFetch({ | ||
namespace: namespaceId, | ||
pipeline: pipelineId, | ||
}); | ||
|
||
useEffect(() => { | ||
if (!data) { | ||
return; | ||
} | ||
setEdgeWatermarks(data.find((metric) => metric.edgeId === edgeId)); | ||
}, [data, edgeId]); | ||
|
||
const content = useMemo(() => { | ||
if (loading) { | ||
return ( | ||
<Box | ||
sx={{ display: "flex", justifyContent: "center", marginTop: "1rem" }} | ||
> | ||
<CircularProgress /> | ||
</Box> | ||
); | ||
} | ||
if (error) { | ||
return ( | ||
<Box | ||
sx={{ display: "flex", justifyContent: "center", marginTop: "1rem" }} | ||
> | ||
{`Error loading processing rates: ${error}`} | ||
</Box> | ||
); | ||
} | ||
if (!data || !edgeWatermarks) { | ||
return ( | ||
<Box | ||
sx={{ display: "flex", justifyContent: "center", marginTop: "1rem" }} | ||
> | ||
{`No resources found.`} | ||
</Box> | ||
); | ||
} | ||
return ( | ||
<TableContainer | ||
sx={{ | ||
maxHeight: "37.5rem", | ||
backgroundColor: "#FFF", | ||
marginTop: "1rem", | ||
}} | ||
> | ||
<Table stickyHeader> | ||
<TableHead> | ||
<TableRow> | ||
<TableCell>Partition</TableCell> | ||
<TableCell>Watermark</TableCell> | ||
</TableRow> | ||
</TableHead> | ||
<TableBody> | ||
{!edgeWatermarks.watermarks.length && ( | ||
<TableRow> | ||
<TableCell colSpan={4} align="center"> | ||
No watermarks found | ||
</TableCell> | ||
</TableRow> | ||
)} | ||
{!!edgeWatermarks.watermarks.length && | ||
edgeWatermarks.watermarks.map((watermark) => ( | ||
<TableRow key={watermark.partition}> | ||
<TableCell>{watermark.partition}</TableCell> | ||
<TableCell>{`${watermark.watermark} (${watermark.formattedWatermark})`}</TableCell> | ||
</TableRow> | ||
))} | ||
</TableBody> | ||
</Table> | ||
</TableContainer> | ||
); | ||
}, [data, loading, error, edgeWatermarks]); | ||
|
||
return ( | ||
<div>TODO Edge details</div> | ||
<Box | ||
sx={{ | ||
display: "flex", | ||
flexDirection: "column", | ||
height: "100%", | ||
}} | ||
> | ||
<Box | ||
sx={{ | ||
display: "flex", | ||
flexDirection: "row", | ||
}} | ||
> | ||
<span className="edge-details-header-text">{`${edgeId} Edge`}</span> | ||
</Box> | ||
{content} | ||
</Box> | ||
); | ||
} |
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,5 @@ | ||
.edge-details-header-text { | ||
font-size: 1.25rem; | ||
font-style: normal; | ||
font-weight: 500; | ||
} |
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Oops, something went wrong.