diff --git a/ui/src/components/ActiveTasksTable.tsx b/ui/src/components/ActiveTasksTable.tsx index 26c818c..87b4d46 100644 --- a/ui/src/components/ActiveTasksTable.tsx +++ b/ui/src/components/ActiveTasksTable.tsx @@ -32,6 +32,7 @@ import TablePaginationActions, { } from "./TablePaginationActions"; import { usePolling } from "../hooks"; import { ActiveTaskExtended } from "../reducers/tasksReducer"; +import { uuidPrefix } from "../utils"; const useStyles = makeStyles({ table: { @@ -177,7 +178,7 @@ function Row(props: { task: ActiveTaskExtended; onCancelClick: () => void }) { - {task.id} + {uuidPrefix(task.id)} {task.type} diff --git a/ui/src/components/DeadTasksTable.tsx b/ui/src/components/DeadTasksTable.tsx index 78991eb..11b2778 100644 --- a/ui/src/components/DeadTasksTable.tsx +++ b/ui/src/components/DeadTasksTable.tsx @@ -37,7 +37,7 @@ import TablePaginationActions, { rowsPerPageOptions, } from "./TablePaginationActions"; import TableActions from "./TableActions"; -import { timeAgo } from "../timeutil"; +import { timeAgo, uuidPrefix } from "../utils"; import { usePolling } from "../hooks"; import { DeadTaskExtended } from "../reducers/tasksReducer"; @@ -283,7 +283,7 @@ function Row(props: RowProps) { - {task.id} + {uuidPrefix(task.id)} {task.type} {timeAgo(task.last_failed_at)} diff --git a/ui/src/components/PendingTasksTable.tsx b/ui/src/components/PendingTasksTable.tsx index e121365..d7da089 100644 --- a/ui/src/components/PendingTasksTable.tsx +++ b/ui/src/components/PendingTasksTable.tsx @@ -29,6 +29,7 @@ import { listPendingTasksAsync } from "../actions/tasksActions"; import { AppState } from "../store"; import { PendingTask } from "../api"; import { usePolling } from "../hooks"; +import { uuidPrefix } from "../utils"; const useStyles = makeStyles({ table: { @@ -166,7 +167,7 @@ function Row(props: { task: PendingTask }) { - {task.id} + {uuidPrefix(task.id)} {task.type} diff --git a/ui/src/components/RetryTasksTable.tsx b/ui/src/components/RetryTasksTable.tsx index e3bb9b8..ca1e56f 100644 --- a/ui/src/components/RetryTasksTable.tsx +++ b/ui/src/components/RetryTasksTable.tsx @@ -40,7 +40,7 @@ import TablePaginationActions, { rowsPerPageOptions, } from "./TablePaginationActions"; import TableActions from "./TableActions"; -import { durationBefore } from "../timeutil"; +import { durationBefore, uuidPrefix } from "../utils"; import { usePolling } from "../hooks"; import { RetryTaskExtended } from "../reducers/tasksReducer"; @@ -307,7 +307,7 @@ function Row(props: RowProps) { - {task.id} + {uuidPrefix(task.id)} {task.type} {durationBefore(task.next_process_at)} diff --git a/ui/src/components/ScheduledTasksTable.tsx b/ui/src/components/ScheduledTasksTable.tsx index 6224d19..eb0023e 100644 --- a/ui/src/components/ScheduledTasksTable.tsx +++ b/ui/src/components/ScheduledTasksTable.tsx @@ -40,7 +40,7 @@ import TablePaginationActions, { rowsPerPageOptions, } from "./TablePaginationActions"; import TableActions from "./TableActions"; -import { durationBefore } from "../timeutil"; +import { durationBefore, uuidPrefix } from "../utils"; import { usePolling } from "../hooks"; import { ScheduledTaskExtended } from "../reducers/tasksReducer"; @@ -304,7 +304,7 @@ function Row(props: RowProps) { - {task.id} + {uuidPrefix(task.id)} {task.type} {durationBefore(task.next_process_at)} diff --git a/ui/src/components/SchedulerEntriesTable.tsx b/ui/src/components/SchedulerEntriesTable.tsx index d669ee5..a662fb0 100644 --- a/ui/src/components/SchedulerEntriesTable.tsx +++ b/ui/src/components/SchedulerEntriesTable.tsx @@ -14,7 +14,7 @@ import syntaxHighlightStyle from "react-syntax-highlighter/dist/esm/styles/hljs/ import { SortDirection, ColumnConfig } from "../types/table"; import TableSortLabel from "@material-ui/core/TableSortLabel"; import { SchedulerEntry } from "../api"; -import { timeAgo, durationBefore } from "../timeutil"; +import { timeAgo, durationBefore } from "../utils"; const useStyles = makeStyles((theme) => ({ table: { diff --git a/ui/src/reducers/snackbarReducer.ts b/ui/src/reducers/snackbarReducer.ts index 1dcdc6c..623caf4 100644 --- a/ui/src/reducers/snackbarReducer.ts +++ b/ui/src/reducers/snackbarReducer.ts @@ -56,43 +56,37 @@ function snackbarReducer( case RUN_SCHEDULED_TASK_SUCCESS: return { isOpen: true, - // TODO: show only task id - message: `Scheduled task ${action.taskKey} is now pending`, + message: `Scheduled task is now pending`, }; case RUN_RETRY_TASK_SUCCESS: return { isOpen: true, - // TODO: show only task id - message: `Retry task ${action.taskKey} is now pending`, + message: `Retry task is now pending`, }; case RUN_DEAD_TASK_SUCCESS: return { isOpen: true, - // TODO: show only task id - message: `Dead task ${action.taskKey} is now pending`, + message: `Dead task is now pending`, }; case KILL_SCHEDULED_TASK_SUCCESS: return { isOpen: true, - // TODO: show only task id - message: `Scheduled task ${action.taskKey} is now dead`, + message: `Scheduled task is now dead`, }; case KILL_RETRY_TASK_SUCCESS: return { isOpen: true, - // TODO: show only task id - message: `Retry task ${action.taskKey} is now dead`, + message: `Retry task is now dead`, }; case DELETE_SCHEDULED_TASK_SUCCESS: return { isOpen: true, - // TODO: show only task id - message: `Scheduled task ${action.taskKey} deleted`, + message: `Scheduled task deleted`, }; case BATCH_RUN_SCHEDULED_TASKS_SUCCESS: { @@ -142,8 +136,7 @@ function snackbarReducer( case DELETE_RETRY_TASK_SUCCESS: return { isOpen: true, - // TODO: show only task id - message: `Retry task ${action.taskKey} deleted`, + message: `Retry task deleted`, }; case BATCH_RUN_RETRY_TASKS_SUCCESS: { @@ -191,8 +184,7 @@ function snackbarReducer( case DELETE_DEAD_TASK_SUCCESS: return { isOpen: true, - // TODO: show only task id - message: `Dead task ${action.taskKey} deleted`, + message: `Dead task deleted`, }; case BATCH_RUN_DEAD_TASKS_SUCCESS: { diff --git a/ui/src/timeutil.ts b/ui/src/utils.ts similarity index 90% rename from ui/src/timeutil.ts rename to ui/src/utils.ts index ad4eb88..c714210 100644 --- a/ui/src/timeutil.ts +++ b/ui/src/utils.ts @@ -51,3 +51,11 @@ export function getCurrentUTCDate(): string { const yyyy = today.getFullYear(); return `${yyyy}-${mm}-${dd}`; } + +export function uuidPrefix(uuid: string): string { + const idx = uuid.indexOf("-"); + if (idx === -1) { + return uuid; + } + return uuid.substr(0, idx); +} diff --git a/ui/src/views/DashboardView.tsx b/ui/src/views/DashboardView.tsx index 4316584..a61c6b4 100644 --- a/ui/src/views/DashboardView.tsx +++ b/ui/src/views/DashboardView.tsx @@ -17,7 +17,7 @@ import QueueSizeChart from "../components/QueueSizeChart"; import ProcessedTasksChart from "../components/ProcessedTasksChart"; import QueuesOverviewTable from "../components/QueuesOverviewTable"; import Tooltip from "../components/Tooltip"; -import { getCurrentUTCDate } from "../timeutil"; +import { getCurrentUTCDate } from "../utils"; import { usePolling } from "../hooks"; const useStyles = makeStyles((theme) => ({