mirror of
https://github.com/hibiken/asynqmon.git
synced 2025-10-26 16:26:12 +08:00
Show task-info in TaskDetailsView
This commit is contained in:
@@ -249,6 +249,7 @@ export interface TaskInfo {
|
|||||||
id: string;
|
id: string;
|
||||||
queue: string;
|
queue: string;
|
||||||
type: string;
|
type: string;
|
||||||
|
state: string;
|
||||||
max_retry: number;
|
max_retry: number;
|
||||||
retried: number;
|
retried: number;
|
||||||
last_failed_at: string;
|
last_failed_at: string;
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import { connect, ConnectedProps } from "react-redux";
|
|||||||
import { makeStyles } from "@material-ui/core/styles";
|
import { makeStyles } from "@material-ui/core/styles";
|
||||||
import Container from "@material-ui/core/Container";
|
import Container from "@material-ui/core/Container";
|
||||||
import Grid from "@material-ui/core/Grid";
|
import Grid from "@material-ui/core/Grid";
|
||||||
|
import Paper from "@material-ui/core/Paper";
|
||||||
import Typography from "@material-ui/core/Typography";
|
import Typography from "@material-ui/core/Typography";
|
||||||
import { useParams } from "react-router-dom";
|
import { useParams } from "react-router-dom";
|
||||||
import QueueBreadCrumb from "../components/QueueBreadcrumb";
|
import QueueBreadCrumb from "../components/QueueBreadcrumb";
|
||||||
@@ -31,9 +32,24 @@ const useStyles = makeStyles((theme) => ({
|
|||||||
container: {
|
container: {
|
||||||
paddingTop: theme.spacing(2),
|
paddingTop: theme.spacing(2),
|
||||||
},
|
},
|
||||||
|
paper: {
|
||||||
|
padding: theme.spacing(2),
|
||||||
|
marginTop: theme.spacing(2),
|
||||||
|
},
|
||||||
breadcrumbs: {
|
breadcrumbs: {
|
||||||
marginBottom: theme.spacing(2),
|
marginBottom: theme.spacing(2),
|
||||||
},
|
},
|
||||||
|
infoRow: {
|
||||||
|
display: "flex",
|
||||||
|
alignItems: "center",
|
||||||
|
paddingTop: theme.spacing(1),
|
||||||
|
},
|
||||||
|
infoKeyCell: {
|
||||||
|
width: "140px",
|
||||||
|
},
|
||||||
|
infoValueCell: {
|
||||||
|
width: "auto",
|
||||||
|
},
|
||||||
}));
|
}));
|
||||||
|
|
||||||
type Props = ConnectedProps<typeof connector>;
|
type Props = ConnectedProps<typeof connector>;
|
||||||
@@ -41,7 +57,7 @@ type Props = ConnectedProps<typeof connector>;
|
|||||||
function TaskDetailsView(props: Props) {
|
function TaskDetailsView(props: Props) {
|
||||||
const classes = useStyles();
|
const classes = useStyles();
|
||||||
const { qname, taskId } = useParams<TaskDetailsRouteParams>();
|
const { qname, taskId } = useParams<TaskDetailsRouteParams>();
|
||||||
const { getTaskInfoAsync, pollInterval, listQueuesAsync } = props;
|
const { getTaskInfoAsync, pollInterval, listQueuesAsync, taskInfo } = props;
|
||||||
|
|
||||||
const fetchTaskInfo = useMemo(() => {
|
const fetchTaskInfo = useMemo(() => {
|
||||||
return () => {
|
return () => {
|
||||||
@@ -66,10 +82,100 @@ function TaskDetailsView(props: Props) {
|
|||||||
taskId={taskId}
|
taskId={taskId}
|
||||||
/>
|
/>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid item xs={12}>
|
<Grid item xs={12} md={6}>
|
||||||
<Typography>
|
<Paper className={classes.paper} variant="outlined">
|
||||||
Task Details View Queue: {qname} TaskID: {taskId}
|
<Typography variant="h6">Task Info</Typography>
|
||||||
|
<div>
|
||||||
|
<div className={classes.infoRow}>
|
||||||
|
<Typography variant="subtitle2" className={classes.infoKeyCell}>
|
||||||
|
ID:{" "}
|
||||||
</Typography>
|
</Typography>
|
||||||
|
<Typography className={classes.infoValueCell}>
|
||||||
|
{taskInfo?.id}
|
||||||
|
</Typography>
|
||||||
|
</div>
|
||||||
|
<div className={classes.infoRow}>
|
||||||
|
<Typography variant="subtitle2" className={classes.infoKeyCell}>
|
||||||
|
Type:{" "}
|
||||||
|
</Typography>
|
||||||
|
<Typography className={classes.infoValueCell}>
|
||||||
|
{taskInfo?.type}
|
||||||
|
</Typography>
|
||||||
|
</div>
|
||||||
|
<div className={classes.infoRow}>
|
||||||
|
<Typography variant="subtitle2" className={classes.infoKeyCell}>
|
||||||
|
State:{" "}
|
||||||
|
</Typography>
|
||||||
|
<Typography className={classes.infoValueCell}>
|
||||||
|
{taskInfo?.state}
|
||||||
|
</Typography>
|
||||||
|
</div>
|
||||||
|
<div className={classes.infoRow}>
|
||||||
|
<Typography variant="subtitle2" className={classes.infoKeyCell}>
|
||||||
|
Queue:{" "}
|
||||||
|
</Typography>
|
||||||
|
<Typography className={classes.infoValueCell}>
|
||||||
|
{taskInfo?.queue}
|
||||||
|
</Typography>
|
||||||
|
</div>
|
||||||
|
<div className={classes.infoRow}>
|
||||||
|
<Typography variant="subtitle2" className={classes.infoKeyCell}>
|
||||||
|
Retry:{" "}
|
||||||
|
</Typography>
|
||||||
|
<Typography className={classes.infoValueCell}>
|
||||||
|
{taskInfo?.retried}/{taskInfo?.max_retry}
|
||||||
|
</Typography>
|
||||||
|
</div>
|
||||||
|
<div className={classes.infoRow}>
|
||||||
|
<Typography variant="subtitle2" className={classes.infoKeyCell}>
|
||||||
|
Last Failure:{" "}
|
||||||
|
</Typography>
|
||||||
|
<Typography className={classes.infoValueCell}>
|
||||||
|
{taskInfo?.last_failed_at ? (
|
||||||
|
<Typography>
|
||||||
|
{taskInfo?.error_message} ({taskInfo?.last_failed_at})
|
||||||
|
</Typography>
|
||||||
|
) : (
|
||||||
|
<Typography>n/a</Typography>
|
||||||
|
)}
|
||||||
|
</Typography>
|
||||||
|
</div>
|
||||||
|
<div className={classes.infoRow}>
|
||||||
|
<Typography variant="subtitle2" className={classes.infoKeyCell}>
|
||||||
|
Next Process Time:{" "}
|
||||||
|
</Typography>
|
||||||
|
{taskInfo?.next_process_at ? (
|
||||||
|
<Typography>{taskInfo?.next_process_at}</Typography>
|
||||||
|
) : (
|
||||||
|
<Typography>n/a</Typography>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div className={classes.infoRow}>
|
||||||
|
<Typography variant="subtitle2" className={classes.infoKeyCell}>
|
||||||
|
Timeout:{" "}
|
||||||
|
</Typography>
|
||||||
|
<Typography className={classes.infoValueCell}>
|
||||||
|
{taskInfo?.timeout_seconds ? (
|
||||||
|
<Typography>{taskInfo?.timeout_seconds} seconds</Typography>
|
||||||
|
) : (
|
||||||
|
<Typography>n/a</Typography>
|
||||||
|
)}
|
||||||
|
</Typography>
|
||||||
|
</div>
|
||||||
|
<div className={classes.infoRow}>
|
||||||
|
<Typography variant="subtitle2" className={classes.infoKeyCell}>
|
||||||
|
Deadline:{" "}
|
||||||
|
</Typography>
|
||||||
|
<Typography className={classes.infoValueCell}>
|
||||||
|
{taskInfo?.deadline ? (
|
||||||
|
<Typography>{taskInfo?.deadline}</Typography>
|
||||||
|
) : (
|
||||||
|
<Typography>n/a</Typography>
|
||||||
|
)}
|
||||||
|
</Typography>
|
||||||
|
</div>
|
||||||
|
</Paper>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Container>
|
</Container>
|
||||||
|
|||||||
Reference in New Issue
Block a user