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:
parent
b9fb23502c
commit
6f818294d3
@ -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,47 +441,53 @@ export class UnthemedDashboardPage extends PureComponent<Props, State> {
|
||||
>
|
||||
<DashboardPrompt dashboard={dashboard} />
|
||||
{initError && <DashboardFailed />}
|
||||
{showSubMenu && (
|
||||
<section aria-label={selectors.pages.Dashboard.SubMenu.submenu}>
|
||||
<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>
|
||||
{dashboard.meta.dashboardNotFound ? (
|
||||
<ErrorPage />
|
||||
) : (
|
||||
<DashboardGrid
|
||||
dashboard={dashboard}
|
||||
isEditable={!!dashboard.meta.canEdit}
|
||||
viewPanel={viewPanel}
|
||||
editPanel={editPanel}
|
||||
/>
|
||||
<>
|
||||
{showSubMenu && (
|
||||
<section aria-label={selectors.pages.Dashboard.SubMenu.submenu}>
|
||||
<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}
|
||||
isEditable={!!dashboard.meta.canEdit}
|
||||
viewPanel={viewPanel}
|
||||
editPanel={editPanel}
|
||||
/>
|
||||
)}
|
||||
{inspectPanel && <PanelInspector dashboard={dashboard} panel={inspectPanel} />}
|
||||
</>
|
||||
)}
|
||||
{inspectPanel && <PanelInspector dashboard={dashboard} panel={inspectPanel} />}
|
||||
</Page>
|
||||
{editPanel && (
|
||||
<PanelEditor
|
||||
|
Loading…
Reference in New Issue
Block a user