Replace Alert with ErrorPanel

Signed-off-by: mufaddal motiwala <mufaddalmm.52@gmail.com>
This commit is contained in:
mufaddal motiwala
2021-12-20 14:17:19 +05:30
parent 11d4ee492d
commit 5010cc6566
3 changed files with 11 additions and 9 deletions
@@ -18,8 +18,12 @@ import { Box, makeStyles, Typography } from '@material-ui/core';
import { newRelicDashboardApiRef } from '../../api';
import { useApi } from '@backstage/core-plugin-api';
import { useAsync } from 'react-use';
import { Progress, InfoCard, Link } from '@backstage/core-components';
import Alert from '@material-ui/lab/Alert';
import {
Progress,
InfoCard,
Link,
ErrorPanel,
} from '@backstage/core-components';
import DesktopMac from '@material-ui/icons/DesktopMac';
import { useNewRelicDashboardEntity } from '../../hooks';
import { DashboardEntitySummary } from '../../api/NewRelicDashboardApi';
@@ -52,7 +56,7 @@ export const DashboardEntityList = () => {
return <Progress />;
}
if (error) {
return <Alert severity="error">{error.message}</Alert>;
return <ErrorPanel title={error.name} defaultExpanded error={error} />;
}
return (
<InfoCard title="New Relic Dashboard Pages" variant="gridItem">
@@ -17,9 +17,8 @@ import React from 'react';
import { Box, Grid } from '@material-ui/core';
import { useApi } from '@backstage/core-plugin-api';
import { useAsync } from 'react-use';
import { InfoCard, Progress } from '@backstage/core-components';
import { InfoCard, Progress, ErrorPanel } from '@backstage/core-components';
import { newRelicDashboardApiRef } from '../../../api';
import Alert from '@material-ui/lab/Alert';
import { DashboardSnapshotSummary } from './../../../api/NewRelicDashboardApi';
type Props = {
@@ -47,7 +46,7 @@ export const DashboardSnapshot = ({
return <Progress />;
}
if (error) {
return <Alert severity="error">{error.message}</Alert>;
return <ErrorPanel title={error.name} defaultExpanded error={error} />;
}
return (
<Grid container style={{ marginTop: '30px' }}>
@@ -18,8 +18,7 @@ import { Grid, Tab, Tabs, makeStyles } from '@material-ui/core';
import { newRelicDashboardApiRef } from '../../../api';
import { useApi } from '@backstage/core-plugin-api';
import { useAsync } from 'react-use';
import { Progress } from '@backstage/core-components';
import Alert from '@material-ui/lab/Alert';
import { Progress, ErrorPanel } from '@backstage/core-components';
import { DashboardSnapshot } from './DashboardSnapshot';
import { DashboardEntitySummary } from '../../../api/NewRelicDashboardApi';
import { ResultEntity } from '../../../types/DashboardEntity';
@@ -99,7 +98,7 @@ export const DashboardSnapshotList = ({ guid }: Props) => {
return <Progress />;
}
if (error) {
return <Alert severity="error">{error.message}</Alert>;
return <ErrorPanel title={error.name} defaultExpanded error={error} />;
}
return (
<Grid container direction="column">