mirror of
https://github.com/hibiken/asynqmon.git
synced 2025-10-03 10:42:00 +08:00
Make task table rows clickable
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
import React, { useState, useCallback } from "react";
|
import React, { useState, useCallback } from "react";
|
||||||
|
import { useHistory } from "react-router-dom";
|
||||||
import { connect, ConnectedProps } from "react-redux";
|
import { connect, ConnectedProps } from "react-redux";
|
||||||
import { makeStyles } 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";
|
||||||
@@ -34,6 +35,7 @@ import { usePolling } from "../hooks";
|
|||||||
import { ActiveTaskExtended } from "../reducers/tasksReducer";
|
import { ActiveTaskExtended } from "../reducers/tasksReducer";
|
||||||
import { durationBefore, timeAgo, uuidPrefix } from "../utils";
|
import { durationBefore, timeAgo, uuidPrefix } from "../utils";
|
||||||
import { TableColumn } from "../types/table";
|
import { TableColumn } from "../types/table";
|
||||||
|
import { taskDetailsPath } from "../paths";
|
||||||
|
|
||||||
const useStyles = makeStyles((theme) => ({
|
const useStyles = makeStyles((theme) => ({
|
||||||
table: {
|
table: {
|
||||||
@@ -257,6 +259,12 @@ function ActiveTasksTable(props: Props & ReduxProps) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const useRowStyles = makeStyles({
|
||||||
|
root: {
|
||||||
|
cursor: "pointer",
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
interface RowProps {
|
interface RowProps {
|
||||||
task: ActiveTaskExtended;
|
task: ActiveTaskExtended;
|
||||||
isSelected: boolean;
|
isSelected: boolean;
|
||||||
@@ -269,9 +277,16 @@ interface RowProps {
|
|||||||
|
|
||||||
function Row(props: RowProps) {
|
function Row(props: RowProps) {
|
||||||
const { task } = props;
|
const { task } = props;
|
||||||
|
const classes = useRowStyles();
|
||||||
|
const history = useHistory();
|
||||||
return (
|
return (
|
||||||
<TableRow key={task.id} selected={props.isSelected}>
|
<TableRow
|
||||||
<TableCell padding="checkbox">
|
key={task.id}
|
||||||
|
className={classes.root}
|
||||||
|
selected={props.isSelected}
|
||||||
|
onClick={() => history.push(taskDetailsPath(task.queue, task.id))}
|
||||||
|
>
|
||||||
|
<TableCell padding="checkbox" onClick={(e) => e.stopPropagation()}>
|
||||||
<Checkbox
|
<Checkbox
|
||||||
onChange={(event: React.ChangeEvent<HTMLInputElement>) =>
|
onChange={(event: React.ChangeEvent<HTMLInputElement>) =>
|
||||||
props.onSelectChange(event.target.checked)
|
props.onSelectChange(event.target.checked)
|
||||||
@@ -302,6 +317,7 @@ function Row(props: RowProps) {
|
|||||||
align="center"
|
align="center"
|
||||||
onMouseEnter={props.onActionCellEnter}
|
onMouseEnter={props.onActionCellEnter}
|
||||||
onMouseLeave={props.onActionCellLeave}
|
onMouseLeave={props.onActionCellLeave}
|
||||||
|
onClick={(e) => e.stopPropagation()}
|
||||||
>
|
>
|
||||||
{props.showActions ? (
|
{props.showActions ? (
|
||||||
<React.Fragment>
|
<React.Fragment>
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
import React, { useCallback, useState } from "react";
|
import React, { useCallback, useState } from "react";
|
||||||
|
import { useHistory } from "react-router-dom";
|
||||||
import { connect, ConnectedProps } from "react-redux";
|
import { connect, ConnectedProps } from "react-redux";
|
||||||
import { makeStyles } 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";
|
||||||
@@ -38,6 +39,7 @@ import { timeAgo, uuidPrefix } from "../utils";
|
|||||||
import { usePolling } from "../hooks";
|
import { usePolling } from "../hooks";
|
||||||
import { ArchivedTaskExtended } from "../reducers/tasksReducer";
|
import { ArchivedTaskExtended } from "../reducers/tasksReducer";
|
||||||
import { TableColumn } from "../types/table";
|
import { TableColumn } from "../types/table";
|
||||||
|
import { taskDetailsPath } from "../paths";
|
||||||
|
|
||||||
const useStyles = makeStyles((theme) => ({
|
const useStyles = makeStyles((theme) => ({
|
||||||
table: {
|
table: {
|
||||||
@@ -288,6 +290,9 @@ function ArchivedTasksTable(props: Props & ReduxProps) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const useRowStyles = makeStyles((theme) => ({
|
const useRowStyles = makeStyles((theme) => ({
|
||||||
|
root: {
|
||||||
|
cursor: "pointer",
|
||||||
|
},
|
||||||
actionCell: {
|
actionCell: {
|
||||||
width: "96px",
|
width: "96px",
|
||||||
},
|
},
|
||||||
@@ -312,9 +317,15 @@ interface RowProps {
|
|||||||
function Row(props: RowProps) {
|
function Row(props: RowProps) {
|
||||||
const { task } = props;
|
const { task } = props;
|
||||||
const classes = useRowStyles();
|
const classes = useRowStyles();
|
||||||
|
const history = useHistory();
|
||||||
return (
|
return (
|
||||||
<TableRow key={task.id} selected={props.isSelected}>
|
<TableRow
|
||||||
<TableCell padding="checkbox">
|
key={task.id}
|
||||||
|
className={classes.root}
|
||||||
|
selected={props.isSelected}
|
||||||
|
onClick={() => history.push(taskDetailsPath(task.queue, task.id))}
|
||||||
|
>
|
||||||
|
<TableCell padding="checkbox" onClick={(e) => e.stopPropagation()}>
|
||||||
<Checkbox
|
<Checkbox
|
||||||
onChange={(event: React.ChangeEvent<HTMLInputElement>) =>
|
onChange={(event: React.ChangeEvent<HTMLInputElement>) =>
|
||||||
props.onSelectChange(event.target.checked)
|
props.onSelectChange(event.target.checked)
|
||||||
@@ -341,6 +352,7 @@ function Row(props: RowProps) {
|
|||||||
className={classes.actionCell}
|
className={classes.actionCell}
|
||||||
onMouseEnter={props.onActionCellEnter}
|
onMouseEnter={props.onActionCellEnter}
|
||||||
onMouseLeave={props.onActionCellLeave}
|
onMouseLeave={props.onActionCellLeave}
|
||||||
|
onClick={(e) => e.stopPropagation()}
|
||||||
>
|
>
|
||||||
{props.showActions ? (
|
{props.showActions ? (
|
||||||
<React.Fragment>
|
<React.Fragment>
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
import React, { useCallback, useState } from "react";
|
import React, { useCallback, useState } from "react";
|
||||||
|
import { useHistory } from "react-router-dom";
|
||||||
import { connect, ConnectedProps } from "react-redux";
|
import { connect, ConnectedProps } from "react-redux";
|
||||||
import { makeStyles } 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";
|
||||||
@@ -38,6 +39,7 @@ import { usePolling } from "../hooks";
|
|||||||
import { uuidPrefix } from "../utils";
|
import { uuidPrefix } from "../utils";
|
||||||
import { TableColumn } from "../types/table";
|
import { TableColumn } from "../types/table";
|
||||||
import { PendingTaskExtended } from "../reducers/tasksReducer";
|
import { PendingTaskExtended } from "../reducers/tasksReducer";
|
||||||
|
import { taskDetailsPath } from "../paths";
|
||||||
|
|
||||||
const useStyles = makeStyles((theme) => ({
|
const useStyles = makeStyles((theme) => ({
|
||||||
table: {
|
table: {
|
||||||
@@ -290,6 +292,9 @@ function PendingTasksTable(props: Props & ReduxProps) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const useRowStyles = makeStyles({
|
const useRowStyles = makeStyles({
|
||||||
|
root: {
|
||||||
|
cursor: "pointer",
|
||||||
|
},
|
||||||
actionCell: {
|
actionCell: {
|
||||||
width: "96px",
|
width: "96px",
|
||||||
},
|
},
|
||||||
@@ -314,9 +319,15 @@ interface RowProps {
|
|||||||
function Row(props: RowProps) {
|
function Row(props: RowProps) {
|
||||||
const { task } = props;
|
const { task } = props;
|
||||||
const classes = useRowStyles();
|
const classes = useRowStyles();
|
||||||
|
const history = useHistory();
|
||||||
return (
|
return (
|
||||||
<TableRow key={task.id} selected={props.isSelected}>
|
<TableRow
|
||||||
<TableCell padding="checkbox">
|
key={task.id}
|
||||||
|
className={classes.root}
|
||||||
|
selected={props.isSelected}
|
||||||
|
onClick={() => history.push(taskDetailsPath(task.queue, task.id))}
|
||||||
|
>
|
||||||
|
<TableCell padding="checkbox" onClick={(e) => e.stopPropagation()}>
|
||||||
<Checkbox
|
<Checkbox
|
||||||
onChange={(event: React.ChangeEvent<HTMLInputElement>) =>
|
onChange={(event: React.ChangeEvent<HTMLInputElement>) =>
|
||||||
props.onSelectChange(event.target.checked)
|
props.onSelectChange(event.target.checked)
|
||||||
@@ -343,6 +354,7 @@ function Row(props: RowProps) {
|
|||||||
className={classes.actionCell}
|
className={classes.actionCell}
|
||||||
onMouseEnter={props.onActionCellEnter}
|
onMouseEnter={props.onActionCellEnter}
|
||||||
onMouseLeave={props.onActionCellLeave}
|
onMouseLeave={props.onActionCellLeave}
|
||||||
|
onClick={(e) => e.stopPropagation()}
|
||||||
>
|
>
|
||||||
{props.showActions ? (
|
{props.showActions ? (
|
||||||
<React.Fragment>
|
<React.Fragment>
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
import React, { useCallback, useState } from "react";
|
import React, { useCallback, useState } from "react";
|
||||||
|
import { useHistory } from "react-router-dom";
|
||||||
import { connect, ConnectedProps } from "react-redux";
|
import { connect, ConnectedProps } from "react-redux";
|
||||||
import { makeStyles } 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";
|
||||||
@@ -42,6 +43,7 @@ import { durationBefore, uuidPrefix } from "../utils";
|
|||||||
import { usePolling } from "../hooks";
|
import { usePolling } from "../hooks";
|
||||||
import { RetryTaskExtended } from "../reducers/tasksReducer";
|
import { RetryTaskExtended } from "../reducers/tasksReducer";
|
||||||
import { TableColumn } from "../types/table";
|
import { TableColumn } from "../types/table";
|
||||||
|
import { taskDetailsPath } from "../paths";
|
||||||
|
|
||||||
const useStyles = makeStyles((theme) => ({
|
const useStyles = makeStyles((theme) => ({
|
||||||
table: {
|
table: {
|
||||||
@@ -321,6 +323,9 @@ function RetryTasksTable(props: Props & ReduxProps) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const useRowStyles = makeStyles({
|
const useRowStyles = makeStyles({
|
||||||
|
root: {
|
||||||
|
cursor: "pointer",
|
||||||
|
},
|
||||||
actionCell: {
|
actionCell: {
|
||||||
width: "140px",
|
width: "140px",
|
||||||
},
|
},
|
||||||
@@ -346,9 +351,16 @@ interface RowProps {
|
|||||||
function Row(props: RowProps) {
|
function Row(props: RowProps) {
|
||||||
const { task } = props;
|
const { task } = props;
|
||||||
const classes = useRowStyles();
|
const classes = useRowStyles();
|
||||||
|
const history = useHistory();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<TableRow key={task.id} selected={props.isSelected}>
|
<TableRow
|
||||||
<TableCell padding="checkbox">
|
key={task.id}
|
||||||
|
className={classes.root}
|
||||||
|
selected={props.isSelected}
|
||||||
|
onClick={() => history.push(taskDetailsPath(task.queue, task.id))}
|
||||||
|
>
|
||||||
|
<TableCell padding="checkbox" onClick={(e) => e.stopPropagation()}>
|
||||||
<Checkbox
|
<Checkbox
|
||||||
onChange={(event: React.ChangeEvent<HTMLInputElement>) =>
|
onChange={(event: React.ChangeEvent<HTMLInputElement>) =>
|
||||||
props.onSelectChange(event.target.checked)
|
props.onSelectChange(event.target.checked)
|
||||||
@@ -377,6 +389,7 @@ function Row(props: RowProps) {
|
|||||||
className={classes.actionCell}
|
className={classes.actionCell}
|
||||||
onMouseEnter={props.onActionCellEnter}
|
onMouseEnter={props.onActionCellEnter}
|
||||||
onMouseLeave={props.onActionCellLeave}
|
onMouseLeave={props.onActionCellLeave}
|
||||||
|
onClick={(e) => e.stopPropagation()}
|
||||||
>
|
>
|
||||||
{props.showActions ? (
|
{props.showActions ? (
|
||||||
<React.Fragment>
|
<React.Fragment>
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
import React, { useState, useCallback } from "react";
|
import React, { useState, useCallback } from "react";
|
||||||
|
import { useHistory } from "react-router-dom";
|
||||||
import { connect, ConnectedProps } from "react-redux";
|
import { connect, ConnectedProps } from "react-redux";
|
||||||
import { makeStyles } 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";
|
||||||
@@ -42,6 +43,7 @@ import { durationBefore, uuidPrefix } from "../utils";
|
|||||||
import { usePolling } from "../hooks";
|
import { usePolling } from "../hooks";
|
||||||
import { ScheduledTaskExtended } from "../reducers/tasksReducer";
|
import { ScheduledTaskExtended } from "../reducers/tasksReducer";
|
||||||
import { TableColumn } from "../types/table";
|
import { TableColumn } from "../types/table";
|
||||||
|
import { taskDetailsPath } from "../paths";
|
||||||
|
|
||||||
const useStyles = makeStyles((theme) => ({
|
const useStyles = makeStyles((theme) => ({
|
||||||
table: {
|
table: {
|
||||||
@@ -318,6 +320,9 @@ function ScheduledTasksTable(props: Props & ReduxProps) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const useRowStyles = makeStyles({
|
const useRowStyles = makeStyles({
|
||||||
|
root: {
|
||||||
|
cursor: "pointer",
|
||||||
|
},
|
||||||
actionCell: {
|
actionCell: {
|
||||||
width: "140px",
|
width: "140px",
|
||||||
},
|
},
|
||||||
@@ -343,9 +348,15 @@ interface RowProps {
|
|||||||
function Row(props: RowProps) {
|
function Row(props: RowProps) {
|
||||||
const { task } = props;
|
const { task } = props;
|
||||||
const classes = useRowStyles();
|
const classes = useRowStyles();
|
||||||
|
const history = useHistory();
|
||||||
return (
|
return (
|
||||||
<TableRow key={task.id} selected={props.isSelected}>
|
<TableRow
|
||||||
<TableCell padding="checkbox">
|
key={task.id}
|
||||||
|
className={classes.root}
|
||||||
|
selected={props.isSelected}
|
||||||
|
onClick={() => history.push(taskDetailsPath(task.queue, task.id))}
|
||||||
|
>
|
||||||
|
<TableCell padding="checkbox" onClick={(e) => e.stopPropagation()}>
|
||||||
<Checkbox
|
<Checkbox
|
||||||
onChange={(event: React.ChangeEvent<HTMLInputElement>) =>
|
onChange={(event: React.ChangeEvent<HTMLInputElement>) =>
|
||||||
props.onSelectChange(event.target.checked)
|
props.onSelectChange(event.target.checked)
|
||||||
@@ -371,6 +382,7 @@ function Row(props: RowProps) {
|
|||||||
className={classes.actionCell}
|
className={classes.actionCell}
|
||||||
onMouseEnter={props.onActionCellEnter}
|
onMouseEnter={props.onActionCellEnter}
|
||||||
onMouseLeave={props.onActionCellLeave}
|
onMouseLeave={props.onActionCellLeave}
|
||||||
|
onClick={(e) => e.stopPropagation()}
|
||||||
>
|
>
|
||||||
{props.showActions ? (
|
{props.showActions ? (
|
||||||
<React.Fragment>
|
<React.Fragment>
|
||||||
|
Reference in New Issue
Block a user