21386: added default case for isNotFound Arvados-DCO-1.1-Signed-off-by: Lisa Knox...
[arvados.git] / services / workbench2 / src / components / data-explorer / data-explorer.tsx
index 27e46d584962c8d3e1cb1ca536b21ab1b4577ecf..4e89b752a67c83ab00e1f30507cebc1c60c2f732 100644 (file)
@@ -97,6 +97,7 @@ interface DataExplorerDataProps<T> {
     elementPath?: string;
     isMSToolbarVisible: boolean;
     checkedList: TCheckedList;
+    isNotFound?: boolean;
 }
 
 interface DataExplorerActionProps<T> {
@@ -118,10 +119,14 @@ interface DataExplorerActionProps<T> {
 
 type DataExplorerProps<T> = DataExplorerDataProps<T> & DataExplorerActionProps<T> & WithStyles<CssRules> & MPVPanelProps;
 
+type DataExplorerState = {
+    prevRefresh: string;
+    prevRoute: string;
+};
+
 export const DataExplorer = withStyles(styles)(
     class DataExplorerGeneric<T> extends React.Component<DataExplorerProps<T>> {
-        state = {
-            showLoading: false,
+        state: DataExplorerState = {
             prevRefresh: "",
             prevRoute: "",
         };
@@ -136,7 +141,6 @@ export const DataExplorer = withStyles(styles)(
                 // Component already mounted, but the user comes from a route change,
                 // like browsing through a project hierarchy.
                 this.setState({
-                    showLoading: this.props.working,
                     prevRoute: currentRoute,
                 });
             }
@@ -145,15 +149,9 @@ export const DataExplorer = withStyles(styles)(
                 // Component already mounted, but the user just clicked the
                 // refresh button.
                 this.setState({
-                    showLoading: this.props.working,
                     prevRefresh: currentRefresh,
                 });
             }
-            if (this.state.showLoading && !this.props.working) {
-                this.setState({
-                    showLoading: false,
-                });
-            }
         }
 
         componentDidMount() {
@@ -162,7 +160,6 @@ export const DataExplorer = withStyles(styles)(
             }
             // Component just mounted, so we need to show the loading indicator.
             this.setState({
-                showLoading: this.props.working,
                 prevRefresh: this.props.currentRefresh || "",
                 prevRoute: this.props.currentRoute || "",
             });
@@ -207,6 +204,7 @@ export const DataExplorer = withStyles(styles)(
                 toggleMSToolbar,
                 setCheckedListOnStore,
                 checkedList,
+                working,
             } = this.props;
             return (
                 <Paper
@@ -314,7 +312,6 @@ export const DataExplorer = withStyles(styles)(
                                 onFiltersChange={onFiltersChange}
                                 onSortToggle={onSortToggle}
                                 extractKey={extractKey}
-                                working={this.state.showLoading}
                                 defaultViewIcon={defaultViewIcon}
                                 defaultViewMessages={defaultViewMessages}
                                 currentItemUuid={currentItemUuid}
@@ -322,6 +319,8 @@ export const DataExplorer = withStyles(styles)(
                                 toggleMSToolbar={toggleMSToolbar}
                                 setCheckedListOnStore={setCheckedListOnStore}
                                 checkedList={checkedList}
+                                working={working}
+                                isNotFound={this.props.isNotFound || false}
                             />
                         </Grid>
                         <Grid