diff --git a/ui/src/components/AggregatingTasksTable.tsx b/ui/src/components/AggregatingTasksTable.tsx index 75b3b88..dcd420b 100644 --- a/ui/src/components/AggregatingTasksTable.tsx +++ b/ui/src/components/AggregatingTasksTable.tsx @@ -249,160 +249,175 @@ function AggregatingTasksTable( error={props.groupsError} /> - {!window.READ_ONLY && ( - 0} - iconButtonActions={[ - { - tooltip: "Delete", - icon: , - onClick: handleBatchDeleteClick, - disabled: props.batchActionPending, - }, - { - tooltip: "Archive", - icon: , - onClick: handleBatchArchiveClick, - disabled: props.batchActionPending, - }, - { - tooltip: "Run", - icon: , - onClick: handleBatchRunClick, - disabled: props.batchActionPending, - }, - ]} - menuItemActions={[ - { - label: "Delete All", - onClick: handleDeleteAllClick, - disabled: props.allActionPending, - }, - { - label: "Archive All", - onClick: handleArchiveAllClick, - disabled: props.allActionPending, - }, - { - label: "Run All", - onClick: handleRunAllClick, - disabled: props.allActionPending, - }, - ]} - /> - )} - - - - - {!window.READ_ONLY && ( - - - 0 && numSelected < rowCount} - checked={rowCount > 0 && numSelected === rowCount} - onChange={handleSelectAllClick} - inputProps={{ - "aria-label": "select all tasks shown in the table", + {props.tasks.length > 0 && selectedGroup !== null ? ( + <> + {!window.READ_ONLY && ( + 0} + iconButtonActions={[ + { + tooltip: "Delete", + icon: , + onClick: handleBatchDeleteClick, + disabled: props.batchActionPending, + }, + { + tooltip: "Archive", + icon: , + onClick: handleBatchArchiveClick, + disabled: props.batchActionPending, + }, + { + tooltip: "Run", + icon: , + onClick: handleBatchRunClick, + disabled: props.batchActionPending, + }, + ]} + menuItemActions={[ + { + label: "Delete All", + onClick: handleDeleteAllClick, + disabled: props.allActionPending, + }, + { + label: "Archive All", + onClick: handleArchiveAllClick, + disabled: props.allActionPending, + }, + { + label: "Run All", + onClick: handleRunAllClick, + disabled: props.allActionPending, + }, + ]} + /> + )} + +
+ + + {!window.READ_ONLY && ( + + + 0 && numSelected < rowCount + } + checked={rowCount > 0 && numSelected === rowCount} + onChange={handleSelectAllClick} + inputProps={{ + "aria-label": "select all tasks shown in the table", + }} + /> + + + )} + {columns + .filter((col) => { + // Filter out actions column in readonly mode. + return !window.READ_ONLY || col.key !== "actions"; + }) + .map((col) => ( + + {col.label} + + ))} + + + + {props.group === selectedGroup.group && + props.tasks.map((task) => ( + { + if (checked) { + setSelectedIds(selectedIds.concat(task.id)); + } else { + setSelectedIds( + selectedIds.filter((id) => id !== task.id) + ); + } }} + allActionPending={props.allActionPending} + onDeleteClick={() => { + if (selectedGroup === null) return; + props.deleteAggregatingTaskAsync( + queue, + selectedGroup.group, + task.id + ); + }} + onArchiveClick={() => { + if (selectedGroup === null) return; + props.archiveAggregatingTaskAsync( + queue, + selectedGroup.group, + task.id + ); + }} + onRunClick={() => { + if (selectedGroup === null) return; + props.runAggregatingTaskAsync( + queue, + selectedGroup.group, + task.id + ); + }} + onActionCellEnter={() => setActiveTaskId(task.id)} + onActionCellLeave={() => setActiveTaskId("")} + showActions={activeTaskId === task.id} /> - - - )} - {columns - .filter((col) => { - // Filter out actions column in readonly mode. - return !window.READ_ONLY || col.key !== "actions"; - }) - .map((col) => ( - + + + - {col.label} - - ))} - - - - {props.group === selectedGroup?.group && - props.tasks.map((task) => ( - { - if (checked) { - setSelectedIds(selectedIds.concat(task.id)); - } else { - setSelectedIds( - selectedIds.filter((id) => id !== task.id) - ); - } - }} - allActionPending={props.allActionPending} - onDeleteClick={() => { - if (selectedGroup === null) return; - props.deleteAggregatingTaskAsync( - queue, - selectedGroup.group, - task.id - ); - }} - onArchiveClick={() => { - if (selectedGroup === null) return; - props.archiveAggregatingTaskAsync( - queue, - selectedGroup.group, - task.id - ); - }} - onRunClick={() => { - if (selectedGroup === null) return; - props.runAggregatingTaskAsync( - queue, - selectedGroup.group, - task.id - ); - }} - onActionCellEnter={() => setActiveTaskId(task.id)} - onActionCellLeave={() => setActiveTaskId("")} - showActions={activeTaskId === task.id} - /> - ))} - - - - - - -
-
+ onPageChange={handlePageChange} + onRowsPerPageChange={handleRowsPerPageChange} + ActionsComponent={TablePaginationActions} + className={classes.pagination} + /> + + + + + + ) : ( + + Info + {selectedGroup === null ? ( +
Please select group
+ ) : ( +
Group {selectedGroup.group} is empty
+ )} +
+ )} ); }