mirror of
https://github.com/hibiken/asynqmon.git
synced 2025-01-18 18:55:54 +08:00
Update task table styles
This commit is contained in:
parent
b5f9ef0b23
commit
aa2cc37cd9
@ -1,6 +1,6 @@
|
|||||||
import React, { useState, useCallback } from "react";
|
import React, { useState, useCallback } from "react";
|
||||||
import { connect, ConnectedProps } from "react-redux";
|
import { connect, ConnectedProps } from "react-redux";
|
||||||
import { makeStyles, useTheme, Theme } from "@material-ui/core/styles";
|
import { makeStyles } from "@material-ui/core/styles";
|
||||||
import Table from "@material-ui/core/Table";
|
import Table from "@material-ui/core/Table";
|
||||||
import TableBody from "@material-ui/core/TableBody";
|
import TableBody from "@material-ui/core/TableBody";
|
||||||
import TableCell from "@material-ui/core/TableCell";
|
import TableCell from "@material-ui/core/TableCell";
|
||||||
@ -13,15 +13,10 @@ import TableFooter from "@material-ui/core/TableFooter";
|
|||||||
import TablePagination from "@material-ui/core/TablePagination";
|
import TablePagination from "@material-ui/core/TablePagination";
|
||||||
import Tooltip from "@material-ui/core/Tooltip";
|
import Tooltip from "@material-ui/core/Tooltip";
|
||||||
import Paper from "@material-ui/core/Paper";
|
import Paper from "@material-ui/core/Paper";
|
||||||
import Grid from "@material-ui/core/Grid";
|
|
||||||
import Checkbox from "@material-ui/core/Checkbox";
|
import Checkbox from "@material-ui/core/Checkbox";
|
||||||
import Collapse from "@material-ui/core/Collapse";
|
|
||||||
import IconButton from "@material-ui/core/IconButton";
|
import IconButton from "@material-ui/core/IconButton";
|
||||||
import CancelIcon from "@material-ui/icons/Cancel";
|
import CancelIcon from "@material-ui/icons/Cancel";
|
||||||
import MoreHorizIcon from "@material-ui/icons/MoreHoriz";
|
import MoreHorizIcon from "@material-ui/icons/MoreHoriz";
|
||||||
import KeyboardArrowUpIcon from "@material-ui/icons/KeyboardArrowUp";
|
|
||||||
import KeyboardArrowDownIcon from "@material-ui/icons/KeyboardArrowDown";
|
|
||||||
import Typography from "@material-ui/core/Typography";
|
|
||||||
import SyntaxHighlighter from "./SyntaxHighlighter";
|
import SyntaxHighlighter from "./SyntaxHighlighter";
|
||||||
import {
|
import {
|
||||||
listActiveTasksAsync,
|
listActiveTasksAsync,
|
||||||
@ -47,13 +42,13 @@ const useStyles = makeStyles((theme) => ({
|
|||||||
stickyHeaderCell: {
|
stickyHeaderCell: {
|
||||||
background: theme.palette.background.paper,
|
background: theme.palette.background.paper,
|
||||||
},
|
},
|
||||||
iconCell: {
|
|
||||||
width: "70px",
|
|
||||||
},
|
|
||||||
alert: {
|
alert: {
|
||||||
borderTopLeftRadius: 0,
|
borderTopLeftRadius: 0,
|
||||||
borderTopRightRadius: 0,
|
borderTopRightRadius: 0,
|
||||||
},
|
},
|
||||||
|
pagination: {
|
||||||
|
border: "none",
|
||||||
|
},
|
||||||
}));
|
}));
|
||||||
|
|
||||||
function mapStateToProps(state: AppState) {
|
function mapStateToProps(state: AppState) {
|
||||||
@ -77,8 +72,10 @@ const mapDispatchToProps = {
|
|||||||
const columns: TableColumn[] = [
|
const columns: TableColumn[] = [
|
||||||
{ key: "id", label: "ID", align: "left" },
|
{ key: "id", label: "ID", align: "left" },
|
||||||
{ key: "type", label: "Type", align: "left" },
|
{ key: "type", label: "Type", align: "left" },
|
||||||
|
{ key: "payload", label: "Payload", align: "left" },
|
||||||
{ key: "status", label: "Status", align: "left" },
|
{ key: "status", label: "Status", align: "left" },
|
||||||
{ key: "start-time", label: "Started", align: "left" },
|
{ key: "start-time", label: "Started", align: "left" },
|
||||||
|
{ key: "deadline", label: "Deadline", align: "left" },
|
||||||
{ key: "actions", label: "Actions", align: "center" },
|
{ key: "actions", label: "Actions", align: "center" },
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -200,12 +197,6 @@ function ActiveTasksTable(props: Props & ReduxProps) {
|
|||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</TableCell>
|
</TableCell>
|
||||||
<TableCell
|
|
||||||
classes={{
|
|
||||||
root: classes.iconCell,
|
|
||||||
stickyHeader: classes.stickyHeaderCell,
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
{columns.map((col) => (
|
{columns.map((col) => (
|
||||||
<TableCell
|
<TableCell
|
||||||
key={col.key}
|
key={col.key}
|
||||||
@ -244,7 +235,7 @@ function ActiveTasksTable(props: Props & ReduxProps) {
|
|||||||
<TableRow>
|
<TableRow>
|
||||||
<TablePagination
|
<TablePagination
|
||||||
rowsPerPageOptions={rowsPerPageOptions}
|
rowsPerPageOptions={rowsPerPageOptions}
|
||||||
colSpan={columns.length + 2}
|
colSpan={columns.length + 1}
|
||||||
count={props.tasks.length}
|
count={props.tasks.length}
|
||||||
rowsPerPage={pageSize}
|
rowsPerPage={pageSize}
|
||||||
page={page}
|
page={page}
|
||||||
@ -255,6 +246,7 @@ function ActiveTasksTable(props: Props & ReduxProps) {
|
|||||||
onChangePage={handleChangePage}
|
onChangePage={handleChangePage}
|
||||||
onChangeRowsPerPage={handleChangeRowsPerPage}
|
onChangeRowsPerPage={handleChangeRowsPerPage}
|
||||||
ActionsComponent={TablePaginationActions}
|
ActionsComponent={TablePaginationActions}
|
||||||
|
className={classes.pagination}
|
||||||
/>
|
/>
|
||||||
</TableRow>
|
</TableRow>
|
||||||
</TableFooter>
|
</TableFooter>
|
||||||
@ -264,27 +256,6 @@ function ActiveTasksTable(props: Props & ReduxProps) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const useRowStyles = makeStyles((theme) => ({
|
|
||||||
root: {
|
|
||||||
"& > *": {
|
|
||||||
borderBottom: "unset",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
taskDetails: {
|
|
||||||
paddingTop: theme.spacing(1),
|
|
||||||
paddingBottom: theme.spacing(1),
|
|
||||||
},
|
|
||||||
detailHeading: {
|
|
||||||
paddingLeft: theme.spacing(1),
|
|
||||||
},
|
|
||||||
payloadContainer: {
|
|
||||||
paddingRight: theme.spacing(2),
|
|
||||||
},
|
|
||||||
noBottomBorder: {
|
|
||||||
borderBottom: "none",
|
|
||||||
},
|
|
||||||
}));
|
|
||||||
|
|
||||||
interface RowProps {
|
interface RowProps {
|
||||||
task: ActiveTaskExtended;
|
task: ActiveTaskExtended;
|
||||||
isSelected: boolean;
|
isSelected: boolean;
|
||||||
@ -297,138 +268,59 @@ interface RowProps {
|
|||||||
|
|
||||||
function Row(props: RowProps) {
|
function Row(props: RowProps) {
|
||||||
const { task } = props;
|
const { task } = props;
|
||||||
const [open, setOpen] = React.useState(false);
|
|
||||||
const theme = useTheme<Theme>();
|
|
||||||
const classes = useRowStyles();
|
|
||||||
return (
|
return (
|
||||||
<React.Fragment>
|
<TableRow key={task.id} selected={props.isSelected}>
|
||||||
<TableRow
|
<TableCell padding="checkbox">
|
||||||
key={task.id}
|
<Checkbox
|
||||||
className={classes.root}
|
onChange={(event: React.ChangeEvent<HTMLInputElement>) =>
|
||||||
selected={props.isSelected}
|
props.onSelectChange(event.target.checked)
|
||||||
|
}
|
||||||
|
checked={props.isSelected}
|
||||||
|
/>
|
||||||
|
</TableCell>
|
||||||
|
<TableCell component="th" scope="row">
|
||||||
|
{uuidPrefix(task.id)}
|
||||||
|
</TableCell>
|
||||||
|
<TableCell>{task.type}</TableCell>
|
||||||
|
<TableCell>
|
||||||
|
<SyntaxHighlighter
|
||||||
|
language="json"
|
||||||
|
customStyle={{ margin: 0, maxWidth: 400 }}
|
||||||
|
>
|
||||||
|
{JSON.stringify(task.payload)}
|
||||||
|
</SyntaxHighlighter>
|
||||||
|
</TableCell>
|
||||||
|
<TableCell>{task.canceling ? "Canceling" : "Running"}</TableCell>
|
||||||
|
<TableCell>
|
||||||
|
{task.start_time === "-" ? "just now" : timeAgo(task.start_time)}
|
||||||
|
</TableCell>
|
||||||
|
<TableCell>
|
||||||
|
{task.deadline === "-" ? "-" : durationBefore(task.deadline)}
|
||||||
|
</TableCell>
|
||||||
|
<TableCell
|
||||||
|
align="center"
|
||||||
|
onMouseEnter={props.onActionCellEnter}
|
||||||
|
onMouseLeave={props.onActionCellLeave}
|
||||||
>
|
>
|
||||||
<TableCell padding="checkbox">
|
{props.showActions ? (
|
||||||
<Checkbox
|
<React.Fragment>
|
||||||
onChange={(event: React.ChangeEvent<HTMLInputElement>) =>
|
<Tooltip title="Cancel">
|
||||||
props.onSelectChange(event.target.checked)
|
<IconButton
|
||||||
}
|
onClick={props.onCancelClick}
|
||||||
checked={props.isSelected}
|
disabled={task.requestPending || task.canceling}
|
||||||
/>
|
size="small"
|
||||||
</TableCell>
|
>
|
||||||
<TableCell>
|
<CancelIcon fontSize="small" />
|
||||||
<Tooltip title={open ? "Hide Details" : "Show Details"}>
|
</IconButton>
|
||||||
<IconButton
|
</Tooltip>
|
||||||
aria-label="expand row"
|
</React.Fragment>
|
||||||
size="small"
|
) : (
|
||||||
onClick={() => setOpen(!open)}
|
<IconButton size="small" onClick={props.onActionCellEnter}>
|
||||||
>
|
<MoreHorizIcon fontSize="small" />
|
||||||
{open ? <KeyboardArrowUpIcon /> : <KeyboardArrowDownIcon />}
|
</IconButton>
|
||||||
</IconButton>
|
)}
|
||||||
</Tooltip>
|
</TableCell>
|
||||||
</TableCell>
|
</TableRow>
|
||||||
<TableCell component="th" scope="row">
|
|
||||||
{uuidPrefix(task.id)}
|
|
||||||
</TableCell>
|
|
||||||
<TableCell>{task.type}</TableCell>
|
|
||||||
<TableCell>{task.canceling ? "Canceling" : "Running"}</TableCell>
|
|
||||||
<TableCell>
|
|
||||||
{task.start_time === "-" ? "just now" : timeAgo(task.start_time)}
|
|
||||||
</TableCell>
|
|
||||||
<TableCell
|
|
||||||
align="center"
|
|
||||||
onMouseEnter={props.onActionCellEnter}
|
|
||||||
onMouseLeave={props.onActionCellLeave}
|
|
||||||
>
|
|
||||||
{props.showActions ? (
|
|
||||||
<React.Fragment>
|
|
||||||
<Tooltip title="Cancel">
|
|
||||||
<IconButton
|
|
||||||
onClick={props.onCancelClick}
|
|
||||||
disabled={task.requestPending || task.canceling}
|
|
||||||
size="small"
|
|
||||||
>
|
|
||||||
<CancelIcon fontSize="small" />
|
|
||||||
</IconButton>
|
|
||||||
</Tooltip>
|
|
||||||
</React.Fragment>
|
|
||||||
) : (
|
|
||||||
<IconButton size="small" onClick={props.onActionCellEnter}>
|
|
||||||
<MoreHorizIcon fontSize="small" />
|
|
||||||
</IconButton>
|
|
||||||
)}
|
|
||||||
</TableCell>
|
|
||||||
</TableRow>
|
|
||||||
<TableRow selected={props.isSelected}>
|
|
||||||
<TableCell
|
|
||||||
style={{ paddingBottom: 0, paddingTop: 0 }}
|
|
||||||
colSpan={columns.length + 2}
|
|
||||||
>
|
|
||||||
<Collapse in={open} timeout="auto" unmountOnExit>
|
|
||||||
<Grid container className={classes.taskDetails}>
|
|
||||||
<Grid item xs={8} className={classes.payloadContainer}>
|
|
||||||
<Typography
|
|
||||||
variant="subtitle2"
|
|
||||||
color="textSecondary"
|
|
||||||
gutterBottom
|
|
||||||
component="div"
|
|
||||||
className={classes.detailHeading}
|
|
||||||
>
|
|
||||||
Payload
|
|
||||||
</Typography>
|
|
||||||
<SyntaxHighlighter
|
|
||||||
language="json"
|
|
||||||
customStyle={{ borderRadius: theme.shape.borderRadius }}
|
|
||||||
>
|
|
||||||
{JSON.stringify(task.payload, null, 2)}
|
|
||||||
</SyntaxHighlighter>
|
|
||||||
</Grid>
|
|
||||||
<Grid item xs={4}>
|
|
||||||
<Typography
|
|
||||||
variant="subtitle2"
|
|
||||||
color="textSecondary"
|
|
||||||
gutterBottom
|
|
||||||
component="div"
|
|
||||||
className={classes.detailHeading}
|
|
||||||
>
|
|
||||||
Task Info
|
|
||||||
</Typography>
|
|
||||||
<Table size="small" aria-label="active workers">
|
|
||||||
<TableBody>
|
|
||||||
<TableRow>
|
|
||||||
<TableCell>Retry</TableCell>
|
|
||||||
<TableCell align="right">
|
|
||||||
{task.retried}/{task.max_retry}
|
|
||||||
</TableCell>
|
|
||||||
</TableRow>
|
|
||||||
<TableRow>
|
|
||||||
<TableCell>Last Error</TableCell>
|
|
||||||
<TableCell align="right">
|
|
||||||
{task.error_message.length > 0
|
|
||||||
? task.error_message
|
|
||||||
: "N/A"}
|
|
||||||
</TableCell>
|
|
||||||
</TableRow>
|
|
||||||
<TableRow>
|
|
||||||
<TableCell className={classes.noBottomBorder}>
|
|
||||||
Deadline
|
|
||||||
</TableCell>
|
|
||||||
<TableCell
|
|
||||||
className={classes.noBottomBorder}
|
|
||||||
align="right"
|
|
||||||
>
|
|
||||||
{task.deadline === "-"
|
|
||||||
? "-"
|
|
||||||
: durationBefore(task.deadline)}
|
|
||||||
</TableCell>
|
|
||||||
</TableRow>
|
|
||||||
</TableBody>
|
|
||||||
</Table>
|
|
||||||
</Grid>
|
|
||||||
</Grid>
|
|
||||||
</Collapse>
|
|
||||||
</TableCell>
|
|
||||||
</TableRow>
|
|
||||||
</React.Fragment>
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,15 +11,10 @@ import TableHead from "@material-ui/core/TableHead";
|
|||||||
import TableRow from "@material-ui/core/TableRow";
|
import TableRow from "@material-ui/core/TableRow";
|
||||||
import Tooltip from "@material-ui/core/Tooltip";
|
import Tooltip from "@material-ui/core/Tooltip";
|
||||||
import Paper from "@material-ui/core/Paper";
|
import Paper from "@material-ui/core/Paper";
|
||||||
import Box from "@material-ui/core/Box";
|
|
||||||
import Collapse from "@material-ui/core/Collapse";
|
|
||||||
import IconButton from "@material-ui/core/IconButton";
|
import IconButton from "@material-ui/core/IconButton";
|
||||||
import PlayArrowIcon from "@material-ui/icons/PlayArrow";
|
import PlayArrowIcon from "@material-ui/icons/PlayArrow";
|
||||||
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 KeyboardArrowUpIcon from "@material-ui/icons/KeyboardArrowUp";
|
|
||||||
import KeyboardArrowDownIcon from "@material-ui/icons/KeyboardArrowDown";
|
|
||||||
import Typography from "@material-ui/core/Typography";
|
|
||||||
import TableFooter from "@material-ui/core/TableFooter";
|
import TableFooter from "@material-ui/core/TableFooter";
|
||||||
import TablePagination from "@material-ui/core/TablePagination";
|
import TablePagination from "@material-ui/core/TablePagination";
|
||||||
import Alert from "@material-ui/lab/Alert";
|
import Alert from "@material-ui/lab/Alert";
|
||||||
@ -56,6 +51,9 @@ const useStyles = makeStyles((theme) => ({
|
|||||||
borderTopLeftRadius: 0,
|
borderTopLeftRadius: 0,
|
||||||
borderTopRightRadius: 0,
|
borderTopRightRadius: 0,
|
||||||
},
|
},
|
||||||
|
pagination: {
|
||||||
|
border: "none",
|
||||||
|
},
|
||||||
}));
|
}));
|
||||||
|
|
||||||
function mapStateToProps(state: AppState) {
|
function mapStateToProps(state: AppState) {
|
||||||
@ -164,9 +162,9 @@ function ArchivedTasksTable(props: Props & ReduxProps) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const columns: TableColumn[] = [
|
const columns: TableColumn[] = [
|
||||||
{ key: "icon", label: "", align: "left" },
|
|
||||||
{ key: "id", label: "ID", align: "left" },
|
{ key: "id", label: "ID", align: "left" },
|
||||||
{ key: "type", label: "Type", align: "left" },
|
{ key: "type", label: "Type", align: "left" },
|
||||||
|
{ key: "payload", label: "Payload", align: "left" },
|
||||||
{ key: "last_failed", label: "Last Failed", align: "left" },
|
{ key: "last_failed", label: "Last Failed", align: "left" },
|
||||||
{ key: "last_error", label: "Last Error", align: "left" },
|
{ key: "last_error", label: "Last Error", align: "left" },
|
||||||
{ key: "actions", label: "Actions", align: "center" },
|
{ key: "actions", label: "Actions", align: "center" },
|
||||||
@ -270,7 +268,7 @@ function ArchivedTasksTable(props: Props & ReduxProps) {
|
|||||||
<TableRow>
|
<TableRow>
|
||||||
<TablePagination
|
<TablePagination
|
||||||
rowsPerPageOptions={rowsPerPageOptions}
|
rowsPerPageOptions={rowsPerPageOptions}
|
||||||
colSpan={columns.length + 1 /* checkbox col */}
|
colSpan={columns.length + 1}
|
||||||
count={props.totalTaskCount}
|
count={props.totalTaskCount}
|
||||||
rowsPerPage={pageSize}
|
rowsPerPage={pageSize}
|
||||||
page={page}
|
page={page}
|
||||||
@ -281,6 +279,7 @@ function ArchivedTasksTable(props: Props & ReduxProps) {
|
|||||||
onChangePage={handleChangePage}
|
onChangePage={handleChangePage}
|
||||||
onChangeRowsPerPage={handleChangeRowsPerPage}
|
onChangeRowsPerPage={handleChangeRowsPerPage}
|
||||||
ActionsComponent={TablePaginationActions}
|
ActionsComponent={TablePaginationActions}
|
||||||
|
className={classes.pagination}
|
||||||
/>
|
/>
|
||||||
</TableRow>
|
</TableRow>
|
||||||
</TableFooter>
|
</TableFooter>
|
||||||
@ -291,11 +290,6 @@ function ArchivedTasksTable(props: Props & ReduxProps) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const useRowStyles = makeStyles({
|
const useRowStyles = makeStyles({
|
||||||
root: {
|
|
||||||
"& > *": {
|
|
||||||
borderBottom: "unset",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
actionCell: {
|
actionCell: {
|
||||||
width: "96px",
|
width: "96px",
|
||||||
},
|
},
|
||||||
@ -319,92 +313,68 @@ interface RowProps {
|
|||||||
|
|
||||||
function Row(props: RowProps) {
|
function Row(props: RowProps) {
|
||||||
const { task } = props;
|
const { task } = props;
|
||||||
const [open, setOpen] = useState(false);
|
|
||||||
const classes = useRowStyles();
|
const classes = useRowStyles();
|
||||||
return (
|
return (
|
||||||
<React.Fragment>
|
<TableRow key={task.id} selected={props.isSelected}>
|
||||||
<TableRow
|
<TableCell padding="checkbox">
|
||||||
key={task.id}
|
<Checkbox
|
||||||
className={classes.root}
|
onChange={(event: React.ChangeEvent<HTMLInputElement>) =>
|
||||||
selected={props.isSelected}
|
props.onSelectChange(event.target.checked)
|
||||||
>
|
}
|
||||||
<TableCell padding="checkbox">
|
checked={props.isSelected}
|
||||||
<Checkbox
|
/>
|
||||||
onChange={(event: React.ChangeEvent<HTMLInputElement>) =>
|
</TableCell>
|
||||||
props.onSelectChange(event.target.checked)
|
<TableCell component="th" scope="row">
|
||||||
}
|
{uuidPrefix(task.id)}
|
||||||
checked={props.isSelected}
|
</TableCell>
|
||||||
/>
|
<TableCell>{task.type}</TableCell>
|
||||||
</TableCell>
|
<TableCell>
|
||||||
<TableCell>
|
<SyntaxHighlighter
|
||||||
<Tooltip title={open ? "Hide Details" : "Show Details"}>
|
language="json"
|
||||||
<IconButton
|
customStyle={{ margin: 0, maxWidth: 400 }}
|
||||||
aria-label="expand row"
|
|
||||||
size="small"
|
|
||||||
onClick={() => setOpen(!open)}
|
|
||||||
>
|
|
||||||
{open ? <KeyboardArrowUpIcon /> : <KeyboardArrowDownIcon />}
|
|
||||||
</IconButton>
|
|
||||||
</Tooltip>
|
|
||||||
</TableCell>
|
|
||||||
<TableCell component="th" scope="row">
|
|
||||||
{uuidPrefix(task.id)}
|
|
||||||
</TableCell>
|
|
||||||
<TableCell>{task.type}</TableCell>
|
|
||||||
<TableCell>{timeAgo(task.last_failed_at)}</TableCell>
|
|
||||||
<TableCell>{task.error_message}</TableCell>
|
|
||||||
<TableCell
|
|
||||||
align="center"
|
|
||||||
className={clsx(
|
|
||||||
classes.actionCell,
|
|
||||||
props.showActions && classes.activeActionCell
|
|
||||||
)}
|
|
||||||
onMouseEnter={props.onActionCellEnter}
|
|
||||||
onMouseLeave={props.onActionCellLeave}
|
|
||||||
>
|
>
|
||||||
{props.showActions ? (
|
{JSON.stringify(task.payload)}
|
||||||
<React.Fragment>
|
</SyntaxHighlighter>
|
||||||
<Tooltip title="Delete">
|
</TableCell>
|
||||||
<IconButton
|
<TableCell>{timeAgo(task.last_failed_at)}</TableCell>
|
||||||
onClick={props.onDeleteClick}
|
<TableCell>{task.error_message}</TableCell>
|
||||||
disabled={task.requestPending || props.allActionPending}
|
<TableCell
|
||||||
size="small"
|
align="center"
|
||||||
>
|
className={clsx(
|
||||||
<DeleteIcon fontSize="small" />
|
classes.actionCell,
|
||||||
</IconButton>
|
props.showActions && classes.activeActionCell
|
||||||
</Tooltip>
|
)}
|
||||||
<Tooltip title="Run">
|
onMouseEnter={props.onActionCellEnter}
|
||||||
<IconButton
|
onMouseLeave={props.onActionCellLeave}
|
||||||
onClick={props.onRunClick}
|
>
|
||||||
disabled={task.requestPending || props.allActionPending}
|
{props.showActions ? (
|
||||||
size="small"
|
<React.Fragment>
|
||||||
>
|
<Tooltip title="Delete">
|
||||||
<PlayArrowIcon fontSize="small" />
|
<IconButton
|
||||||
</IconButton>
|
onClick={props.onDeleteClick}
|
||||||
</Tooltip>
|
disabled={task.requestPending || props.allActionPending}
|
||||||
</React.Fragment>
|
size="small"
|
||||||
) : (
|
>
|
||||||
<IconButton size="small" onClick={props.onActionCellEnter}>
|
<DeleteIcon fontSize="small" />
|
||||||
<MoreHorizIcon fontSize="small" />
|
</IconButton>
|
||||||
</IconButton>
|
</Tooltip>
|
||||||
)}
|
<Tooltip title="Run">
|
||||||
</TableCell>
|
<IconButton
|
||||||
</TableRow>
|
onClick={props.onRunClick}
|
||||||
<TableRow selected={props.isSelected}>
|
disabled={task.requestPending || props.allActionPending}
|
||||||
<TableCell style={{ paddingBottom: 0, paddingTop: 0 }} colSpan={7}>
|
size="small"
|
||||||
<Collapse in={open} timeout="auto" unmountOnExit>
|
>
|
||||||
<Box margin={1}>
|
<PlayArrowIcon fontSize="small" />
|
||||||
<Typography variant="h6" gutterBottom component="div">
|
</IconButton>
|
||||||
Payload
|
</Tooltip>
|
||||||
</Typography>
|
</React.Fragment>
|
||||||
<SyntaxHighlighter language="json">
|
) : (
|
||||||
{JSON.stringify(task.payload, null, 2)}
|
<IconButton size="small" onClick={props.onActionCellEnter}>
|
||||||
</SyntaxHighlighter>
|
<MoreHorizIcon fontSize="small" />
|
||||||
</Box>
|
</IconButton>
|
||||||
</Collapse>
|
)}
|
||||||
</TableCell>
|
</TableCell>
|
||||||
</TableRow>
|
</TableRow>
|
||||||
</React.Fragment>
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,13 +12,8 @@ import TableHead from "@material-ui/core/TableHead";
|
|||||||
import TableRow from "@material-ui/core/TableRow";
|
import TableRow from "@material-ui/core/TableRow";
|
||||||
import Tooltip from "@material-ui/core/Tooltip";
|
import Tooltip from "@material-ui/core/Tooltip";
|
||||||
import Paper from "@material-ui/core/Paper";
|
import Paper from "@material-ui/core/Paper";
|
||||||
import Box from "@material-ui/core/Box";
|
|
||||||
import Checkbox from "@material-ui/core/Checkbox";
|
import Checkbox from "@material-ui/core/Checkbox";
|
||||||
import Collapse from "@material-ui/core/Collapse";
|
|
||||||
import IconButton from "@material-ui/core/IconButton";
|
import IconButton from "@material-ui/core/IconButton";
|
||||||
import KeyboardArrowUpIcon from "@material-ui/icons/KeyboardArrowUp";
|
|
||||||
import KeyboardArrowDownIcon from "@material-ui/icons/KeyboardArrowDown";
|
|
||||||
import Typography from "@material-ui/core/Typography";
|
|
||||||
import TableFooter from "@material-ui/core/TableFooter";
|
import TableFooter from "@material-ui/core/TableFooter";
|
||||||
import TablePagination from "@material-ui/core/TablePagination";
|
import TablePagination from "@material-ui/core/TablePagination";
|
||||||
import DeleteIcon from "@material-ui/icons/Delete";
|
import DeleteIcon from "@material-ui/icons/Delete";
|
||||||
@ -56,6 +51,9 @@ const useStyles = makeStyles((theme) => ({
|
|||||||
borderTopLeftRadius: 0,
|
borderTopLeftRadius: 0,
|
||||||
borderTopRightRadius: 0,
|
borderTopRightRadius: 0,
|
||||||
},
|
},
|
||||||
|
pagination: {
|
||||||
|
border: "none",
|
||||||
|
},
|
||||||
}));
|
}));
|
||||||
|
|
||||||
function mapStateToProps(state: AppState) {
|
function mapStateToProps(state: AppState) {
|
||||||
@ -164,9 +162,11 @@ function PendingTasksTable(props: Props & ReduxProps) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const columns: TableColumn[] = [
|
const columns: TableColumn[] = [
|
||||||
{ key: "icon", label: "", align: "left" },
|
|
||||||
{ key: "id", label: "ID", align: "left" },
|
{ key: "id", label: "ID", align: "left" },
|
||||||
{ key: "type", label: "Type", align: "left" },
|
{ key: "type", label: "Type", align: "left" },
|
||||||
|
{ key: "paylod", label: "Payload", align: "left" },
|
||||||
|
{ key: "retried", label: "Retried", align: "right" },
|
||||||
|
{ key: "max_retry", label: "Max Retry", align: "right" },
|
||||||
{ key: "actions", label: "Actions", align: "center" },
|
{ key: "actions", label: "Actions", align: "center" },
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -229,7 +229,9 @@ function PendingTasksTable(props: Props & ReduxProps) {
|
|||||||
<TableCell
|
<TableCell
|
||||||
key={col.key}
|
key={col.key}
|
||||||
align={col.align}
|
align={col.align}
|
||||||
classes={{ stickyHeader: classes.stickyHeaderCell }}
|
classes={{
|
||||||
|
stickyHeader: classes.stickyHeaderCell,
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
{col.label}
|
{col.label}
|
||||||
</TableCell>
|
</TableCell>
|
||||||
@ -279,6 +281,7 @@ function PendingTasksTable(props: Props & ReduxProps) {
|
|||||||
onChangePage={handleChangePage}
|
onChangePage={handleChangePage}
|
||||||
onChangeRowsPerPage={handleChangeRowsPerPage}
|
onChangeRowsPerPage={handleChangeRowsPerPage}
|
||||||
ActionsComponent={TablePaginationActions}
|
ActionsComponent={TablePaginationActions}
|
||||||
|
className={classes.pagination}
|
||||||
/>
|
/>
|
||||||
</TableRow>
|
</TableRow>
|
||||||
</TableFooter>
|
</TableFooter>
|
||||||
@ -289,11 +292,6 @@ function PendingTasksTable(props: Props & ReduxProps) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const useRowStyles = makeStyles({
|
const useRowStyles = makeStyles({
|
||||||
root: {
|
|
||||||
"& > *": {
|
|
||||||
borderBottom: "unset",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
actionCell: {
|
actionCell: {
|
||||||
width: "96px",
|
width: "96px",
|
||||||
},
|
},
|
||||||
@ -317,90 +315,68 @@ interface RowProps {
|
|||||||
|
|
||||||
function Row(props: RowProps) {
|
function Row(props: RowProps) {
|
||||||
const { task } = props;
|
const { task } = props;
|
||||||
const [open, setOpen] = React.useState(false);
|
|
||||||
const classes = useRowStyles();
|
const classes = useRowStyles();
|
||||||
return (
|
return (
|
||||||
<React.Fragment>
|
<TableRow key={task.id} selected={props.isSelected}>
|
||||||
<TableRow
|
<TableCell padding="checkbox">
|
||||||
key={task.id}
|
<Checkbox
|
||||||
className={classes.root}
|
onChange={(event: React.ChangeEvent<HTMLInputElement>) =>
|
||||||
selected={props.isSelected}
|
props.onSelectChange(event.target.checked)
|
||||||
>
|
}
|
||||||
<TableCell padding="checkbox">
|
checked={props.isSelected}
|
||||||
<Checkbox
|
/>
|
||||||
onChange={(event: React.ChangeEvent<HTMLInputElement>) =>
|
</TableCell>
|
||||||
props.onSelectChange(event.target.checked)
|
<TableCell component="th" scope="row">
|
||||||
}
|
{uuidPrefix(task.id)}
|
||||||
checked={props.isSelected}
|
</TableCell>
|
||||||
/>
|
<TableCell>{task.type}</TableCell>
|
||||||
</TableCell>
|
<TableCell>
|
||||||
<TableCell>
|
<SyntaxHighlighter
|
||||||
<Tooltip title={open ? "Hide Details" : "Show Details"}>
|
language="json"
|
||||||
<IconButton
|
customStyle={{ margin: 0, maxWidth: 400 }}
|
||||||
aria-label="expand row"
|
|
||||||
size="small"
|
|
||||||
onClick={() => setOpen(!open)}
|
|
||||||
>
|
|
||||||
{open ? <KeyboardArrowUpIcon /> : <KeyboardArrowDownIcon />}
|
|
||||||
</IconButton>
|
|
||||||
</Tooltip>
|
|
||||||
</TableCell>
|
|
||||||
<TableCell component="th" scope="row">
|
|
||||||
{uuidPrefix(task.id)}
|
|
||||||
</TableCell>
|
|
||||||
<TableCell>{task.type}</TableCell>
|
|
||||||
<TableCell
|
|
||||||
align="center"
|
|
||||||
className={clsx(
|
|
||||||
classes.actionCell,
|
|
||||||
props.showActions && classes.activeActionCell
|
|
||||||
)}
|
|
||||||
onMouseEnter={props.onActionCellEnter}
|
|
||||||
onMouseLeave={props.onActionCellLeave}
|
|
||||||
>
|
>
|
||||||
{props.showActions ? (
|
{JSON.stringify(task.payload)}
|
||||||
<React.Fragment>
|
</SyntaxHighlighter>
|
||||||
<Tooltip title="Delete">
|
</TableCell>
|
||||||
<IconButton
|
<TableCell align="right">{task.retried}</TableCell>
|
||||||
onClick={props.onDeleteClick}
|
<TableCell align="right">{task.max_retry}</TableCell>
|
||||||
disabled={task.requestPending || props.allActionPending}
|
<TableCell
|
||||||
size="small"
|
align="center"
|
||||||
>
|
className={clsx(
|
||||||
<DeleteIcon fontSize="small" />
|
classes.actionCell,
|
||||||
</IconButton>
|
props.showActions && classes.activeActionCell
|
||||||
</Tooltip>
|
)}
|
||||||
<Tooltip title="Archive">
|
onMouseEnter={props.onActionCellEnter}
|
||||||
<IconButton
|
onMouseLeave={props.onActionCellLeave}
|
||||||
onClick={props.onArchiveClick}
|
>
|
||||||
disabled={task.requestPending || props.allActionPending}
|
{props.showActions ? (
|
||||||
size="small"
|
<React.Fragment>
|
||||||
>
|
<Tooltip title="Delete">
|
||||||
<ArchiveIcon fontSize="small" />
|
<IconButton
|
||||||
</IconButton>
|
onClick={props.onDeleteClick}
|
||||||
</Tooltip>
|
disabled={task.requestPending || props.allActionPending}
|
||||||
</React.Fragment>
|
size="small"
|
||||||
) : (
|
>
|
||||||
<IconButton size="small" onClick={props.onActionCellEnter}>
|
<DeleteIcon fontSize="small" />
|
||||||
<MoreHorizIcon fontSize="small" />
|
</IconButton>
|
||||||
</IconButton>
|
</Tooltip>
|
||||||
)}
|
<Tooltip title="Archive">
|
||||||
</TableCell>
|
<IconButton
|
||||||
</TableRow>
|
onClick={props.onArchiveClick}
|
||||||
<TableRow>
|
disabled={task.requestPending || props.allActionPending}
|
||||||
<TableCell style={{ paddingBottom: 0, paddingTop: 0 }} colSpan={8}>
|
size="small"
|
||||||
<Collapse in={open} timeout="auto" unmountOnExit>
|
>
|
||||||
<Box margin={1}>
|
<ArchiveIcon fontSize="small" />
|
||||||
<Typography variant="h6" gutterBottom component="div">
|
</IconButton>
|
||||||
Payload
|
</Tooltip>
|
||||||
</Typography>
|
</React.Fragment>
|
||||||
<SyntaxHighlighter language="json">
|
) : (
|
||||||
{JSON.stringify(task.payload, null, 2)}
|
<IconButton size="small" onClick={props.onActionCellEnter}>
|
||||||
</SyntaxHighlighter>
|
<MoreHorizIcon fontSize="small" />
|
||||||
</Box>
|
</IconButton>
|
||||||
</Collapse>
|
)}
|
||||||
</TableCell>
|
</TableCell>
|
||||||
</TableRow>
|
</TableRow>
|
||||||
</React.Fragment>
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,18 +10,13 @@ import TableRow from "@material-ui/core/TableRow";
|
|||||||
import TableFooter from "@material-ui/core/TableFooter";
|
import TableFooter from "@material-ui/core/TableFooter";
|
||||||
import TablePagination from "@material-ui/core/TablePagination";
|
import TablePagination from "@material-ui/core/TablePagination";
|
||||||
import Paper from "@material-ui/core/Paper";
|
import Paper from "@material-ui/core/Paper";
|
||||||
import Box from "@material-ui/core/Box";
|
|
||||||
import Tooltip from "@material-ui/core/Tooltip";
|
import Tooltip from "@material-ui/core/Tooltip";
|
||||||
import Checkbox from "@material-ui/core/Checkbox";
|
import Checkbox from "@material-ui/core/Checkbox";
|
||||||
import Collapse from "@material-ui/core/Collapse";
|
|
||||||
import IconButton from "@material-ui/core/IconButton";
|
import IconButton from "@material-ui/core/IconButton";
|
||||||
import PlayArrowIcon from "@material-ui/icons/PlayArrow";
|
import PlayArrowIcon from "@material-ui/icons/PlayArrow";
|
||||||
import DeleteIcon from "@material-ui/icons/Delete";
|
import DeleteIcon from "@material-ui/icons/Delete";
|
||||||
import ArchiveIcon from "@material-ui/icons/Archive";
|
import ArchiveIcon from "@material-ui/icons/Archive";
|
||||||
import MoreHorizIcon from "@material-ui/icons/MoreHoriz";
|
import MoreHorizIcon from "@material-ui/icons/MoreHoriz";
|
||||||
import KeyboardArrowUpIcon from "@material-ui/icons/KeyboardArrowUp";
|
|
||||||
import KeyboardArrowDownIcon from "@material-ui/icons/KeyboardArrowDown";
|
|
||||||
import Typography from "@material-ui/core/Typography";
|
|
||||||
import Alert from "@material-ui/lab/Alert";
|
import Alert from "@material-ui/lab/Alert";
|
||||||
import AlertTitle from "@material-ui/lab/AlertTitle";
|
import AlertTitle from "@material-ui/lab/AlertTitle";
|
||||||
import SyntaxHighlighter from "./SyntaxHighlighter";
|
import SyntaxHighlighter from "./SyntaxHighlighter";
|
||||||
@ -60,6 +55,9 @@ const useStyles = makeStyles((theme) => ({
|
|||||||
borderTopLeftRadius: 0,
|
borderTopLeftRadius: 0,
|
||||||
borderTopRightRadius: 0,
|
borderTopRightRadius: 0,
|
||||||
},
|
},
|
||||||
|
pagination: {
|
||||||
|
border: "none",
|
||||||
|
},
|
||||||
}));
|
}));
|
||||||
|
|
||||||
function mapStateToProps(state: AppState) {
|
function mapStateToProps(state: AppState) {
|
||||||
@ -181,13 +179,13 @@ function RetryTasksTable(props: Props & ReduxProps) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const columns: TableColumn[] = [
|
const columns: TableColumn[] = [
|
||||||
{ key: "icon", label: "", align: "left" },
|
|
||||||
{ key: "id", label: "ID", align: "left" },
|
{ key: "id", label: "ID", align: "left" },
|
||||||
{ key: "type", label: "Type", align: "left" },
|
{ key: "type", label: "Type", align: "left" },
|
||||||
|
{ key: "payload", label: "Payload", align: "left" },
|
||||||
{ key: "retry_in", label: "Retry In", align: "left" },
|
{ key: "retry_in", label: "Retry In", align: "left" },
|
||||||
{ key: "last_error", label: "Last Error", align: "left" },
|
{ key: "last_error", label: "Last Error", align: "left" },
|
||||||
{ key: "retried", label: "Retried", align: "left" },
|
{ key: "retried", label: "Retried", align: "right" },
|
||||||
{ key: "max_retry", label: "Max Retry", align: "left" },
|
{ key: "max_retry", label: "Max Retry", align: "right" },
|
||||||
{ key: "actions", label: "Actions", align: "center" },
|
{ key: "actions", label: "Actions", align: "center" },
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -314,6 +312,7 @@ function RetryTasksTable(props: Props & ReduxProps) {
|
|||||||
onChangePage={handleChangePage}
|
onChangePage={handleChangePage}
|
||||||
onChangeRowsPerPage={handleChangeRowsPerPage}
|
onChangeRowsPerPage={handleChangeRowsPerPage}
|
||||||
ActionsComponent={TablePaginationActions}
|
ActionsComponent={TablePaginationActions}
|
||||||
|
className={classes.pagination}
|
||||||
/>
|
/>
|
||||||
</TableRow>
|
</TableRow>
|
||||||
</TableFooter>
|
</TableFooter>
|
||||||
@ -324,11 +323,6 @@ function RetryTasksTable(props: Props & ReduxProps) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const useRowStyles = makeStyles({
|
const useRowStyles = makeStyles({
|
||||||
root: {
|
|
||||||
"& > *": {
|
|
||||||
borderBottom: "unset",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
actionCell: {
|
actionCell: {
|
||||||
width: "140px",
|
width: "140px",
|
||||||
},
|
},
|
||||||
@ -353,103 +347,79 @@ interface RowProps {
|
|||||||
|
|
||||||
function Row(props: RowProps) {
|
function Row(props: RowProps) {
|
||||||
const { task } = props;
|
const { task } = props;
|
||||||
const [open, setOpen] = React.useState(false);
|
|
||||||
const classes = useRowStyles();
|
const classes = useRowStyles();
|
||||||
return (
|
return (
|
||||||
<React.Fragment>
|
<TableRow key={task.id} selected={props.isSelected}>
|
||||||
<TableRow
|
<TableCell padding="checkbox">
|
||||||
key={task.id}
|
<Checkbox
|
||||||
className={classes.root}
|
onChange={(event: React.ChangeEvent<HTMLInputElement>) =>
|
||||||
selected={props.isSelected}
|
props.onSelectChange(event.target.checked)
|
||||||
>
|
}
|
||||||
<TableCell padding="checkbox">
|
checked={props.isSelected}
|
||||||
<Checkbox
|
/>
|
||||||
onChange={(event: React.ChangeEvent<HTMLInputElement>) =>
|
</TableCell>
|
||||||
props.onSelectChange(event.target.checked)
|
<TableCell component="th" scope="row">
|
||||||
}
|
{uuidPrefix(task.id)}
|
||||||
checked={props.isSelected}
|
</TableCell>
|
||||||
/>
|
<TableCell>{task.type}</TableCell>
|
||||||
</TableCell>
|
<TableCell>
|
||||||
<TableCell>
|
<SyntaxHighlighter
|
||||||
<Tooltip title={open ? "Hide Details" : "Show Details"}>
|
language="json"
|
||||||
<IconButton
|
customStyle={{ margin: 0, maxWidth: 400 }}
|
||||||
aria-label="expand row"
|
|
||||||
size="small"
|
|
||||||
onClick={() => setOpen(!open)}
|
|
||||||
>
|
|
||||||
{open ? <KeyboardArrowUpIcon /> : <KeyboardArrowDownIcon />}
|
|
||||||
</IconButton>
|
|
||||||
</Tooltip>
|
|
||||||
</TableCell>
|
|
||||||
<TableCell component="th" scope="row">
|
|
||||||
{uuidPrefix(task.id)}
|
|
||||||
</TableCell>
|
|
||||||
<TableCell>{task.type}</TableCell>
|
|
||||||
<TableCell>{durationBefore(task.next_process_at)}</TableCell>
|
|
||||||
<TableCell>{task.error_message}</TableCell>
|
|
||||||
<TableCell>{task.retried}</TableCell>
|
|
||||||
<TableCell>{task.max_retry}</TableCell>
|
|
||||||
<TableCell
|
|
||||||
align="center"
|
|
||||||
className={clsx(
|
|
||||||
classes.actionCell,
|
|
||||||
props.showActions && classes.activeActionCell
|
|
||||||
)}
|
|
||||||
onMouseEnter={props.onActionCellEnter}
|
|
||||||
onMouseLeave={props.onActionCellLeave}
|
|
||||||
>
|
>
|
||||||
{props.showActions ? (
|
{JSON.stringify(task.payload)}
|
||||||
<React.Fragment>
|
</SyntaxHighlighter>
|
||||||
<Tooltip title="Delete">
|
</TableCell>
|
||||||
<IconButton
|
<TableCell>{durationBefore(task.next_process_at)}</TableCell>
|
||||||
onClick={props.onDeleteClick}
|
<TableCell>{task.error_message}</TableCell>
|
||||||
disabled={task.requestPending || props.allActionPending}
|
<TableCell align="right">{task.retried}</TableCell>
|
||||||
size="small"
|
<TableCell align="right">{task.max_retry}</TableCell>
|
||||||
>
|
<TableCell
|
||||||
<DeleteIcon fontSize="small" />
|
align="center"
|
||||||
</IconButton>
|
className={clsx(
|
||||||
</Tooltip>
|
classes.actionCell,
|
||||||
<Tooltip title="Archive">
|
props.showActions && classes.activeActionCell
|
||||||
<IconButton
|
)}
|
||||||
onClick={props.onArchiveClick}
|
onMouseEnter={props.onActionCellEnter}
|
||||||
disabled={task.requestPending || props.allActionPending}
|
onMouseLeave={props.onActionCellLeave}
|
||||||
size="small"
|
>
|
||||||
>
|
{props.showActions ? (
|
||||||
<ArchiveIcon fontSize="small" />
|
<React.Fragment>
|
||||||
</IconButton>
|
<Tooltip title="Delete">
|
||||||
</Tooltip>
|
<IconButton
|
||||||
<Tooltip title="Run">
|
onClick={props.onDeleteClick}
|
||||||
<IconButton
|
disabled={task.requestPending || props.allActionPending}
|
||||||
onClick={props.onRunClick}
|
size="small"
|
||||||
disabled={task.requestPending || props.allActionPending}
|
>
|
||||||
size="small"
|
<DeleteIcon fontSize="small" />
|
||||||
>
|
</IconButton>
|
||||||
<PlayArrowIcon fontSize="small" />
|
</Tooltip>
|
||||||
</IconButton>
|
<Tooltip title="Archive">
|
||||||
</Tooltip>
|
<IconButton
|
||||||
</React.Fragment>
|
onClick={props.onArchiveClick}
|
||||||
) : (
|
disabled={task.requestPending || props.allActionPending}
|
||||||
<IconButton size="small" onClick={props.onActionCellEnter}>
|
size="small"
|
||||||
<MoreHorizIcon fontSize="small" />
|
>
|
||||||
</IconButton>
|
<ArchiveIcon fontSize="small" />
|
||||||
)}
|
</IconButton>
|
||||||
</TableCell>
|
</Tooltip>
|
||||||
</TableRow>
|
<Tooltip title="Run">
|
||||||
<TableRow selected={props.isSelected}>
|
<IconButton
|
||||||
<TableCell style={{ paddingBottom: 0, paddingTop: 0 }} colSpan={10}>
|
onClick={props.onRunClick}
|
||||||
<Collapse in={open} timeout="auto" unmountOnExit>
|
disabled={task.requestPending || props.allActionPending}
|
||||||
<Box margin={1}>
|
size="small"
|
||||||
<Typography variant="h6" gutterBottom component="div">
|
>
|
||||||
Payload
|
<PlayArrowIcon fontSize="small" />
|
||||||
</Typography>
|
</IconButton>
|
||||||
<SyntaxHighlighter language="json">
|
</Tooltip>
|
||||||
{JSON.stringify(task.payload, null, 2)}
|
</React.Fragment>
|
||||||
</SyntaxHighlighter>
|
) : (
|
||||||
</Box>
|
<IconButton size="small" onClick={props.onActionCellEnter}>
|
||||||
</Collapse>
|
<MoreHorizIcon fontSize="small" />
|
||||||
</TableCell>
|
</IconButton>
|
||||||
</TableRow>
|
)}
|
||||||
</React.Fragment>
|
</TableCell>
|
||||||
|
</TableRow>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,18 +11,13 @@ import TableRow from "@material-ui/core/TableRow";
|
|||||||
import TableFooter from "@material-ui/core/TableFooter";
|
import TableFooter from "@material-ui/core/TableFooter";
|
||||||
import TablePagination from "@material-ui/core/TablePagination";
|
import TablePagination from "@material-ui/core/TablePagination";
|
||||||
import Paper from "@material-ui/core/Paper";
|
import Paper from "@material-ui/core/Paper";
|
||||||
import Box from "@material-ui/core/Box";
|
|
||||||
import Tooltip from "@material-ui/core/Tooltip";
|
import Tooltip from "@material-ui/core/Tooltip";
|
||||||
import Checkbox from "@material-ui/core/Checkbox";
|
import Checkbox from "@material-ui/core/Checkbox";
|
||||||
import Collapse from "@material-ui/core/Collapse";
|
|
||||||
import IconButton from "@material-ui/core/IconButton";
|
import IconButton from "@material-ui/core/IconButton";
|
||||||
import PlayArrowIcon from "@material-ui/icons/PlayArrow";
|
import PlayArrowIcon from "@material-ui/icons/PlayArrow";
|
||||||
import DeleteIcon from "@material-ui/icons/Delete";
|
import DeleteIcon from "@material-ui/icons/Delete";
|
||||||
import ArchiveIcon from "@material-ui/icons/Archive";
|
import ArchiveIcon from "@material-ui/icons/Archive";
|
||||||
import KeyboardArrowUpIcon from "@material-ui/icons/KeyboardArrowUp";
|
|
||||||
import KeyboardArrowDownIcon from "@material-ui/icons/KeyboardArrowDown";
|
|
||||||
import MoreHorizIcon from "@material-ui/icons/MoreHoriz";
|
import MoreHorizIcon from "@material-ui/icons/MoreHoriz";
|
||||||
import Typography from "@material-ui/core/Typography";
|
|
||||||
import Alert from "@material-ui/lab/Alert";
|
import Alert from "@material-ui/lab/Alert";
|
||||||
import AlertTitle from "@material-ui/lab/AlertTitle";
|
import AlertTitle from "@material-ui/lab/AlertTitle";
|
||||||
import SyntaxHighlighter from "./SyntaxHighlighter";
|
import SyntaxHighlighter from "./SyntaxHighlighter";
|
||||||
@ -60,6 +55,9 @@ const useStyles = makeStyles((theme) => ({
|
|||||||
borderTopLeftRadius: 0,
|
borderTopLeftRadius: 0,
|
||||||
borderTopRightRadius: 0,
|
borderTopRightRadius: 0,
|
||||||
},
|
},
|
||||||
|
pagination: {
|
||||||
|
border: "none",
|
||||||
|
},
|
||||||
}));
|
}));
|
||||||
|
|
||||||
function mapStateToProps(state: AppState) {
|
function mapStateToProps(state: AppState) {
|
||||||
@ -181,9 +179,9 @@ function ScheduledTasksTable(props: Props & ReduxProps) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const columns: TableColumn[] = [
|
const columns: TableColumn[] = [
|
||||||
{ key: "icon", label: "", align: "left" },
|
|
||||||
{ key: "id", label: "ID", align: "left" },
|
{ key: "id", label: "ID", align: "left" },
|
||||||
{ key: "type", label: "Type", align: "left" },
|
{ key: "type", label: "Type", align: "left" },
|
||||||
|
{ key: "payload", label: "Payload", align: "left" },
|
||||||
{ key: "process_in", label: "Process In", align: "left" },
|
{ key: "process_in", label: "Process In", align: "left" },
|
||||||
{ key: "actions", label: "Actions", align: "center" },
|
{ key: "actions", label: "Actions", align: "center" },
|
||||||
];
|
];
|
||||||
@ -311,6 +309,7 @@ function ScheduledTasksTable(props: Props & ReduxProps) {
|
|||||||
onChangePage={handleChangePage}
|
onChangePage={handleChangePage}
|
||||||
onChangeRowsPerPage={handleChangeRowsPerPage}
|
onChangeRowsPerPage={handleChangeRowsPerPage}
|
||||||
ActionsComponent={TablePaginationActions}
|
ActionsComponent={TablePaginationActions}
|
||||||
|
className={classes.pagination}
|
||||||
/>
|
/>
|
||||||
</TableRow>
|
</TableRow>
|
||||||
</TableFooter>
|
</TableFooter>
|
||||||
@ -321,11 +320,6 @@ function ScheduledTasksTable(props: Props & ReduxProps) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const useRowStyles = makeStyles({
|
const useRowStyles = makeStyles({
|
||||||
root: {
|
|
||||||
"& > *": {
|
|
||||||
borderBottom: "unset",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
actionCell: {
|
actionCell: {
|
||||||
width: "140px",
|
width: "140px",
|
||||||
},
|
},
|
||||||
@ -350,100 +344,76 @@ interface RowProps {
|
|||||||
|
|
||||||
function Row(props: RowProps) {
|
function Row(props: RowProps) {
|
||||||
const { task } = props;
|
const { task } = props;
|
||||||
const [open, setOpen] = React.useState(false);
|
|
||||||
const classes = useRowStyles();
|
const classes = useRowStyles();
|
||||||
return (
|
return (
|
||||||
<React.Fragment>
|
<TableRow key={task.id} selected={props.isSelected}>
|
||||||
<TableRow
|
<TableCell padding="checkbox">
|
||||||
key={task.id}
|
<Checkbox
|
||||||
className={classes.root}
|
onChange={(event: React.ChangeEvent<HTMLInputElement>) =>
|
||||||
selected={props.isSelected}
|
props.onSelectChange(event.target.checked)
|
||||||
>
|
}
|
||||||
<TableCell padding="checkbox">
|
checked={props.isSelected}
|
||||||
<Checkbox
|
/>
|
||||||
onChange={(event: React.ChangeEvent<HTMLInputElement>) =>
|
</TableCell>
|
||||||
props.onSelectChange(event.target.checked)
|
<TableCell component="th" scope="row">
|
||||||
}
|
{uuidPrefix(task.id)}
|
||||||
checked={props.isSelected}
|
</TableCell>
|
||||||
/>
|
<TableCell>{task.type}</TableCell>
|
||||||
</TableCell>
|
<TableCell>
|
||||||
<TableCell>
|
<SyntaxHighlighter
|
||||||
<Tooltip title={open ? "Hide Details" : "Show Details"}>
|
language="json"
|
||||||
<IconButton
|
customStyle={{ margin: 0, maxWidth: 400 }}
|
||||||
aria-label="expand row"
|
|
||||||
size="small"
|
|
||||||
onClick={() => setOpen(!open)}
|
|
||||||
>
|
|
||||||
{open ? <KeyboardArrowUpIcon /> : <KeyboardArrowDownIcon />}
|
|
||||||
</IconButton>
|
|
||||||
</Tooltip>
|
|
||||||
</TableCell>
|
|
||||||
<TableCell component="th" scope="row">
|
|
||||||
{uuidPrefix(task.id)}
|
|
||||||
</TableCell>
|
|
||||||
<TableCell>{task.type}</TableCell>
|
|
||||||
<TableCell>{durationBefore(task.next_process_at)}</TableCell>
|
|
||||||
<TableCell
|
|
||||||
align="center"
|
|
||||||
className={clsx(
|
|
||||||
classes.actionCell,
|
|
||||||
props.showActions && classes.activeActionCell
|
|
||||||
)}
|
|
||||||
onMouseEnter={props.onActionCellEnter}
|
|
||||||
onMouseLeave={props.onActionCellLeave}
|
|
||||||
>
|
>
|
||||||
{props.showActions ? (
|
{JSON.stringify(task.payload)}
|
||||||
<React.Fragment>
|
</SyntaxHighlighter>
|
||||||
<Tooltip title="Delete">
|
</TableCell>
|
||||||
<IconButton
|
<TableCell>{durationBefore(task.next_process_at)}</TableCell>
|
||||||
onClick={props.onDeleteClick}
|
<TableCell
|
||||||
disabled={task.requestPending || props.allActionPending}
|
align="center"
|
||||||
size="small"
|
className={clsx(
|
||||||
>
|
classes.actionCell,
|
||||||
<DeleteIcon fontSize="small" />
|
props.showActions && classes.activeActionCell
|
||||||
</IconButton>
|
)}
|
||||||
</Tooltip>
|
onMouseEnter={props.onActionCellEnter}
|
||||||
<Tooltip title="Archive">
|
onMouseLeave={props.onActionCellLeave}
|
||||||
<IconButton
|
>
|
||||||
onClick={props.onArchiveClick}
|
{props.showActions ? (
|
||||||
disabled={task.requestPending || props.allActionPending}
|
<React.Fragment>
|
||||||
size="small"
|
<Tooltip title="Delete">
|
||||||
>
|
<IconButton
|
||||||
<ArchiveIcon fontSize="small" />
|
onClick={props.onDeleteClick}
|
||||||
</IconButton>
|
disabled={task.requestPending || props.allActionPending}
|
||||||
</Tooltip>
|
size="small"
|
||||||
<Tooltip title="Run">
|
>
|
||||||
<IconButton
|
<DeleteIcon fontSize="small" />
|
||||||
onClick={props.onRunClick}
|
</IconButton>
|
||||||
disabled={task.requestPending || props.allActionPending}
|
</Tooltip>
|
||||||
size="small"
|
<Tooltip title="Archive">
|
||||||
>
|
<IconButton
|
||||||
<PlayArrowIcon fontSize="small" />
|
onClick={props.onArchiveClick}
|
||||||
</IconButton>
|
disabled={task.requestPending || props.allActionPending}
|
||||||
</Tooltip>
|
size="small"
|
||||||
</React.Fragment>
|
>
|
||||||
) : (
|
<ArchiveIcon fontSize="small" />
|
||||||
<IconButton size="small" onClick={props.onActionCellEnter}>
|
</IconButton>
|
||||||
<MoreHorizIcon fontSize="small" />
|
</Tooltip>
|
||||||
</IconButton>
|
<Tooltip title="Run">
|
||||||
)}
|
<IconButton
|
||||||
</TableCell>
|
onClick={props.onRunClick}
|
||||||
</TableRow>
|
disabled={task.requestPending || props.allActionPending}
|
||||||
<TableRow selected={props.isSelected}>
|
size="small"
|
||||||
<TableCell style={{ paddingBottom: 0, paddingTop: 0 }} colSpan={6}>
|
>
|
||||||
<Collapse in={open} timeout="auto" unmountOnExit>
|
<PlayArrowIcon fontSize="small" />
|
||||||
<Box margin={1}>
|
</IconButton>
|
||||||
<Typography variant="h6" gutterBottom component="div">
|
</Tooltip>
|
||||||
Payload
|
</React.Fragment>
|
||||||
</Typography>
|
) : (
|
||||||
<SyntaxHighlighter language="json">
|
<IconButton size="small" onClick={props.onActionCellEnter}>
|
||||||
{JSON.stringify(task.payload, null, 2)}
|
<MoreHorizIcon fontSize="small" />
|
||||||
</SyntaxHighlighter>
|
</IconButton>
|
||||||
</Box>
|
)}
|
||||||
</Collapse>
|
</TableCell>
|
||||||
</TableCell>
|
</TableRow>
|
||||||
</TableRow>
|
|
||||||
</React.Fragment>
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
export default connector(ScheduledTasksTable);
|
export default connector(ScheduledTasksTable);
|
||||||
|
Loading…
Reference in New Issue
Block a user