Dashboard: When dashboard is not found show message instead of empty page (#65508)

* setup page when dashboard is not found

* reuse ErrorPage for not found dashboard
This commit is contained in:
Polina Boneva
2023-03-30 13:50:59 +03:00
committed by GitHub
parent b9fb23502c
commit 6f818294d3

View File

@@ -19,6 +19,7 @@ import { selectors } from '@grafana/e2e-selectors';
import { config, locationService } from '@grafana/runtime';
import { Icon, Themeable2, withTheme2 } from '@grafana/ui';
import { notifyApp } from 'app/core/actions';
import ErrorPage from 'app/core/components/ErrorPage/ErrorPage';
import { Page } from 'app/core/components/Page/Page';
import { GrafanaContext, GrafanaContextType } from 'app/core/context/GrafanaContext';
import { createErrorNotification } from 'app/core/copy/appNotification';
@@ -440,6 +441,10 @@ export class UnthemedDashboardPage extends PureComponent<Props, State> {
>
<DashboardPrompt dashboard={dashboard} />
{initError && <DashboardFailed />}
{dashboard.meta.dashboardNotFound ? (
<ErrorPage />
) : (
<>
{showSubMenu && (
<section aria-label={selectors.pages.Dashboard.SubMenu.submenu}>
<SubMenu dashboard={dashboard} annotations={dashboard.annotations.list} links={dashboard.links} />
@@ -481,6 +486,8 @@ export class UnthemedDashboardPage extends PureComponent<Props, State> {
/>
)}
{inspectPanel && <PanelInspector dashboard={dashboard} panel={inspectPanel} />}
</>
)}
</Page>
{editPanel && (
<PanelEditor