Skip to content

Commit

Permalink
UIPQB-57 400 error should be reported in the UI (#64)
Browse files Browse the repository at this point in the history
  • Loading branch information
vashjs authored Oct 13, 2023
1 parent 14902b1 commit b7303de
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,5 @@
* [UIPQB-48](https://issues.folio.org/browse/UIPQB-48) "Show columns" dropdown doesn't fit in the screen.
* [UIPQB-47](https://issues.folio.org/browse/UIPQB-47) 400 error blocks save or further action in query builder.
* [UIPQB-51](https://issues.folio.org/browse/UIPQB-51) Dropdown typeahead should use contains not starts with.
* [UIPQB-57](https://issues.folio.org/browse/UIPQB-57) 400 error should be reported in the UI
* [UIPQB-55](https://issues.folio.org/browse/UIPQB-55) Regular expressions are incorrect for contains and starts_with operators
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 b7303de

Please sign in to comment.