21386: renamed is404 to isnotfound Arvados-DCO-1.1-Signed-off-by: Lisa Knox <lisa...
authorLisa Knox <lisaknox83@gmail.com>
Wed, 21 Feb 2024 14:43:05 +0000 (09:43 -0500)
committerLisa Knox <lisaknox83@gmail.com>
Wed, 21 Feb 2024 14:43:05 +0000 (09:43 -0500)
services/workbench2/src/components/data-explorer/data-explorer.tsx
services/workbench2/src/components/data-table/data-table.tsx
services/workbench2/src/store/data-explorer/data-explorer-action.ts
services/workbench2/src/store/data-explorer/data-explorer-reducer.ts
services/workbench2/src/store/project-panel/project-panel-middleware-service.ts
services/workbench2/src/store/search-results-panel/search-results-middleware-service.ts
services/workbench2/src/views-components/data-explorer/data-explorer.tsx
services/workbench2/src/views/project-panel/project-panel.tsx
services/workbench2/src/views/search-results-panel/search-results-panel-view.tsx
services/workbench2/src/views/search-results-panel/search-results-panel.tsx

index 5d3fba3a6104b6aff428b96702e82e3782019584..1b3e7f31d45697ede6f06b785100f6b83af3cf65 100644 (file)
@@ -97,7 +97,7 @@ interface DataExplorerDataProps<T> {
     elementPath?: string;
     isMSToolbarVisible: boolean;
     checkedList: TCheckedList;
-    is404?: boolean;
+    isNotFound?: boolean;
 }
 
 interface DataExplorerActionProps<T> {
@@ -320,7 +320,7 @@ export const DataExplorer = withStyles(styles)(
                                 setCheckedListOnStore={setCheckedListOnStore}
                                 checkedList={checkedList}
                                 working={working}
-                                is404={this.props.is404}
+                                isNotFound={this.props.isNotFound}
                             />
                         </Grid>
                         <Grid
index 3e7c86459b1abe80beebba5c9754e05abe83413a..29ee94f1e75ce2a9d5349aedfad2178231c3ed9a 100644 (file)
@@ -54,7 +54,7 @@ export interface DataTableDataProps<I> {
     toggleMSToolbar: (isVisible: boolean) => void;
     setCheckedListOnStore: (checkedList: TCheckedList) => void;
     checkedList: TCheckedList;
-    is404?: boolean;
+    isNotFound?: boolean;
 }
 
 type CssRules =
@@ -291,7 +291,7 @@ export const DataTable = withStyles(styles)(
         };
 
         render() {
-            const { items, classes, columns, is404 } = 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);
@@ -302,32 +302,35 @@ export const DataTable = withStyles(styles)(
                             <TableHead>
                                 <TableRow>{this.mapVisibleColumns(this.renderHeadCell)}</TableRow>
                             </TableHead>
-                            <TableBody className={classes.tableBody}>{(isLoaded && !is404) && items.map(this.renderBodyRow)}</TableBody>
+                            <TableBody className={classes.tableBody}>{(isLoaded && !isNotFound) && items.map(this.renderBodyRow)}</TableBody>
                         </Table>
-                        {(!isLoaded || is404 || items.length === 0) && this.renderNoItemsPlaceholder(this.props.columns)}
+                        {(!isLoaded || isNotFound || items.length === 0) && this.renderNoItemsPlaceholder(this.props.columns)}
                     </div>
                 </div>
             );
         }
 
         renderNoItemsPlaceholder = (columns: DataColumns<T, any>) => {
+            const { isLoaded } = this.state;
+            const { working, items, isNotFound } = this.props;
             const dirty = columns.some(column => getTreeDirty("")(column.filters));
-            if (this.state.isLoaded === false || this.props.working === true) {
+            if (isNotFound && isLoaded) {
                 return (
                     <DataTableDefaultView 
                         icon={this.props.defaultViewIcon} 
-                        messages={["Loading data, please wait"]} 
+                        messages={["Item not found"]} 
                     />
                 );
-            } else if (this.props.is404) {
+            } else 
+            if (isLoaded === false || working === true) {
                 return (
                     <DataTableDefaultView 
                         icon={this.props.defaultViewIcon} 
-                        messages={["Item not found"]} 
+                        messages={["Loading data, please wait"]} 
                     />
                 );
             } else {
-                //if (isLoaded && !working && !is404)
+                //if (isLoaded && !working && !isNotFound)
                 return (
                     <DataTableDefaultView
                         icon={this.props.defaultViewIcon}
index 5a7ad22b8fe24b373b4ea50b80eb899974a5fc02..c25e0cf698f638c7e167da5569b4be5b559195a2 100644 (file)
@@ -29,7 +29,7 @@ export const dataExplorerActions = unionize({
     SET_EXPLORER_SEARCH_VALUE: ofType<{ id: string; searchValue: string }>(),
     RESET_EXPLORER_SEARCH_VALUE: ofType<{ id: string }>(),
     SET_REQUEST_STATE: ofType<{ id: string; requestState: DataTableRequestState }>(),
-    SET_IS_RESPONSE_404: ofType<{ id: string; isResponse404: boolean }>(),
+    SET_IS_NOT_FOUND: ofType<{ id: string; isNotFound: boolean }>(),
 });
 
 export type DataExplorerAction = UnionOf<typeof dataExplorerActions>;
@@ -52,5 +52,5 @@ export const bindDataExplorerActions = (id: string) => ({
     SET_EXPLORER_SEARCH_VALUE: (payload: { searchValue: string }) => dataExplorerActions.SET_EXPLORER_SEARCH_VALUE({ ...payload, id }),
     RESET_EXPLORER_SEARCH_VALUE: () => dataExplorerActions.RESET_EXPLORER_SEARCH_VALUE({ id }),
     SET_REQUEST_STATE: (payload: { requestState: DataTableRequestState }) => dataExplorerActions.SET_REQUEST_STATE({ ...payload, id }),
-    SET_IS_RESPONSE_404: (payload: { isResponse404: boolean }) => dataExplorerActions.SET_IS_RESPONSE_404({ ...payload, id }),
+    SET_IS_NOT_FOUND: (payload: { isNotFound: boolean }) => dataExplorerActions.SET_IS_NOT_FOUND({ ...payload, id }),
 });
index b50eabd69ac11d7da6b670bef0e614d95630a20d..2bc8caad365cbaa14232d5eba7536454bc9b609a 100644 (file)
@@ -30,7 +30,7 @@ export interface DataExplorer {
     searchValue: string;
     working?: boolean;
     requestState: DataTableRequestState;
-    isResponse404: boolean;
+    isNotFound: boolean;
 }
 
 export const initialDataExplorer: DataExplorer = {
@@ -43,7 +43,7 @@ export const initialDataExplorer: DataExplorer = {
     rowsPerPageOptions: [10, 20, 50, 100, 200, 500],
     searchValue: '',
     requestState: DataTableRequestState.IDLE,
-    isResponse404: false,
+    isNotFound: false,
 };
 
 export type DataExplorerState = Record<string, DataExplorer>;
@@ -121,8 +121,8 @@ export const dataExplorerReducer = (
         TOGGLE_COLUMN: ({ id, columnName }) =>
             update(state, id, mapColumns(toggleColumn(columnName))),
 
-        SET_IS_RESPONSE_404: ({ id, isResponse404 }) =>
-            update(state, id, (explorer) => ({ ...explorer, isResponse404 })),
+        SET_IS_NOT_FOUND: ({ id, isNotFound }) =>
+            update(state, id, (explorer) => ({ ...explorer, isNotFound })),
 
         default: () => state,
     });
index 7ff0a58a3fdbb2ac678c95b4ff8d7a0e00b03334..89f0576d8660a45f80aa197bbcb85adc83da0645 100644 (file)
@@ -55,7 +55,7 @@ export class ProjectPanelMiddlewareService extends DataExplorerMiddlewareService
             api.dispatch(projectPanelDataExplorerIsNotSet());
         } else {
             try {
-                api.dispatch<any>(dataExplorerActions.SET_IS_RESPONSE_404({ id: this.id, isResponse404: false }));
+                api.dispatch<any>(dataExplorerActions.SET_IS_NOT_FOUND({ id: this.id, isNotFound: false }));
                 if (!background) { api.dispatch(progressIndicatorActions.START_WORKING(this.getId())); }
                 const response = await this.services.groupsService.contents(projectUuid, getParams(dataExplorer, !!isProjectTrashed));
                 const resourceUuids = response.items.map(item => item.uuid);
@@ -74,7 +74,7 @@ export class ProjectPanelMiddlewareService extends DataExplorerMiddlewareService
                     })
                 );
                 if (e.status === 404) {
-                    api.dispatch<any>(dataExplorerActions.SET_IS_RESPONSE_404({ id: this.id, isResponse404: true}));
+                    api.dispatch<any>(dataExplorerActions.SET_IS_NOT_FOUND({ id: this.id, isNotFound: true}));
                 }
                 else {
                     api.dispatch(couldNotFetchProjectContents());
index 86d94d9ccbac9bc8a3651b8c046dc0b8f634bf2d..dab83e0114d431b8e15cc6a6e68078f4d7696e0d 100644 (file)
@@ -61,7 +61,7 @@ export class SearchResultsMiddlewareService extends DataExplorerMiddlewareServic
         let numberOfResolvedResponses = 0;
         let totalNumItemsAvailable = 0;
         api.dispatch(progressIndicatorActions.START_WORKING(this.id))
-        api.dispatch(dataExplorerActions.SET_IS_RESPONSE_404({ id: this.id, isResponse404: false }));
+        api.dispatch(dataExplorerActions.SET_IS_NOT_FOUND({ id: this.id, isNotFound: false }));
 
         sessions.forEach(session => {
             const params = getParams(dataExplorer, searchValue, session.apiRevision);
@@ -73,7 +73,7 @@ export class SearchResultsMiddlewareService extends DataExplorerMiddlewareServic
                     totalNumItemsAvailable += response.itemsAvailable;
                     if (numberOfResolvedResponses === numberOfSessions) {
                         api.dispatch(progressIndicatorActions.STOP_WORKING(this.id))
-                        if(totalNumItemsAvailable === 0) api.dispatch(dataExplorerActions.SET_IS_RESPONSE_404({ id: this.id, isResponse404: true }))
+                        if(totalNumItemsAvailable === 0) api.dispatch(dataExplorerActions.SET_IS_NOT_FOUND({ id: this.id, isNotFound: true }))
                     }
                     // Request all containers for process status to be available
                     const containerRequests = response.items.filter((item) => item.kind === ResourceKind.CONTAINER_REQUEST) as ContainerRequestResource[];
index 978c2014d4bf0c67c4c345d13cabe819bd337e7b..b4536d83b9a8219c289c2e1f43d1df7fb5fb2978 100644 (file)
@@ -21,7 +21,7 @@ interface Props {
     onRowDoubleClick: (item: any) => void;
     extractKey?: (item: any) => React.Key;
     working?: boolean;
-    is404?: boolean;
+    isNotFound?: boolean;
 }
 
 const mapStateToProps = ({ progressIndicator, dataExplorer, router, multiselect, detailsPanel, properties}: RootState, { id }: Props) => {
index 458c312742cf18866cd92e6f2b330ad19841e8f5..ef6e7bdf3aee58064d3ae4bb76b6bd5eb0ad2bf4 100644 (file)
@@ -256,7 +256,7 @@ interface ProjectPanelDataProps {
     userUuid: string;
     dataExplorerItems: any;
     working: boolean;
-    is404: boolean;
+    isNotFound: boolean;
 }
 
 type ProjectPanelProps = ProjectPanelDataProps & DispatchProp & WithStyles<CssRules> & RouteComponentProps<{ id: string }>;
@@ -264,11 +264,11 @@ type ProjectPanelProps = ProjectPanelDataProps & DispatchProp & WithStyles<CssRu
 const mapStateToProps = (state: RootState) => {
     const currentItemId = getProperty<string>(PROJECT_PANEL_CURRENT_UUID)(state.properties);
     const project = getResource<GroupResource>(currentItemId || "")(state.resources);
-    const is404 = state.dataExplorer[PROJECT_PANEL_ID].isResponse404;
+    const isNotFound = state.dataExplorer[PROJECT_PANEL_ID].isNotFound;
     return {
         currentItemId,
         project,
-        is404,
+        isNotFound,
         resources: state.resources,
         userUuid: state.auth.user!.uuid,
     };
@@ -289,7 +289,7 @@ export const ProjectPanel = withStyles(styles)(
                         contextMenuColumn={true}
                         defaultViewIcon={ProjectIcon}
                         defaultViewMessages={DEFAULT_VIEW_MESSAGES}
-                        is404={this.props.is404}
+                        isNotFound={this.props.isNotFound}
                     />
                 </div>
             }
index 45fbd0ac76adef2ac5100e820c7ee840cb727b06..34c28ed36148c7e74fb3210eb96f53cd15c387ef 100644 (file)
@@ -168,7 +168,7 @@ export const SearchResultsPanelView = withStyles(styles, { withTheme: true })(
                 contextMenuColumn={false}
                 elementPath={`/ ${itemPath.reverse().join(' / ')}`}
                 hideSearchInput
-                is404={props.is404}
+                isNotFound={props.isNotFound}
                 title={
                     <div>
                         {loggedIn.length === 1 ?
index df243d67cfd95df9f6e43d629844bccd94d0672d..907189d1fa0906149da4ce86634318f94c3c7b41 100644 (file)
@@ -23,7 +23,7 @@ export interface SearchResultsPanelDataProps {
     remoteHostsConfig: { [key: string]: Config };
     localCluster: string;
     numberOfItems: number;
-    is404: boolean;
+    isNotFound: boolean;
 }
 
 export interface SearchResultsPanelActionProps {
@@ -38,14 +38,14 @@ export type SearchResultsPanelProps = SearchResultsPanelDataProps & SearchResult
 const mapStateToProps = (rootState: RootState) => {
     const { dataExplorer } = rootState;
     const numberOfItems = dataExplorer[SEARCH_RESULTS_PANEL_ID].items.length;
-    const is404 = dataExplorer[SEARCH_RESULTS_PANEL_ID].isResponse404;
+    const isNotFound = dataExplorer[SEARCH_RESULTS_PANEL_ID].isNotFound;
     return {
         user: rootState.auth.user,
         sessions: rootState.auth.sessions,
         remoteHostsConfig: rootState.auth.remoteHostsConfig,
         localCluster: rootState.auth.localCluster,
         numberOfItems,
-        is404,
+        isNotFound,
     };
 };