diff --git a/ui/src/components/TasksTable.tsx b/ui/src/components/TasksTable.tsx index 50562fa..917e6e8 100644 --- a/ui/src/components/TasksTable.tsx +++ b/ui/src/components/TasksTable.tsx @@ -1,10 +1,9 @@ import React from "react"; import { connect, ConnectedProps } from "react-redux"; import { makeStyles } from "@material-ui/core/styles"; -import Tabs from "@material-ui/core/Tabs"; -import Tab from "@material-ui/core/Tab"; import Typography from "@material-ui/core/Typography"; import Paper from "@material-ui/core/Paper"; +import Chip from "@material-ui/core/Chip"; import ActiveTasksTable from "./ActiveTasksTable"; import PendingTasksTable from "./PendingTasksTable"; import ScheduledTasksTable from "./ScheduledTasksTable"; @@ -38,13 +37,6 @@ function TabPanel(props: TabPanelProps) { ); } -function a11yProps(value: string) { - return { - id: `scrollable-auto-tab-${value}`, - "aria-controls": `scrollable-auto-tabpanel-${value}`, - }; -} - function mapStatetoProps(state: AppState, ownProps: Props) { // TODO: Add loading state for each queue. const queueInfo = state.queues.data.find( @@ -83,46 +75,31 @@ const useStyles = makeStyles((theme) => ({ height: "100%", background: theme.palette.background.paper, }, + header: { + display: "flex", + alignItems: "center", + paddingTop: theme.spacing(1), + }, heading: { paddingTop: theme.spacing(1), paddingBottom: theme.spacing(1), paddingLeft: theme.spacing(2), paddingRight: theme.spacing(2), - borderBottom: `1px solid ${theme.palette.divider}`, }, - tabsContainer: { - // background: - // theme.palette.type === "dark" - // ? "#303030" - // : theme.palette.background.default, + chip: { + marginLeft: theme.spacing(1), }, - tabsRoot: { - // background: - // theme.palette.type === "dark" - // ? "#303030" - // : theme.palette.background.default, - }, - tabsIndicator: { - right: "auto", - left: "0", - }, - tabroot: { - flexGrow: 1, + taskcount: { + fontSize: "12px", + color: theme.palette.text.secondary, + background: + theme.palette.type === "dark" + ? "#303030" + : theme.palette.background.default, textAlign: "center", - padding: theme.spacing(2), - }, - tabwrapper: { - alignItems: "center", - color: theme.palette.text.primary, - }, - tabSelected: { - background: theme.palette.background.paper, - }, - panelContainer: {}, - taskCount: { - fontSize: "2rem", - fontWeight: 600, - margin: 0, + padding: "3px 6px", + borderRadius: "10px", + marginLeft: "2px", }, })); @@ -130,109 +107,62 @@ function TasksTable(props: Props & ReduxProps) { const { currentStats } = props; const classes = useStyles(); const history = useHistory(); + const chips = [ + { key: "active", label: "Active", count: currentStats.active }, + { key: "pending", label: "Pending", count: currentStats.pending }, + { key: "scheduled", label: "Scheduled", count: currentStats.scheduled }, + { key: "retry", label: "Retry", count: currentStats.retry }, + { key: "archived", label: "Archived", count: currentStats.archived }, + ]; return ( - - Tasks list - -
- - history.push(queueDetailsPath(props.queue, value)) - } - aria-label="tasks table" - classes={{ root: classes.tabsRoot, indicator: classes.tabsIndicator }} - > - - - - - - +
+ + Tasks + +
+ {chips.map((c) => ( + + {c.label} {c.count} +
+ } + variant="outlined" + color={props.selected === c.key ? "primary" : "default"} + onClick={() => history.push(queueDetailsPath(props.queue, c.key))} + /> + ))} +
-
- -
+
-
- -
+
-
- -
+
-
- -
+
-
- -
+
);