2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-07-03 04:00:57 +00:00

[Bug] Report fix (#9887)

* Improved mechanisms for data output

- Log errors against output
- Properly catch rendering errors

* Updated error handling

* Fix "render_date" tag

* Update default report template

- Make sure the helper is used

* Bug fixes
This commit is contained in:
Oliver
2025-06-28 08:23:12 +10:00
committed by GitHub
parent b3feebb53b
commit ff6d4bfb8f
10 changed files with 114 additions and 58 deletions

View File

@ -3,7 +3,7 @@ import { apiUrl } from '@lib/functions/Api';
import { t } from '@lingui/core/macro';
import { useDocumentVisibility } from '@mantine/hooks';
import { notifications, showNotification } from '@mantine/notifications';
import { IconCircleCheck } from '@tabler/icons-react';
import { IconCircleCheck, IconExclamationCircle } from '@tabler/icons-react';
import { useQuery } from '@tanstack/react-query';
import { useEffect, useState } from 'react';
import { ProgressBar } from '../components/items/ProgressBar';
@ -50,7 +50,22 @@ export default function useDataOutput({
.then((response) => {
const data = response?.data ?? {};
if (data.complete) {
if (!!data.errors || !!data.error) {
setLoading(false);
const error: string =
data?.error ?? data?.errors?.error ?? t`Process failed`;
notifications.update({
id: `data-output-${id}`,
loading: false,
icon: <IconExclamationCircle />,
autoClose: 2500,
title: title,
message: error,
color: 'red'
});
} else if (data.complete) {
setLoading(false);
notifications.update({
id: `data-output-${id}`,
@ -66,16 +81,6 @@ export default function useDataOutput({
const url = generateUrl(data.output);
window.open(url.toString(), '_blank');
}
} else if (!!data.error) {
setLoading(false);
notifications.update({
id: `data-output-${id}`,
loading: false,
autoClose: 2500,
title: title,
message: t`Process failed`,
color: 'red'
});
} else {
notifications.update({
id: `data-output-${id}`,