mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-08-15 05:15:56 +08:00
fix: handling of 404 in dashboard is updated (#2908)
This commit is contained in:
parent
52a222e87a
commit
9ad17c2d60
@ -16,7 +16,7 @@ export function ErrorResponseHandler(error: AxiosError): ErrorResponse {
|
|||||||
return {
|
return {
|
||||||
statusCode,
|
statusCode,
|
||||||
payload: null,
|
payload: null,
|
||||||
error: 'Not Found',
|
error: data.errorType,
|
||||||
message: null,
|
message: null,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
import { Typography } from 'antd';
|
||||||
|
import NotFound from 'components/NotFound';
|
||||||
import Spinner from 'components/Spinner';
|
import Spinner from 'components/Spinner';
|
||||||
import NewDashboard from 'container/NewDashboard';
|
import NewDashboard from 'container/NewDashboard';
|
||||||
import { useEffect } from 'react';
|
import { useEffect } from 'react';
|
||||||
@ -8,6 +10,7 @@ import { ThunkDispatch } from 'redux-thunk';
|
|||||||
import { GetDashboard, GetDashboardProps } from 'store/actions/dashboard';
|
import { GetDashboard, GetDashboardProps } from 'store/actions/dashboard';
|
||||||
import { AppState } from 'store/reducers';
|
import { AppState } from 'store/reducers';
|
||||||
import AppActions from 'types/actions';
|
import AppActions from 'types/actions';
|
||||||
|
import { ErrorType } from 'types/common';
|
||||||
import DashboardReducer from 'types/reducer/dashboards';
|
import DashboardReducer from 'types/reducer/dashboards';
|
||||||
|
|
||||||
function NewDashboardPage({ getDashboard }: NewDashboardProps): JSX.Element {
|
function NewDashboardPage({ getDashboard }: NewDashboardProps): JSX.Element {
|
||||||
@ -26,8 +29,17 @@ function NewDashboardPage({ getDashboard }: NewDashboardProps): JSX.Element {
|
|||||||
}
|
}
|
||||||
}, [getDashboard, dashboardId, dashboards.length]);
|
}, [getDashboard, dashboardId, dashboards.length]);
|
||||||
|
|
||||||
|
if (
|
||||||
|
error &&
|
||||||
|
!loading &&
|
||||||
|
dashboards.length === 0 &&
|
||||||
|
errorMessage === ErrorType.NotFound
|
||||||
|
) {
|
||||||
|
return <NotFound />;
|
||||||
|
}
|
||||||
|
|
||||||
if (error && !loading && dashboards.length === 0) {
|
if (error && !loading && dashboards.length === 0) {
|
||||||
return <div>{errorMessage}</div>;
|
return <Typography>{errorMessage}</Typography>;
|
||||||
}
|
}
|
||||||
|
|
||||||
// when user comes from dashboard page. dashboard array is populated with some dashboard as dashboard is populated
|
// when user comes from dashboard page. dashboard array is populated with some dashboard as dashboard is populated
|
||||||
|
@ -25,4 +25,8 @@ export type ErrorStatusCode =
|
|||||||
| BadRequest
|
| BadRequest
|
||||||
| Conflict;
|
| Conflict;
|
||||||
|
|
||||||
|
export enum ErrorType {
|
||||||
|
NotFound = 'not_found',
|
||||||
|
}
|
||||||
|
|
||||||
export type StatusCode = SuccessStatusCode | ErrorStatusCode;
|
export type StatusCode = SuccessStatusCode | ErrorStatusCode;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user