diff --git a/web-console/src/components/table-column-selector/table-column-selector.spec.tsx b/web-console/src/components/table-column-selector/table-column-selector.spec.tsx index e45fd590e631..e04377c9c5b1 100644 --- a/web-console/src/components/table-column-selector/table-column-selector.spec.tsx +++ b/web-console/src/components/table-column-selector/table-column-selector.spec.tsx @@ -25,7 +25,7 @@ describe('TableColumnSelector', () => { it('matches snapshot', () => { const tableColumn = ( {}} tableColumnsHidden={['b']} /> diff --git a/web-console/src/components/table-column-selector/table-column-selector.tsx b/web-console/src/components/table-column-selector/table-column-selector.tsx index 2a0c2b5a4762..d838e98e04d3 100644 --- a/web-console/src/components/table-column-selector/table-column-selector.tsx +++ b/web-console/src/components/table-column-selector/table-column-selector.tsx @@ -25,9 +25,15 @@ import { MenuCheckbox } from '../menu-checkbox/menu-checkbox'; import './table-column-selector.scss'; +export type TableColumnSelectorColumn = string | { text: string; label: string }; + +function getColumnName(c: TableColumnSelectorColumn) { + return typeof c === 'string' ? c : c.text; +} + interface TableColumnSelectorProps { - columns: string[]; - onChange: (column: string) => void; + columns: TableColumnSelectorColumn[]; + onChange: (columnName: string) => void; onClose?: (added: number) => void; tableColumnsHidden: string[]; } @@ -38,23 +44,28 @@ export const TableColumnSelector = React.memo(function TableColumnSelector( const { columns, onChange, onClose, tableColumnsHidden } = props; const [added, setAdded] = useState(0); - const isColumnShown = (column: string) => !tableColumnsHidden.includes(column); + const isColumnShown = (column: TableColumnSelectorColumn) => + !tableColumnsHidden.includes(getColumnName(column)); const checkboxes = ( - {columns.map(column => ( - { - if (!isColumnShown(column)) { - setAdded(added + 1); - } - onChange(column); - }} - /> - ))} + {columns.map(column => { + const columnName = getColumnName(column); + return ( + { + if (!isColumnShown(column)) { + setAdded(added + 1); + } + onChange(columnName); + }} + /> + ); + })} ); diff --git a/web-console/src/components/timed-button/__snapshots__/timed-button.spec.tsx.snap b/web-console/src/components/timed-button/__snapshots__/timed-button.spec.tsx.snap index b030fdb304bc..52fbee102425 100644 --- a/web-console/src/components/timed-button/__snapshots__/timed-button.spec.tsx.snap +++ b/web-console/src/components/timed-button/__snapshots__/timed-button.spec.tsx.snap @@ -18,7 +18,7 @@ exports[`TimedButton matches snapshot 1`] = ` - Statistics + Task stats diff --git a/web-console/src/views/supervisors-view/__snapshots__/supervisors-view.spec.tsx.snap b/web-console/src/views/supervisors-view/__snapshots__/supervisors-view.spec.tsx.snap index 6053d75102e8..3724fdf61f33 100644 --- a/web-console/src/views/supervisors-view/__snapshots__/supervisors-view.spec.tsx.snap +++ b/web-console/src/views/supervisors-view/__snapshots__/supervisors-view.spec.tsx.snap @@ -78,7 +78,23 @@ exports[`SupervisorsView matches snapshot 1`] = ` "Type", "Topic/Stream", "Status", - "Running tasks", + "Configured tasks", + { + "label": "status API", + "text": "Running tasks", + }, + { + "label": "status API", + "text": "Aggregate lag", + }, + { + "label": "status API", + "text": "Recent errors", + }, + { + "label": "stats API", + "text": "Stats", + }, "Actions", ] } @@ -155,37 +171,150 @@ exports[`SupervisorsView matches snapshot 1`] = ` "accessor": "supervisor_id", "id": "supervisor_id", "show": true, - "width": 300, + "width": 280, }, { "Cell": [Function], "Header": "Type", "accessor": "type", "show": true, - "width": 100, + "width": 80, }, { "Cell": [Function], "Header": "Topic/Stream", "accessor": "source", "show": true, - "width": 300, + "width": 200, }, { "Cell": [Function], "Header": "Status", "accessor": "detailed_state", - "id": "status", + "id": "detailed_state", + "show": true, + "width": 130, + }, + { + "Cell": [Function], + "Header": "Configured tasks", + "accessor": "spec", + "className": "padded", + "filterable": false, + "id": "configured_tasks", "show": true, - "width": 250, + "sortable": false, + "width": 150, }, { "Cell": [Function], "Header": "Running tasks", - "accessor": "running_tasks", + "accessor": "status.payload", "filterable": false, "id": "running_tasks", "show": true, + "sortable": false, + "width": 150, + }, + { + "Cell": [Function], + "Header": "Aggregate lag", + "accessor": "status.payload.aggregateLag", + "className": "padded", + "filterable": false, + "show": true, + "sortable": false, + "width": 200, + }, + { + "Cell": [Function], + "Header": + Stats +
+ + + + + + } + defaultIsOpen={false} + disabled={false} + fill={false} + hasBackdrop={false} + hoverCloseDelay={300} + hoverOpenDelay={150} + inheritDarkTheme={true} + interactionKind="click" + matchTargetWidth={false} + minimal={false} + openOnTargetFocus={true} + position="bottom" + positioningStrategy="absolute" + shouldReturnFocusOnClose={false} + targetTagName="span" + transitionDuration={300} + usePortal={true} + > + + Rate over past 5 minutes + + + + +
, + "accessor": "stats", + "className": "padded", + "filterable": false, + "id": "stats", + "show": true, + "sortable": false, + "width": 300, + }, + { + "Cell": [Function], + "Header": "Recent errors", + "accessor": "status.payload.recentErrors", + "filterable": false, + "show": true, + "sortable": false, "width": 150, }, { @@ -195,6 +324,7 @@ exports[`SupervisorsView matches snapshot 1`] = ` "filterable": false, "id": "actions", "show": true, + "sortable": false, "width": 70, }, ] @@ -244,7 +374,7 @@ exports[`SupervisorsView matches snapshot 1`] = ` getTrProps={[Function]} groupedByPivotKey="_groupedByPivot" indexKey="_index" - loading={true} + loading={false} loadingText="Loading..." multiSort={true} nestingLevelKey="_nestingLevel" diff --git a/web-console/src/views/supervisors-view/supervisors-view.tsx b/web-console/src/views/supervisors-view/supervisors-view.tsx index 316080641cea..8e65c3fa391f 100644 --- a/web-console/src/views/supervisors-view/supervisors-view.tsx +++ b/web-console/src/views/supervisors-view/supervisors-view.tsx @@ -25,6 +25,7 @@ import React from 'react'; import type { Filter } from 'react-table'; import ReactTable from 'react-table'; +import type { TableColumnSelectorColumn } from '../../components'; import { ACTION_COLUMN_ID, ACTION_COLUMN_LABEL, @@ -84,16 +85,16 @@ import type { BasicAction } from '../../utils/basic-action'; import './supervisors-view.scss'; -const supervisorTableColumns: string[] = [ +const SUPERVISOR_TABLE_COLUMNS: TableColumnSelectorColumn[] = [ 'Supervisor ID', 'Type', 'Topic/Stream', 'Status', 'Configured tasks', - 'Running tasks', - 'Aggregate lag', - 'Recent errors', - 'Stats', + { text: 'Running tasks', label: 'status API' }, + { text: 'Aggregate lag', label: 'status API' }, + { text: 'Recent errors', label: 'status API' }, + { text: 'Stats', label: 'stats API' }, ACTION_COLUMN_LABEL, ]; @@ -797,7 +798,7 @@ export class SupervisorsView extends React.PureComponent< , ), id: 'stats', - width: 220, + width: 300, filterable: false, sortable: false, className: 'padded', @@ -847,7 +848,7 @@ export class SupervisorsView extends React.PureComponent< { Header: 'Recent errors', accessor: 'status.payload.recentErrors', - width: 200, + width: 150, filterable: false, sortable: false, show: visibleColumns.shown('Recent errors'), @@ -1031,7 +1032,7 @@ export class SupervisorsView extends React.PureComponent< /> {this.renderBulkSupervisorActions()} this.setState(prevState => ({ visibleColumns: prevState.visibleColumns.toggle(column),