Skip to content

Commit

Permalink
Explicit paging for list of harvestables
Browse files Browse the repository at this point in the history
Fixes UIHAADM-142.
  • Loading branch information
MikeTaylor committed Dec 17, 2024
1 parent db6ec11 commit 75456fb
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Change history for ui-harvester-admin

## [2.3.0](https://github.com/folio-org/ui-harvester-admin/tree/v2.3.0) (IN PROGRESS)

* Explicit paging for list of failed records. Fixes UIHAADM-141.
* Explicit paging for list of harvestables. Fixes UIHAADM-142.

## [2.2.0](https://github.com/folio-org/ui-harvester-admin/tree/v2.2.0) (2024-10-23)

* Failed-record error messages should use detailed "message", when present, instead of label. Fixes UIHAADM-125.
Expand All @@ -12,7 +17,6 @@
* Update permission names to encompass logfile-deletion threshold. Fixes UIHAADM-135.
* Set up internationalization for permission names. Fixes UIHAADM-138.
* Add Settings page for log-file time-deletion threshold. Fixes UIHAADM-136.
* Explicit paging for list of failed records. Fixes UIHAADM-141.

## [2.1.0](https://github.com/folio-org/ui-harvester-admin/tree/v2.1.0) (2024-02-28)

Expand Down
13 changes: 12 additions & 1 deletion src/routes/HarvestablesRoute.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,14 @@ function HarvestablesRoute({ stripes, resources, mutator, children }) {
source.update({ resources, mutator }, 'reportTitles');
}

const handleNeedMoreData = () => source.fetchMore(RESULT_COUNT_INCREMENT);
const handleNeedMoreData = (_askAmount, index) => {
if (index >= 0) {
source.fetchOffset(index);
} else {
source.fetchMore(RESULT_COUNT_INCREMENT);
}
};


const error = resources.harvestables.failed ? resources.harvestables.failed.message : undefined;
const hasLoaded = resources.harvestables.hasLoaded;
Expand All @@ -44,13 +51,17 @@ function HarvestablesRoute({ stripes, resources, mutator, children }) {
HarvestablesRoute.manifest = Object.freeze({
query: { initialValue: {} },
resultCount: { initialValue: INITIAL_RESULT_COUNT },
resultOffset: { initialValue: 0 },
harvestables: {
type: 'okapi',
path: 'harvester-admin/harvestables',
throwErrors: false,
records: 'harvestables',
recordsRequired: '%{resultCount}',
resultOffset: '%{resultOffset}',
perRequest: RESULT_COUNT_INCREMENT,
resultDensity: 'sparse',
accumulate: 'true',
params: {
query: (qp) => {
const conditions = [];
Expand Down
4 changes: 2 additions & 2 deletions src/views/Harvestables/Harvestables.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import PropTypes from 'prop-types';
import { useIntl, FormattedMessage } from 'react-intl';
import { useLocation } from 'react-router-dom';
import { useStripes, IfPermission, AppIcon } from '@folio/stripes/core';
import { LoadingPane, Paneset, Pane, MultiColumnList, PaneMenu, MenuSection, Button, Icon } from '@folio/stripes/components';
import { LoadingPane, Paneset, Pane, MultiColumnList, PaneMenu, MenuSection, Button, Icon, MCLPagingTypes } from '@folio/stripes/components';
import { parseFilters, ColumnManager, SearchAndSortQuery } from '@folio/stripes/smart-components';
import { message2stats, summarizeStats } from '../../util/message2stats';
import viewLogTranslationTag from '../../util/viewLogTranslationTag';
Expand Down Expand Up @@ -195,7 +195,6 @@ function Harvestables({
<MultiColumnList
autosize
id="list-harvestables"
virtualize
visibleColumns={visibleColumns}
columnMapping={columnMapping}
columnWidths={{
Expand All @@ -215,6 +214,7 @@ function Harvestables({
sortedColumn={sortedColumn}
sortDirection={sortDirection}
onNeedMoreData={onNeedMoreData}
pagingType={MCLPagingTypes.PREV_NEXT}
onRowClick={(event, rec) => updateQuery({ _path: `${packageInfo.stripes.route}/harvestables/${rec.id}` })}
/>
</Pane>
Expand Down

0 comments on commit 75456fb

Please sign in to comment.