mirror of
https://github.com/grafana/grafana.git
synced 2025-02-15 01:53:33 -06:00
* Add and configure eslint-plugin-import * Fix the lint:ts npm command * Autofix + prettier all the files * Manually fix remaining files * Move jquery code in jest-setup to external file to safely reorder imports * Resolve issue caused by circular dependencies within Prometheus * Update .betterer.results * Fix missing // @ts-ignore * ignore iconBundle.ts * Fix missing // @ts-ignore
38 lines
919 B
TypeScript
38 lines
919 B
TypeScript
import { css } from '@emotion/css';
|
|
import React from 'react';
|
|
|
|
import { GrafanaTheme } from '@grafana/data';
|
|
import { Alert, useStyles } from '@grafana/ui';
|
|
import { getMessageFromError } from 'app/core/utils/errors';
|
|
import { DashboardInitError, AppNotificationSeverity } from 'app/types';
|
|
|
|
export interface Props {
|
|
initError?: DashboardInitError;
|
|
}
|
|
|
|
export const DashboardFailed = ({ initError }: Props) => {
|
|
const styles = useStyles(getStyles);
|
|
if (!initError) {
|
|
return null;
|
|
}
|
|
|
|
return (
|
|
<div className={styles.dashboardLoading}>
|
|
<Alert severity={AppNotificationSeverity.Error} title={initError.message}>
|
|
{getMessageFromError(initError.error)}
|
|
</Alert>
|
|
</div>
|
|
);
|
|
};
|
|
|
|
export const getStyles = (theme: GrafanaTheme) => {
|
|
return {
|
|
dashboardLoading: css`
|
|
height: 60vh;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
`,
|
|
};
|
|
};
|