Skip to content

Commit

Permalink
UIPQB-57 400 error should be reported in the UI
Browse files Browse the repository at this point in the history
  • Loading branch information
vashjs committed Oct 10, 2023
1 parent 252a6eb commit 28fa080
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
Loading,
Row,
} from '@folio/stripes/components';

import { useShowCallout } from '@folio/stripes-acq-components';
import { useQueryClient } from '@tanstack/react-query';
import css from './QueryBuilderModal.css';
import { RepeatableFields } from './RepeatableFields/RepeatableFields';
Expand Down Expand Up @@ -42,6 +42,7 @@ export const QueryBuilderModal = ({
}) => {
const intl = useIntl();
const queryClient = useQueryClient();
const showCallout = useShowCallout();

const { entityType } = useEntityType({ entityTypeDataSource });

Expand Down Expand Up @@ -76,6 +77,13 @@ export const QueryBuilderModal = ({
onQueryTestSuccess: () => {
setIsQueryRetrieved(false);
},
onQueryTestFail: () => {
showCallout({
message: <FormattedMessage id="ui-plugin-query-builder.error.sww" />,
type: 'error',
});
setIsQueryRetrieved(false);
},
});

const { runQuery, isRunQueryLoading } = useRunQuery({
Expand Down
4 changes: 3 additions & 1 deletion translations/ui-plugin-query-builder/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,7 @@

"viewer.retrieving": "Retrieving...",
"result.inProgress": "Query in progress",
"result.emptyMessage": "The list contains no items"
"result.emptyMessage": "The list contains no items",

"error.sww": "Something went wrong"
}

0 comments on commit 28fa080

Please sign in to comment.