mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-07-26 10:04:26 +08:00
chore: error message is displayed to user in the error page (#1085)
This commit is contained in:
parent
fe18e85e36
commit
7cf567792a
@ -1,9 +1,10 @@
|
|||||||
import { Table, Typography } from 'antd';
|
import { notification, Table, Typography } from 'antd';
|
||||||
import { ColumnsType } from 'antd/lib/table';
|
import { ColumnsType } from 'antd/lib/table';
|
||||||
import getAll from 'api/errors/getAll';
|
import getAll from 'api/errors/getAll';
|
||||||
import ROUTES from 'constants/routes';
|
import ROUTES from 'constants/routes';
|
||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
import React from 'react';
|
import React, { useEffect } from 'react';
|
||||||
|
import { useTranslation } from 'react-i18next';
|
||||||
import { useQuery } from 'react-query';
|
import { useQuery } from 'react-query';
|
||||||
import { useSelector } from 'react-redux';
|
import { useSelector } from 'react-redux';
|
||||||
import { generatePath, Link } from 'react-router-dom';
|
import { generatePath, Link } from 'react-router-dom';
|
||||||
@ -16,6 +17,8 @@ function AllErrors(): JSX.Element {
|
|||||||
(state) => state.globalTime,
|
(state) => state.globalTime,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const { t } = useTranslation(['common']);
|
||||||
|
|
||||||
const { isLoading, data } = useQuery(['getAllError', [maxTime, minTime]], {
|
const { isLoading, data } = useQuery(['getAllError', [maxTime, minTime]], {
|
||||||
queryFn: () =>
|
queryFn: () =>
|
||||||
getAll({
|
getAll({
|
||||||
@ -24,6 +27,14 @@ function AllErrors(): JSX.Element {
|
|||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (data?.error) {
|
||||||
|
notification.error({
|
||||||
|
message: data.error || t('something_went_wrong'),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}, [data?.error, data?.payload, t]);
|
||||||
|
|
||||||
const getDateValue = (value: string): JSX.Element => {
|
const getDateValue = (value: string): JSX.Element => {
|
||||||
return (
|
return (
|
||||||
<Typography>{dayjs(value).format('DD/MM/YYYY HH:mm:ss A')}</Typography>
|
<Typography>{dayjs(value).format('DD/MM/YYYY HH:mm:ss A')}</Typography>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user