X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/d861bd54089e9279cd03b2e4561869ee877b9559..4fd42aef3c07c9e4c43bf873afe45e0043755ba0:/src/components/data-table/data-table.tsx diff --git a/src/components/data-table/data-table.tsx b/src/components/data-table/data-table.tsx index e8a6ce69..10446d1a 100644 --- a/src/components/data-table/data-table.tsx +++ b/src/components/data-table/data-table.tsx @@ -9,8 +9,8 @@ import { DataColumn, SortDirection } from './data-column'; import { DataTableDefaultView } from '../data-table-default-view/data-table-default-view'; import { DataTableFilters } from '../data-table-filters/data-table-filters-tree'; import { DataTableFiltersPopover } from '../data-table-filters/data-table-filters-popover'; -import { countNodes } from 'models/tree'; -import { PendingIcon } from 'components/icon/icon'; +import { countNodes, getTreeDirty } from 'models/tree'; +import { IconType, PendingIcon } from 'components/icon/icon'; import { SvgIconProps } from '@material-ui/core/SvgIcon'; import ArrowDownwardIcon from '@material-ui/icons/ArrowDownward'; @@ -31,7 +31,8 @@ export interface DataTableDataProps { onFiltersChange: (filters: DataTableFilters, column: DataColumn) => void; extractKey?: (item: T) => React.Key; working?: boolean; - defaultView?: React.ReactNode; + defaultViewIcon?: IconType; + defaultViewMessages?: string[]; currentItemUuid?: string; currentRoute?: string; } @@ -86,7 +87,8 @@ type DataTableProps = DataTableDataProps & WithStyles; export const DataTable = withStyles(styles)( class Component extends React.Component> { render() { - const { items, classes } = this.props; + // console.log('DATA_TABLE, RENDER:' , this) + const { items, classes, working } = this.props; return
@@ -96,24 +98,26 @@ export const DataTable = withStyles(styles)( - { this.props.working !== undefined && !this.props.working && items.map(this.renderBodyRow) } + { !working && items.map(this.renderBodyRow) }
- { this.props.working && + { !!working &&
} - {items.length === 0 && this.props.working !== undefined && !this.props.working && this.renderNoItemsPlaceholder()} + {items.length === 0 && !working && this.renderNoItemsPlaceholder(this.props.columns)}
; } - renderNoItemsPlaceholder = () => { - return this.props.defaultView - ? this.props.defaultView - : ; + renderNoItemsPlaceholder = (columns: DataColumns) => { + const dirty = columns.some((column) => getTreeDirty('')(column.filters)); + return ; } renderHeadCell = (column: DataColumn, index: number) => {