mirror of
https://github.com/grafana/grafana.git
synced 2025-02-15 10:03:33 -06:00
* DashboardPage: refactored styles from sass to emotion * refactored dashboardPage component to be alot easier to read and understand * more refactoring... * more cleaning... * fixes frontend test * fixes frontend test- I hope * fixes frontend test- I hope * moves dashboard scss styles back to it's standalone file
37 lines
913 B
TypeScript
37 lines
913 B
TypeScript
import React from 'react';
|
|
import { css } from 'emotion';
|
|
import { Alert, useStyles } from '@grafana/ui';
|
|
import { GrafanaTheme } from '@grafana/data';
|
|
import { DashboardInitError, AppNotificationSeverity } from 'app/types';
|
|
import { getMessageFromError } from 'app/core/utils/errors';
|
|
|
|
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;
|
|
`,
|
|
};
|
|
};
|