X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/a1eff4d25c72460e1c3e52e523ba5029012d2ce9..e3521142de728bd3e45f5fcfbc1949c4a3c0652b:/services/workbench2/src/components/data-table/data-table.tsx diff --git a/services/workbench2/src/components/data-table/data-table.tsx b/services/workbench2/src/components/data-table/data-table.tsx index f9ab7f0a25..7b78799457 100644 --- a/services/workbench2/src/components/data-table/data-table.tsx +++ b/services/workbench2/src/components/data-table/data-table.tsx @@ -29,6 +29,7 @@ import { SvgIconProps } from "@material-ui/core/SvgIcon"; import ArrowDownwardIcon from "@material-ui/icons/ArrowDownward"; import { createTree } from "models/tree"; import { DataTableMultiselectOption } from "../data-table-multiselect-popover/data-table-multiselect-popover"; +import { PendingIcon } from "components/icon/icon"; export type DataColumns = Array>; @@ -54,7 +55,7 @@ export interface DataTableDataProps { toggleMSToolbar: (isVisible: boolean) => void; setCheckedListOnStore: (checkedList: TCheckedList) => void; checkedList: TCheckedList; - notFound?: boolean; + isNotFound?: boolean; } type CssRules = @@ -141,6 +142,7 @@ export type TCheckedList = Record; type DataTableState = { isSelected: boolean; + isLoaded: boolean; }; type DataTableProps = DataTableDataProps & WithStyles; @@ -149,6 +151,7 @@ export const DataTable = withStyles(styles)( class Component extends React.Component> { state: DataTableState = { isSelected: false, + isLoaded: false, }; componentDidMount(): void { @@ -166,6 +169,12 @@ export const DataTable = withStyles(styles)( if (prevProps.currentRoute !== this.props.currentRoute) { this.initializeCheckedList([]) } + if(prevProps.working === true && this.props.working === false) { + this.setState({ isLoaded: true }); + } + if((this.props.items.length > 0) && !this.state.isLoaded) { + this.setState({ isLoaded: true }); + } } componentWillUnmount(): void { @@ -286,7 +295,8 @@ export const DataTable = withStyles(styles)( }; render() { - const { items, classes, working, columns, notFound } = this.props; + const { items, classes, columns, isNotFound } = this.props; + const { isLoaded } = this.state; if (columns[0].name === this.checkBoxColumn.name) columns.shift(); columns.unshift(this.checkBoxColumn); return ( @@ -296,32 +306,35 @@ export const DataTable = withStyles(styles)( {this.mapVisibleColumns(this.renderHeadCell)} - {(!working && !notFound) && items.map(this.renderBodyRow)} + {(isLoaded && !isNotFound) && items.map(this.renderBodyRow)} - {(working || notFound) && this.renderNoItemsPlaceholder(this.props.columns)} + {(!isLoaded || isNotFound || items.length === 0) && this.renderNoItemsPlaceholder(this.props.columns)} ); } renderNoItemsPlaceholder = (columns: DataColumns) => { - const { working, notFound } = this.props; + const { isLoaded } = this.state; + const { working, isNotFound } = this.props; const dirty = columns.some(column => getTreeDirty("")(column.filters)); - if (working) { + if (isNotFound && isLoaded) { return ( ); - } else if (notFound) { + } else + if (isLoaded === false || working === true) { return ( ); } else { + // isLoaded && !working && !isNotFound return (