X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/a1eff4d25c72460e1c3e52e523ba5029012d2ce9..cd0d451424fd6dbdb4dfb8ce98e479a60b94e0fd:/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..3e7c86459b 100644 --- a/services/workbench2/src/components/data-table/data-table.tsx +++ b/services/workbench2/src/components/data-table/data-table.tsx @@ -54,7 +54,7 @@ export interface DataTableDataProps { toggleMSToolbar: (isVisible: boolean) => void; setCheckedListOnStore: (checkedList: TCheckedList) => void; checkedList: TCheckedList; - notFound?: boolean; + is404?: boolean; } type CssRules = @@ -141,6 +141,7 @@ export type TCheckedList = Record; type DataTableState = { isSelected: boolean; + isLoaded: boolean; }; type DataTableProps = DataTableDataProps & WithStyles; @@ -149,6 +150,7 @@ export const DataTable = withStyles(styles)( class Component extends React.Component> { state: DataTableState = { isSelected: false, + isLoaded: false, }; componentDidMount(): void { @@ -166,6 +168,9 @@ 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 }); + } } componentWillUnmount(): void { @@ -286,7 +291,8 @@ export const DataTable = withStyles(styles)( }; render() { - const { items, classes, working, columns, notFound } = this.props; + const { items, classes, columns, is404 } = this.props; + const { isLoaded } = this.state; if (columns[0].name === this.checkBoxColumn.name) columns.shift(); columns.unshift(this.checkBoxColumn); return ( @@ -296,32 +302,32 @@ export const DataTable = withStyles(styles)( {this.mapVisibleColumns(this.renderHeadCell)} - {(!working && !notFound) && items.map(this.renderBodyRow)} + {(isLoaded && !is404) && items.map(this.renderBodyRow)} - {(working || notFound) && this.renderNoItemsPlaceholder(this.props.columns)} + {(!isLoaded || is404 || items.length === 0) && this.renderNoItemsPlaceholder(this.props.columns)} ); } renderNoItemsPlaceholder = (columns: DataColumns) => { - const { working, notFound } = this.props; const dirty = columns.some(column => getTreeDirty("")(column.filters)); - if (working) { + if (this.state.isLoaded === false || this.props.working === true) { return ( ); - } else if (notFound) { + } else if (this.props.is404) { return ( ); } else { + //if (isLoaded && !working && !is404) return (