Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug 1834486: Make empty state page for topology list/graph consistent #5397

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,8 @@ export const TopologyPage: React.FC<TopologyPageProps> = ({ match }) => {
mock={false}
match={match}
title=""
EmptyMsg={EmptyMsg}
emptyBodyClass="odc-namespaced-page__content"
loader={() =>
import(
'@console/internal/components/overview' /* webpackChunkName: "topology-overview" */
Expand Down
23 changes: 18 additions & 5 deletions frontend/public/components/overview/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -373,8 +373,8 @@ class OverviewMainContent_ extends React.Component<
}

render() {
const { loaded, loadError, project, namespace } = this.props;
const { filteredItems, groupedItems } = this.state;
const { loaded, loadError, project, namespace, EmptyMsg, emptyBodyClass } = this.props;
const { items, filteredItems, groupedItems } = this.state;
const OverviewEmptyState = () => (
<MsgBox
title="No Workloads Found."
Expand All @@ -396,17 +396,22 @@ class OverviewMainContent_ extends React.Component<
</div>
);

const hasItems = items?.length > 0;
return (
<div className="co-m-pane">
<OverviewHeading project={_.get(project, 'data')} />
<div className="co-m-pane__body co-m-pane__body--no-top-margin">
{hasItems && <OverviewHeading project={_.get(project, 'data')} />}
<div
className={
(!hasItems && emptyBodyClass) || 'co-m-pane__body co-m-pane__body--no-top-margin'
}
>
<StatusBox
skeleton={skeletonOverview}
data={filteredItems}
label="Resources"
loaded={loaded}
loadError={loadError}
EmptyMsg={OverviewEmptyState}
EmptyMsg={EmptyMsg || OverviewEmptyState}
>
<ProjectOverview groups={groupedItems} />
</StatusBox>
Expand Down Expand Up @@ -448,6 +453,8 @@ const Overview_: React.SFC<OverviewProps> = ({
resourceList,
title,
dismissDetails,
EmptyMsg,
emptyBodyClass,
}) => {
const namespace = _.get(match, 'params.name');
const sidebarOpen = !_.isEmpty(selectedItem);
Expand Down Expand Up @@ -487,6 +494,8 @@ const Overview_: React.SFC<OverviewProps> = ({
selectedItem={selectedItem}
title={title}
utils={utils}
EmptyMsg={EmptyMsg}
emptyBodyClass={emptyBodyClass}
/>
</Firehose>
</div>
Expand Down Expand Up @@ -586,6 +595,8 @@ type OverviewMainContentOwnProps = {
title?: string;
clusterServiceVersions?: FirehoseResult<ClusterServiceVersionKind[]>;
utils?: Function[];
EmptyMsg?: React.ComponentType;
emptyBodyClass?: string;
};

export type OverviewMainContentProps = OverviewMainContentPropsFromState &
Expand All @@ -611,6 +622,8 @@ type OverviewOwnProps = {
mock: boolean;
match: any;
title: string;
EmptyMsg?: React.ComponentType;
emptyBodyClass?: string;
};

type OverviewProps = OverviewPropsFromState & OverviewPropsFromDispatch & OverviewOwnProps;