mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
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:
@@ -19,6 +19,7 @@ import { selectors } from '@grafana/e2e-selectors';
|
|||||||
import { config, locationService } from '@grafana/runtime';
|
import { config, locationService } from '@grafana/runtime';
|
||||||
import { Icon, Themeable2, withTheme2 } from '@grafana/ui';
|
import { Icon, Themeable2, withTheme2 } from '@grafana/ui';
|
||||||
import { notifyApp } from 'app/core/actions';
|
import { notifyApp } from 'app/core/actions';
|
||||||
|
import ErrorPage from 'app/core/components/ErrorPage/ErrorPage';
|
||||||
import { Page } from 'app/core/components/Page/Page';
|
import { Page } from 'app/core/components/Page/Page';
|
||||||
import { GrafanaContext, GrafanaContextType } from 'app/core/context/GrafanaContext';
|
import { GrafanaContext, GrafanaContextType } from 'app/core/context/GrafanaContext';
|
||||||
import { createErrorNotification } from 'app/core/copy/appNotification';
|
import { createErrorNotification } from 'app/core/copy/appNotification';
|
||||||
@@ -440,47 +441,53 @@ export class UnthemedDashboardPage extends PureComponent<Props, State> {
|
|||||||
>
|
>
|
||||||
<DashboardPrompt dashboard={dashboard} />
|
<DashboardPrompt dashboard={dashboard} />
|
||||||
{initError && <DashboardFailed />}
|
{initError && <DashboardFailed />}
|
||||||
{showSubMenu && (
|
{dashboard.meta.dashboardNotFound ? (
|
||||||
<section aria-label={selectors.pages.Dashboard.SubMenu.submenu}>
|
<ErrorPage />
|
||||||
<SubMenu dashboard={dashboard} annotations={dashboard.annotations.list} links={dashboard.links} />
|
|
||||||
</section>
|
|
||||||
)}
|
|
||||||
{config.featureToggles.editPanelCSVDragAndDrop ? (
|
|
||||||
<DropZone
|
|
||||||
onDrop={this.onFileDrop}
|
|
||||||
accept={DFImport.acceptedFiles}
|
|
||||||
maxSize={DFImport.maxFileSize}
|
|
||||||
noClick={true}
|
|
||||||
>
|
|
||||||
{({ getRootProps, isDragActive }) => {
|
|
||||||
const styles = getStyles(this.props.theme, isDragActive);
|
|
||||||
return (
|
|
||||||
<div {...getRootProps({ className: styles.dropZone })}>
|
|
||||||
<div className={styles.dropOverlay}>
|
|
||||||
<div className={styles.dropHint}>
|
|
||||||
<Icon name="upload" size="xxxl"></Icon>
|
|
||||||
<h3>Create tables from spreadsheets</h3>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<DashboardGrid
|
|
||||||
dashboard={dashboard}
|
|
||||||
isEditable={!!dashboard.meta.canEdit}
|
|
||||||
viewPanel={viewPanel}
|
|
||||||
editPanel={editPanel}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}}
|
|
||||||
</DropZone>
|
|
||||||
) : (
|
) : (
|
||||||
<DashboardGrid
|
<>
|
||||||
dashboard={dashboard}
|
{showSubMenu && (
|
||||||
isEditable={!!dashboard.meta.canEdit}
|
<section aria-label={selectors.pages.Dashboard.SubMenu.submenu}>
|
||||||
viewPanel={viewPanel}
|
<SubMenu dashboard={dashboard} annotations={dashboard.annotations.list} links={dashboard.links} />
|
||||||
editPanel={editPanel}
|
</section>
|
||||||
/>
|
)}
|
||||||
|
{config.featureToggles.editPanelCSVDragAndDrop ? (
|
||||||
|
<DropZone
|
||||||
|
onDrop={this.onFileDrop}
|
||||||
|
accept={DFImport.acceptedFiles}
|
||||||
|
maxSize={DFImport.maxFileSize}
|
||||||
|
noClick={true}
|
||||||
|
>
|
||||||
|
{({ getRootProps, isDragActive }) => {
|
||||||
|
const styles = getStyles(this.props.theme, isDragActive);
|
||||||
|
return (
|
||||||
|
<div {...getRootProps({ className: styles.dropZone })}>
|
||||||
|
<div className={styles.dropOverlay}>
|
||||||
|
<div className={styles.dropHint}>
|
||||||
|
<Icon name="upload" size="xxxl"></Icon>
|
||||||
|
<h3>Create tables from spreadsheets</h3>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<DashboardGrid
|
||||||
|
dashboard={dashboard}
|
||||||
|
isEditable={!!dashboard.meta.canEdit}
|
||||||
|
viewPanel={viewPanel}
|
||||||
|
editPanel={editPanel}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}}
|
||||||
|
</DropZone>
|
||||||
|
) : (
|
||||||
|
<DashboardGrid
|
||||||
|
dashboard={dashboard}
|
||||||
|
isEditable={!!dashboard.meta.canEdit}
|
||||||
|
viewPanel={viewPanel}
|
||||||
|
editPanel={editPanel}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
{inspectPanel && <PanelInspector dashboard={dashboard} panel={inspectPanel} />}
|
||||||
|
</>
|
||||||
)}
|
)}
|
||||||
{inspectPanel && <PanelInspector dashboard={dashboard} panel={inspectPanel} />}
|
|
||||||
</Page>
|
</Page>
|
||||||
{editPanel && (
|
{editPanel && (
|
||||||
<PanelEditor
|
<PanelEditor
|
||||||
|
Reference in New Issue
Block a user