Skip to content

Commit

Permalink
UIPQB-78: Query builder display if no records match the query
Browse files Browse the repository at this point in the history
  • Loading branch information
UladzislauKutarkin committed Feb 28, 2024
1 parent 0603af0 commit 390f26f
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 8 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
* [UIPQB-80](https://issues.folio.org/browse/UIPQB-80) Add operators for NumberType and adjust operators for IntegerType.
* [UIPQB-73](https://folio-org.atlassian.net/browse/UIPQB-73) Result Viewer shows current date if date column is not present.
* [UIPQB-82](https://folio-org.atlassian.net/browse/UIPQB-82) [Query Builder] Support querying based on nested objects within arrays.
* [UIPQB-78](https://folio-org.atlassian.net/browse/UIPQB-78) Query builder display if no records match the query

## [1.0.0](https://github.com/folio-org/ui-plugin-query-builder/tree/v1.0.0) (2023-10-12)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export const QueryBuilderModal = ({
getParamsSource,
recordsLimit,
additionalControls,
canRunEmptyQuery,
}) => {
const intl = useIntl();
const queryClient = useQueryClient();
Expand Down Expand Up @@ -160,11 +161,16 @@ export const QueryBuilderModal = ({
}
}, [source, isTestQueryInProgress]);

const isRunQueryDisabled = !isQueryRetrieved
|| !isQueryFilled
|| isRunQueryLoading
|| (!canRunEmptyQuery && entityType?.columns);

const renderFooter = () => (
<ModalFooter>
<Button
buttonStyle="primary"
disabled={!isQueryRetrieved || !isQueryFilled || isRunQueryLoading}
disabled={isRunQueryDisabled}
onClick={handleRun}
>
{getSaveBtnLabel()}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,20 @@ import css from '../../../QueryBuilder.css';
export const ViewerHeadline = memo(({ limit, total, isInProgress }) => {
return (
<>
<FormattedMessage
id="ui-plugin-query-builder.modal.preview.title"
values={{
total,
limit,
}}
/>
{Boolean(total) || Boolean(limit) ?
<FormattedMessage
id="ui-plugin-query-builder.modal.preview.title.empty"
values={{ total }}
/>
:
<FormattedMessage
id="ui-plugin-query-builder.modal.preview.title"
values={{
total,
limit,
}}
/>
}
{' '}
{isInProgress && (
<span className={css.AccordionHeaderLoading}>
Expand Down
1 change: 1 addition & 0 deletions translations/ui-plugin-query-builder/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"modal.query": "Query",
"modal.test": "Test query",
"modal.preview.title": "Query would return {total} records. Preview of first {limit} records.",
"modal.preview.title.empty": "Query would return {total} records.",
"modal.preview.queryInProgress": "Test query in progress",
"modal.preview.countingInProgress": "Counting in progress",
"modal.banner.limit": "Warning: this query returns more records than the maximum allowed. Modify the query to limit your results.",
Expand Down

0 comments on commit 390f26f

Please sign in to comment.