From 01c09741c02986bbf0aa92dd776b52de0fbb7d79 Mon Sep 17 00:00:00 2001 From: Mike Taylor Date: Thu, 21 Nov 2024 18:21:37 +0000 Subject: [PATCH 1/4] Show all patron notice print jobs, in correct order (#2806) We now show the top 100 patron notice print jobs, not 10. More importantly, they are now sorted correctly (reverse chronological) on the server side, so even if the list grows past 100 and so is truncated in the UI at the first hundred, they will be the _right_ (most recent) first hundred. Fixes UIU-3269. --- CHANGELOG.md | 1 + src/routes/PatronNoticePrintJobsContainer.js | 4 ++-- src/views/PatronNoticePrintJobs/PatronNoticePrintJobs.js | 3 +-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c28266d25..4e3cb37c8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ * Review and cleanup Module Descriptors for ui-users. Refs UIU-3214. * Change users interface to "16.3". Refs UIU-3275. +* Show all patron notice print jobs (not just ten random ones), in correct order. Fixes UIU-3269. ## [11.0.3](https://github.com/folio-org/ui-users/tree/v11.0.3) (2024-11-14) [Full Changelog](https://github.com/folio-org/ui-users/compare/v11.0.2...v11.0.3) diff --git a/src/routes/PatronNoticePrintJobsContainer.js b/src/routes/PatronNoticePrintJobsContainer.js index dd9250af6..6abdffbcc 100644 --- a/src/routes/PatronNoticePrintJobsContainer.js +++ b/src/routes/PatronNoticePrintJobsContainer.js @@ -35,8 +35,8 @@ PatronNoticePrintJobsContainer.manifest = { type: 'okapi', path: 'print/entries', params: { - query: 'type="BATCH"', - sortby: 'created/sort.descending' + query: 'type="BATCH" sortby created/sort.descending', + limit: '100', }, records: 'items', throwErrors: false, diff --git a/src/views/PatronNoticePrintJobs/PatronNoticePrintJobs.js b/src/views/PatronNoticePrintJobs/PatronNoticePrintJobs.js index 9119c2f23..2695c0531 100644 --- a/src/views/PatronNoticePrintJobs/PatronNoticePrintJobs.js +++ b/src/views/PatronNoticePrintJobs/PatronNoticePrintJobs.js @@ -1,5 +1,4 @@ -import { orderBy } from 'lodash'; import { Button, Pane, MenuSection, MultiColumnList, Checkbox, FormattedDate, FormattedTime, TextLink } from '@folio/stripes/components'; import { useEffect, useState } from 'react'; import PropTypes from 'prop-types'; @@ -72,7 +71,7 @@ const PatronNoticePrintJobs = (props) => { useEffect(() => { const updatedRecords = - orderBy(records, (item) => item.created, sortOrder === DESC ? 'desc' : 'asc') + records .map(record => ({ ...record, selected: !!record.selected, From 547239cdeb3154121ed2e4c82335d346d0b4f99b Mon Sep 17 00:00:00 2001 From: Priyanka Terala <104053200+Terala-Priyanka@users.noreply.github.com> Date: Tue, 26 Nov 2024 19:42:37 +0530 Subject: [PATCH 2/4] UIU-3249 - Leverage API supported sorting of columns on pre-registrations records list. (#2808) --- CHANGELOG.md | 5 ++ .../PatronsPreRegistrationList.js | 51 +++++-------------- .../PatronsPreRegistrationList.test.js | 2 + .../PatronsPreRegistrationListContainer.js | 4 ++ 4 files changed, 24 insertions(+), 38 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4e3cb37c8..785837ff8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Change history for ui-users +## [11.1.0] In progress +* Update permissions for mod-patron. Ref UIU-3259 + +* Leverage API supported sorting of columns on pre-registrations records list. Refs UIU-3249. + ## [11.0.5](https://github.com/folio-org/ui-users/tree/v11.0.5) (2024-11-20) [Full Changelog](https://github.com/folio-org/ui-users/compare/v11.0.3...v11.0.5) diff --git a/src/views/PatronsPreRegistrationListContainer/PatronsPreRegistrationList.js b/src/views/PatronsPreRegistrationListContainer/PatronsPreRegistrationList.js index 09a85568b..22a60e883 100644 --- a/src/views/PatronsPreRegistrationListContainer/PatronsPreRegistrationList.js +++ b/src/views/PatronsPreRegistrationListContainer/PatronsPreRegistrationList.js @@ -1,6 +1,5 @@ -import { useState, useEffect } from 'react'; import PropTypes from 'prop-types'; -import { get, orderBy } from 'lodash'; +import { get } from 'lodash'; import { useIntl, FormattedMessage, @@ -18,34 +17,22 @@ import { COLUMNS_NAME, } from './constants'; import { useNewRecordHandler } from './hooks'; -import { sortTypes } from '../../constants'; const PatronsPreRegistrationList = ({ data, isEmptyMessage, totalCount, - onNeedMoreData + onNeedMoreData, + onSort, + sortOrder, }) => { const intl = useIntl(); - const sortInitialState = { - data: [], - order: '', - direction: sortTypes.ASC, - }; - const [sortedRecordsDetails, setSortedRecordsDetails] = useState(sortInitialState); const { handle, isLoading, } = useNewRecordHandler(); - useEffect(() => { - setSortedRecordsDetails(prev => ({ - ...prev, - data: orderBy(data, prev.order, prev.direction) - })); - }, [data]); - const renderActionColumn = (user) => (