elementPath?: string;
isMSToolbarVisible: boolean;
checkedList: TCheckedList;
- is404?: boolean;
+ isNotFound?: boolean;
}
interface DataExplorerActionProps<T> {
setCheckedListOnStore={setCheckedListOnStore}
checkedList={checkedList}
working={working}
- is404={this.props.is404}
+ isNotFound={this.props.isNotFound}
/>
</Grid>
<Grid
toggleMSToolbar: (isVisible: boolean) => void;
setCheckedListOnStore: (checkedList: TCheckedList) => void;
checkedList: TCheckedList;
- is404?: boolean;
+ isNotFound?: boolean;
}
type CssRules =
};
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);
<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}
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>;
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 }),
});
searchValue: string;
working?: boolean;
requestState: DataTableRequestState;
- isResponse404: boolean;
+ isNotFound: boolean;
}
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>;
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,
});
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);
})
);
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());
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);
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[];
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) => {
userUuid: string;
dataExplorerItems: any;
working: boolean;
- is404: boolean;
+ isNotFound: boolean;
}
type ProjectPanelProps = ProjectPanelDataProps & DispatchProp & WithStyles<CssRules> & RouteComponentProps<{ id: string }>;
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,
};
contextMenuColumn={true}
defaultViewIcon={ProjectIcon}
defaultViewMessages={DEFAULT_VIEW_MESSAGES}
- is404={this.props.is404}
+ isNotFound={this.props.isNotFound}
/>
</div>
}
contextMenuColumn={false}
elementPath={`/ ${itemPath.reverse().join(' / ')}`}
hideSearchInput
- is404={props.is404}
+ isNotFound={props.isNotFound}
title={
<div>
{loggedIn.length === 1 ?
remoteHostsConfig: { [key: string]: Config };
localCluster: string;
numberOfItems: number;
- is404: boolean;
+ isNotFound: boolean;
}
export interface SearchResultsPanelActionProps {
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,
};
};