mirror of
https://github.com/hibiken/asynqmon.git
synced 2025-01-19 03:05:53 +08:00
(ui): Add error and not found alert box in AggregatingTasksTable
This commit is contained in:
parent
c13cba0d5d
commit
ad687c4dc7
@ -17,6 +17,8 @@ import ArchiveIcon from "@material-ui/icons/Archive";
|
|||||||
import DeleteIcon from "@material-ui/icons/Delete";
|
import DeleteIcon from "@material-ui/icons/Delete";
|
||||||
import MoreHorizIcon from "@material-ui/icons/MoreHoriz";
|
import MoreHorizIcon from "@material-ui/icons/MoreHoriz";
|
||||||
import FileCopyOutlinedIcon from "@material-ui/icons/FileCopyOutlined";
|
import FileCopyOutlinedIcon from "@material-ui/icons/FileCopyOutlined";
|
||||||
|
import Alert from "@material-ui/lab/Alert";
|
||||||
|
import AlertTitle from "@material-ui/lab/AlertTitle";
|
||||||
import { useHistory } from "react-router-dom";
|
import { useHistory } from "react-router-dom";
|
||||||
import { listGroupsAsync } from "../actions/groupsActions";
|
import { listGroupsAsync } from "../actions/groupsActions";
|
||||||
import GroupSelect from "./GroupSelect";
|
import GroupSelect from "./GroupSelect";
|
||||||
@ -62,6 +64,7 @@ function mapStateToProps(state: AppState) {
|
|||||||
groups: state.groups.data,
|
groups: state.groups.data,
|
||||||
groupsError: state.groups.error,
|
groupsError: state.groups.error,
|
||||||
loading: state.tasks.aggregatingTasks.loading,
|
loading: state.tasks.aggregatingTasks.loading,
|
||||||
|
error: state.tasks.aggregatingTasks.error,
|
||||||
group: state.tasks.aggregatingTasks.group,
|
group: state.tasks.aggregatingTasks.group,
|
||||||
tasks: state.tasks.aggregatingTasks.data,
|
tasks: state.tasks.aggregatingTasks.data,
|
||||||
pollInterval: state.settings.pollInterval,
|
pollInterval: state.settings.pollInterval,
|
||||||
@ -144,6 +147,23 @@ function AggregatingTasksTable(
|
|||||||
usePolling(fetchGroups, pollInterval);
|
usePolling(fetchGroups, pollInterval);
|
||||||
usePolling(fetchTasks, pollInterval);
|
usePolling(fetchTasks, pollInterval);
|
||||||
|
|
||||||
|
if (props.error.length > 0) {
|
||||||
|
return (
|
||||||
|
<Alert severity="error" className={classes.alert}>
|
||||||
|
<AlertTitle>Error</AlertTitle>
|
||||||
|
{props.error}
|
||||||
|
</Alert>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (props.groups.length === 0) {
|
||||||
|
return (
|
||||||
|
<Alert severity="info" className={classes.alert}>
|
||||||
|
<AlertTitle>Info</AlertTitle>
|
||||||
|
No aggregating tasks at this time.
|
||||||
|
</Alert>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
const rowCount = props.tasks.length;
|
const rowCount = props.tasks.length;
|
||||||
const numSelected = selectedIds.length;
|
const numSelected = selectedIds.length;
|
||||||
return (
|
return (
|
||||||
|
Loading…
Reference in New Issue
Block a user