fix(FE): show no No Data on default Dashboards (#2003)

* fix(FE): show no No Data on default Dashboards

Signed-off-by: Marius Kimmina <mar.kimmina@gmail.com>

* chore: removed un used styles

Signed-off-by: Marius Kimmina <mar.kimmina@gmail.com>
Co-authored-by: Vishal Sharma <makeavish786@gmail.com>
Co-authored-by: Palash Gupta <palashgdev@gmail.com>
This commit is contained in:
Marius Kimmina 2023-01-10 19:24:14 +01:00 committed by GitHub
parent 44360ecacf
commit a4346a2d93
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 20 deletions

View File

@ -1,4 +1,4 @@
import { Button, Typography } from 'antd';
import { Button } from 'antd';
import { GraphOnClickHandler } from 'components/Graph';
import Spinner from 'components/Spinner';
import TimePreference from 'components/TimePreferenceDropDown';
@ -19,7 +19,7 @@ import { Widgets } from 'types/api/dashboard/getAll';
import { MetricRangePayloadProps } from 'types/api/metrics/getQueryRange';
import { GlobalReducer } from 'types/reducer/globalTime';
import { NotFoundContainer, TimeContainer } from './styles';
import { TimeContainer } from './styles';
function FullView({
widget,
@ -57,20 +57,11 @@ function FullView({
}),
);
const isError = response?.error;
const isLoading = response.isLoading === true;
const errorMessage = isError instanceof Error ? isError?.message : '';
if (isLoading) {
return <Spinner height="100%" size="large" tip="Loading..." />;
}
if (isError || !response?.data?.payload?.data?.result) {
return (
<NotFoundContainer>
<Typography>{errorMessage}</Typography>
</NotFoundContainer>
);
}
return (
<>

View File

@ -1,14 +1,5 @@
import styled from 'styled-components';
export const GraphContainer = styled.div`
min-height: 70vh;
align-items: center;
justify-content: center;
display: flex;
flex-direction: column;
width: 100%;
`;
export const NotFoundContainer = styled.div`
display: flex;
justify-content: center;