From 1f57802fdbe4640386f8e636fdd476c90fd12953 Mon Sep 17 00:00:00 2001 From: Yury Saukou Date: Wed, 17 Apr 2024 09:37:34 +0300 Subject: [PATCH 1/2] UIORGS-193 Add additional filters to support reporting requirements --- CHANGELOG.md | 1 + .../hooks/useOrganizations/useOrganizations.js | 10 +++++++++- translations/ui-organizations/en.json | 4 ++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4cf2a2cf..4825c5b3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ## 5.2.0 (IN PROGRESS) * UX Consistency: HTML Page Title display when the third pane (detail record) displays. Refs UIORGS-423. +* Add additional filters to support reporting requirements. Refs UIORG-193. ## [5.1.0](https://github.com/folio-org/ui-organizations/tree/v5.1.0) (2024-03-19) [Full Changelog](https://github.com/folio-org/ui-organizations/compare/v5.0.0...v5.1.0) diff --git a/src/Organizations/OrganizationsList/hooks/useOrganizations/useOrganizations.js b/src/Organizations/OrganizationsList/hooks/useOrganizations/useOrganizations.js index dd7e7e3e..01c17bdf 100644 --- a/src/Organizations/OrganizationsList/hooks/useOrganizations/useOrganizations.js +++ b/src/Organizations/OrganizationsList/hooks/useOrganizations/useOrganizations.js @@ -1,3 +1,4 @@ +import moment from 'moment'; import { useQuery } from 'react-query'; import { useLocation } from 'react-router'; import queryString from 'query-string'; @@ -5,6 +6,7 @@ import queryString from 'query-string'; import { useNamespace, useOkapiKy, + useStripes, } from '@folio/stripes/core'; import { getFiltersCount, @@ -19,14 +21,20 @@ export const useOrganizations = ({ options = {}, }) => { const ky = useOkapiKy(); + const stripes = useStripes(); const [namespace] = useNamespace({ key: 'organizations-list' }); const { search } = useLocation(); const buildQuery = useBuildQuery(); const queryParams = queryString.parse(search); - const query = buildQuery(queryParams); const filtersCount = getFiltersCount(queryParams); + moment.tz.setDefault(stripes.timezone); + + const query = buildQuery(queryParams); + + moment.tz.setDefault(); + const defaultSearchParams = { query, limit: pagination.limit, diff --git a/translations/ui-organizations/en.json b/translations/ui-organizations/en.json index 2becc231..7a8bc1cc 100644 --- a/translations/ui-organizations/en.json +++ b/translations/ui-organizations/en.json @@ -43,6 +43,9 @@ "filterConfig.addressCategory": "Address category", "filterConfig.contactPeopleCategory": "Contact people category", "filterConfig.country": "Country", + "filterConfig.createdBy": "Created by", + "filterConfig.dateCreated": "Date created", + "filterConfig.dateUpdated": "Date updated", "filterConfig.isVendor": "Is vendor", "filterConfig.isDonor": "Is donor", "filterConfig.languages": "Languages", @@ -52,6 +55,7 @@ "filterConfig.boolean.true": "Yes", "filterConfig.boolean.false": "No", "filterConfig.types": "Types", + "filterConfig.updatedBy": "Updated by", "search.keyword": "All", "search.name": "Name", From f6089c0ceb19f826737e774e36848c7546d48804 Mon Sep 17 00:00:00 2001 From: Yury Saukou Date: Wed, 17 Apr 2024 09:48:51 +0300 Subject: [PATCH 2/2] update test --- package.json | 1 + .../hooks/useOrganizations/useOrganizations.test.js | 1 + 2 files changed, 2 insertions(+) diff --git a/package.json b/package.json index 90d5a2e8..aeeca79f 100644 --- a/package.json +++ b/package.json @@ -354,6 +354,7 @@ "@folio/plugin-find-organization": "^5.0.0", "@folio/stripes-acq-components": "~5.1.0", "lodash": "^4.17.5", + "moment": "^2.24.0", "moment-timezone": "^0.5.20", "prop-types": "^15.5.10", "query-string": "^6.1.0", diff --git a/src/Organizations/OrganizationsList/hooks/useOrganizations/useOrganizations.test.js b/src/Organizations/OrganizationsList/hooks/useOrganizations/useOrganizations.test.js index 6814d4ba..0274d47e 100644 --- a/src/Organizations/OrganizationsList/hooks/useOrganizations/useOrganizations.test.js +++ b/src/Organizations/OrganizationsList/hooks/useOrganizations/useOrganizations.test.js @@ -15,6 +15,7 @@ jest.mock('@folio/stripes/core', () => ({ ...jest.requireActual('@folio/stripes/core'), useNamespace: () => ['namespace'], useOkapiKy: jest.fn(), + useStripes: jest.fn(() => ({})), })); const organizations = [organization];