Skip to content

Commit

Permalink
Explicitly specify paging size for Harvestables, Jobs and Failed Records
Browse files Browse the repository at this point in the history
Fixes UIHAADM-145.
  • Loading branch information
MikeTaylor authored Jan 8, 2025
1 parent 5b7f79c commit a9c91dc
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 19 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
* Explicit paging for list of harvestables. Fixes UIHAADM-142.
* When downloading Failed Records, provide all records in the result set, not just the currently visible page. Fixes UIHAADM-140.
* When running in development (`yarn start`) use the Stripes CLI's `--startProxy` argument. Fixes UIHAADM-144.
* Explicitly specify paging size for Harvestables, Jobs and Failed Records. Fixes UIHAADM-145.

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

Expand Down
11 changes: 4 additions & 7 deletions src/routes/HarvestablesRoute.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import { StripesConnectedSource } from '@folio/stripes/smart-components';
import Harvestables from '../views/Harvestables';


const INITIAL_RESULT_COUNT = 500;
const RESULT_COUNT_INCREMENT = 500;
const INITIAL_RESULT_COUNT = 100;
const RESULT_COUNT_INCREMENT = 100;


function HarvestablesRoute({ stripes, resources, mutator, children }) {
Expand All @@ -19,11 +19,7 @@ function HarvestablesRoute({ stripes, resources, mutator, children }) {
}

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


Expand All @@ -40,6 +36,7 @@ function HarvestablesRoute({ stripes, resources, mutator, children }) {
updateQuery={mutator.query.update}
error={error}
hasLoaded={hasLoaded}
pageAmount={RESULT_COUNT_INCREMENT}
onNeedMoreData={handleNeedMoreData}
>
{children}
Expand Down
11 changes: 4 additions & 7 deletions src/routes/JobsRoute.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import queryFunction from '../search/queryFunction';
import Jobs from '../views/Jobs';


const INITIAL_RESULT_COUNT = 200;
const RESULT_COUNT_INCREMENT = 200;
const INITIAL_RESULT_COUNT = 100;
const RESULT_COUNT_INCREMENT = 100;


function JobsRoute({ stripes, resources, mutator, children }) {
Expand All @@ -21,11 +21,7 @@ function JobsRoute({ stripes, resources, mutator, children }) {
}

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

const error = resources.jobs.failed ? resources.jobs.failed.message : undefined;
Expand All @@ -41,6 +37,7 @@ function JobsRoute({ stripes, resources, mutator, children }) {
updateQuery={mutator.query.update}
error={error}
hasLoaded={hasLoaded}
pageAmount={RESULT_COUNT_INCREMENT}
onNeedMoreData={handleNeedMoreData}
>
{children}
Expand Down
7 changes: 2 additions & 5 deletions src/routes/RecordsRoute.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,7 @@ const RecordsRoute = ({ stripes, resources, mutator, children }) => {
}

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

const hasLoaded = resources.records.hasLoaded;
Expand All @@ -40,6 +36,7 @@ const RecordsRoute = ({ stripes, resources, mutator, children }) => {
updateQuery={mutator.query.update}
hasLoaded={hasLoaded}
error={error}
pageAmount={RESULT_COUNT_INCREMENT}
onNeedMoreData={handleNeedMoreData}
>
{children}
Expand Down
3 changes: 3 additions & 0 deletions src/views/Harvestables/Harvestables.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ function Harvestables({
updateQuery,
error,
hasLoaded,
pageAmount,
onNeedMoreData,
children,
}) {
Expand Down Expand Up @@ -213,6 +214,7 @@ function Harvestables({
onHeaderClick={sasqParams.onSort}
sortedColumn={sortedColumn}
sortDirection={sortDirection}
pageAmount={pageAmount}
onNeedMoreData={onNeedMoreData}
pagingType={MCLPagingTypes.PREV_NEXT}
onRowClick={(event, rec) => updateQuery({ _path: `${packageInfo.stripes.route}/harvestables/${rec.id}` })}
Expand Down Expand Up @@ -242,6 +244,7 @@ Harvestables.propTypes = {
updateQuery:PropTypes.func.isRequired,
error: PropTypes.string,
hasLoaded: PropTypes.bool.isRequired,
pageAmount: PropTypes.number.isRequired,
onNeedMoreData: PropTypes.func.isRequired,
children: PropTypes.arrayOf(PropTypes.object.isRequired).isRequired,
};
Expand Down
3 changes: 3 additions & 0 deletions src/views/Jobs/Jobs.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ function Jobs({
updateQuery,
error,
hasLoaded,
pageAmount,
onNeedMoreData,
children,
}) {
Expand Down Expand Up @@ -110,6 +111,7 @@ function Jobs({
totalCount={resultCount}
onHeaderClick={sasqParams.onSort}
nonInteractiveHeaders={['seconds']}
pageAmount={pageAmount}
onNeedMoreData={onNeedMoreData}
sortedColumn={sortedColumn}
sortDirection={sortDirection}
Expand Down Expand Up @@ -146,6 +148,7 @@ Jobs.propTypes = {
updateQuery:PropTypes.func.isRequired,
error: PropTypes.string,
hasLoaded: PropTypes.bool.isRequired,
pageAmount: PropTypes.number.isRequired,
onNeedMoreData: PropTypes.func.isRequired,
children: PropTypes.oneOfType([
PropTypes.object.isRequired,
Expand Down
3 changes: 3 additions & 0 deletions src/views/Records/Records.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ function Records({
updateQuery,
error,
hasLoaded,
pageAmount,
onNeedMoreData,
children,
}) {
Expand Down Expand Up @@ -139,6 +140,7 @@ function Records({
totalCount={resultCount}
onHeaderClick={sasqParams.onSort}
nonInteractiveHeaders={['instanceHrid', 'instanceTitle', 'errors']}
pageAmount={pageAmount}
onNeedMoreData={onNeedMoreData}
sortedColumn={sortedColumn}
sortDirection={sortDirection}
Expand Down Expand Up @@ -181,6 +183,7 @@ Records.propTypes = {
updateQuery:PropTypes.func.isRequired,
error: PropTypes.string,
hasLoaded: PropTypes.bool.isRequired,
pageAmount: PropTypes.number.isRequired,
onNeedMoreData: PropTypes.func.isRequired,
children: PropTypes.oneOfType([
PropTypes.object.isRequired,
Expand Down

0 comments on commit a9c91dc

Please sign in to comment.