Skip to content

Commit

Permalink
Merge pull request #1322 from folio-org/release_11.0.2
Browse files Browse the repository at this point in the history
Release 11.0.2
  • Loading branch information
EthanFreestone authored May 28, 2024
2 parents 9531227 + 3bf13ca commit 7372a6c
Show file tree
Hide file tree
Showing 19 changed files with 436 additions and 237 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/build-npm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@


name: buildNPM Snapshot
on: [push, pull_request]

on:
pull_request:
push:
branches: [master]
jobs:
github-actions-ci:
env:
Expand Down
19 changes: 19 additions & 0 deletions .github/workflows/stuck-license-cla.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: stuckLicenseCLA
on:
pull_request:
types: [opened]

## Adapted from github discussion comment https://github.com/orgs/community/discussions/69944#discussioncomment-7281028
jobs:
github-actions-ci:
runs-on: ubuntu-latest
steps:
- name: Create License CLA comment
run: |
# Use GitHub API to create a comment on the PR
PR_NUMBER=${{ github.event.pull_request.number }}
COMMENT="[License CLA Stuck?](https://cla-assistant.io/check/${{ github.repository }}?pullRequest=${PR_NUMBER}) (Developer should make sure that it is really stuck before clicking)"
GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}
COMMENT_URL="https://api.github.com/repos/${{ github.repository }}/issues/${PR_NUMBER}/comments"
curl -s -H "Authorization: token ${GITHUB_TOKEN}" -X POST $COMMENT_URL -d "{\"body\":\"$COMMENT\"}"
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Change history for ui-agreements

## 11.0.2 2024-05-28
* ERM-3248 Use static endpoints for /resources and /entitlementOptions in Poppy Compatible release
* ERM-3246 Improve performance of entitlementOptions endpoint
* ERM-3239 Query all titles rather than just /electronic in local KB title search
* ERM-3220 Update pagination mechanisms for MCLs to work without stats
* ERM-3186 Change default search options for Local KB titles to exclude identifiers

## 11.0.1 2024-04-19
* Change default search options for Local KB titles to exclude identifiers
* ERM-3182 Scrolling content in license view pane can overlap header (Also impacted agreements)
Expand Down
Binary file added icons/printTitle.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions icons/printTitle.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 6 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@folio/agreements",
"version": "11.0.1",
"version": "11.0.2",
"description": "ERM agreement functionality for Stripes",
"main": "src/index.js",
"publishConfig": {
Expand Down Expand Up @@ -338,6 +338,11 @@
"name": "platform",
"alt": " ",
"title": "platform"
},
{
"name": "printTitle",
"alt": " ",
"title": "Print title"
}
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,21 +26,24 @@ import { AppIcon, useCallout } from '@folio/stripes/core';
import {
getResourceIdentifier,
TitleOnPlatformLink,
usePrevNextPagination
usePrevNextPagination,
useFetchMultiplePages,
} from '@folio/stripes-erm-components';

import { useAgreementsSettings } from '../../../hooks';
import Coverage from '../../Coverage';
import CustomCoverageIcon from '../../CustomCoverageIcon';
import IfEResourcesEnabled from '../../IfEResourcesEnabled';
import { resultCount, COVERED_ERESOURCES_PAGINATION_ID } from '../../../constants';
import {
resultCount,
COVERED_ERESOURCES_PAGINATION_ID,
AGREEMENT_ERESOURCES_ENDPOINT_STATIC,
} from '../../../constants';
import { urls, parseMclPageSize } from '../../utilities';


const propTypes = {
agreement: PropTypes.shape({
eresources: PropTypes.arrayOf(PropTypes.object),
eresourcesCount: PropTypes.number,
id: PropTypes.string,
lines: PropTypes.arrayOf(PropTypes.object),
}).isRequired,
eresourcesFilterPath: PropTypes.string,
Expand All @@ -50,52 +53,79 @@ const propTypes = {
};

const CoveredEResourcesList = ({
agreement: { eresources, eresourcesCount, lines },
agreement: { id, lines },
eresourcesFilterPath,
onFilterEResources,
onExportEResourcesAsJSON,
onExportEResourcesAsKBART,
}) => {
const settings = useAgreementsSettings();
const coveredEresourcePageSize = parseMclPageSize(settings, 'agreementEresources');
const coveredEresourcePageSize = parseMclPageSize(
settings,
'agreementEresources'
);

const coveredEresourcesPaginationId = `${COVERED_ERESOURCES_PAGINATION_ID}.${eresourcesFilterPath}-${id}`;

const { currentPage } = usePrevNextPagination({
pageSize: coveredEresourcePageSize, // Only needed for reading back MCL props
id: coveredEresourcesPaginationId,
syncToLocation: false,
});

// AGREEMENT ERESOURCES PER PAGE FETCH WITHOUT STATS / FETCH CURRENT AND NEXT PAGE
const {
paginationMCLProps,
} = usePrevNextPagination({
count: eresourcesCount,
[currentPage]: { data: agreementEresources = [], isLoading: areEresourcesLoading } = {},
[currentPage + 1]: { data: nextPageEresources = [], isLoading: isNextPageLoading } = {},

Check warning on line 79 in src/components/AgreementSections/CoveredEResourcesList/CoveredEResourcesList.js

View workflow job for this annotation

GitHub Actions / github-actions-ci

'isNextPageLoading' is assigned a value but never used. Allowed unused vars must match /(React|^_)/u
} = useFetchMultiplePages({
getQueryKey: ({ params, pageNum, pathStr }) => ['ERM', 'Agremeent', id, 'getEresources', pageNum, params, pathStr],
params: {
sort: [{ path: 'pti.titleInstance.name' }],
page: currentPage,
perPage: coveredEresourcePageSize,
stats: false,
},
path: AGREEMENT_ERESOURCES_ENDPOINT_STATIC(id, eresourcesFilterPath),
});

const hasNextEresourcesPage = nextPageEresources?.length > 0;

const { paginationMCLProps } = usePrevNextPagination({
hasNextPage: hasNextEresourcesPage,
pageSize: coveredEresourcePageSize,
id: COVERED_ERESOURCES_PAGINATION_ID,
syncToLocation: false
id: coveredEresourcesPaginationId,
syncToLocation: false,
});

const callout = useCallout();
const exportDisabled = eresourcesFilterPath === 'dropped' || eresourcesFilterPath === 'future';
const exportDisabled =
eresourcesFilterPath === 'dropped' || eresourcesFilterPath === 'future';

const exports = (exportCallback) => {
const calloutId = callout.sendCallout({
message: <FormattedMessage id="ui-agreements.eresourcesCovered.preparingExport" />,
message: (
<FormattedMessage id="ui-agreements.eresourcesCovered.preparingExport" />
),
timeout: 0,
});

exportCallback().then(() => callout.removeCallout(calloutId));
};

const renderDate = date => (
date ? <FormattedUTCDate value={date} /> : ''
);
const renderDate = (date) => (date ? <FormattedUTCDate value={date} /> : '');

const renderExportDropdown = (disabled) => (
<Dropdown
buttonProps={{
'data-test-export-button': true,
'disabled': disabled,
'marginBottom0': true,
disabled,
marginBottom0: true,
}}
label={<FormattedMessage id="ui-agreements.eresourcesCovered.exportAs" />}
>
<DropdownMenu role="menu">
<FormattedMessage id="ui-agreements.eresourcesCovered.exportAsJSON">
{exportAsJson => (
{(exportAsJson) => (
<Button
aria-label={exportAsJson}
buttonStyle="dropdownItem"
Expand All @@ -108,7 +138,7 @@ const CoveredEResourcesList = ({
)}
</FormattedMessage>
<FormattedMessage id="ui-agreements.eresourcesCovered.exportAsJSON">
{exportAsKbart => (
{(exportAsKbart) => (
<Button
aria-label={exportAsKbart}
buttonStyle="dropdownItem"
Expand Down Expand Up @@ -156,18 +186,22 @@ const CoveredEResourcesList = ({
package: <FormattedMessage id="ui-agreements.eresources.package" />,
coverage: <FormattedMessage id="ui-agreements.eresources.coverage" />,
isCustomCoverage: ' ',
accessStart: <FormattedMessage id="ui-agreements.eresources.accessStart" />,
accessEnd: <FormattedMessage id="ui-agreements.eresources.accessEnd" />,
accessStart: (
<FormattedMessage id="ui-agreements.eresources.accessStart" />
),
accessEnd: (
<FormattedMessage id="ui-agreements.eresources.accessEnd" />
),
}}
columnWidths={{
name: 250,
platform: 150,
package: 150,
coverage: { min: 250, max: 320 },
}}
contentData={eresources}
contentData={agreementEresources}
formatter={{
name: e => {
name: (e) => {
const titleInstanceName = e?._object?.pti?.titleInstance?.name;
return (
<AppIcon
Expand All @@ -180,11 +214,15 @@ const CoveredEResourcesList = ({
</AppIcon>
);
},
issn: e => {
issn: (e) => {
const titleInstance = get(e._object, 'pti.titleInstance', {});
return getResourceIdentifier(titleInstance, 'issn') || getResourceIdentifier(titleInstance, 'eissn') || getResourceIdentifier(titleInstance, 'pissn');
return (
getResourceIdentifier(titleInstance, 'issn') ||
getResourceIdentifier(titleInstance, 'eissn') ||
getResourceIdentifier(titleInstance, 'pissn')
);
},
platform: e => {
platform: (e) => {
const pti = e?._object?.pti ?? {};
const { name, platform, url } = pti;

Expand All @@ -197,28 +235,32 @@ const CoveredEResourcesList = ({
/>
);
},
package: e => e?._object?.pkg?.name ?? <NoValue />,
coverage: e => <Coverage eResource={e} />,
accessStart: e => renderDate(e._object?.accessStart),
accessEnd: e => renderDate(e._object?.accessEnd),
isCustomCoverage: line => {
package: (e) => e?._object?.pkg?.name ?? <NoValue />,
coverage: (e) => <Coverage eResource={e} />,
accessStart: (e) => renderDate(e._object?.accessStart),
accessEnd: (e) => renderDate(e._object?.accessEnd),
isCustomCoverage: (line) => {
if (!line.customCoverage) return '';
return (
<Tooltip
id={`covered-eresources-cc-tooltip-${line.rowIndex}`}
text={<FormattedMessage id="ui-agreements.customcoverages.tooltip" />}
>
{({ ref, ariaIds }) => <CustomCoverageIcon ref={ref} aria-labelledby={ariaIds.text} />
text={
<FormattedMessage id="ui-agreements.customcoverages.tooltip" />
}
>
{({ ref, ariaIds }) => (
<CustomCoverageIcon
ref={ref}
aria-labelledby={ariaIds.text}
/>
)}
</Tooltip>
);
},
}}
id="eresources-covered"
interactive={false}
pageAmount={resultCount.RESULT_COUNT_INCREMENT}
pagingType="click"
totalCount={eresourcesCount}
visibleColumns={[
'name',
'issn',
Expand Down Expand Up @@ -247,11 +289,13 @@ const CoveredEResourcesList = ({
</Col>
<Col md={3} xs={12}>
{renderExportDropdown(exportDisabled)}
{exportDisabled ?
{exportDisabled ? (
<Tooltip
id="covered-eresources-export-tooltip"
placement="top"
text={<FormattedMessage id="ui-agreements.eresourcesCovered.exportButton.tooltip" />}
text={
<FormattedMessage id="ui-agreements.eresourcesCovered.exportButton.tooltip" />
}
>
{({ ref, ariaIds }) => (
<Icon
Expand All @@ -261,12 +305,13 @@ const CoveredEResourcesList = ({
tabIndex="0"
/>
)}
</Tooltip> :
</Tooltip>
) : (
''
}
)}
</Col>
</Row>
{eresources ? renderList() : <Spinner />}
{!areEresourcesLoading ? renderList() : <Spinner />}
</IfEResourcesEnabled>
) : null;
};
Expand Down
6 changes: 4 additions & 2 deletions src/components/AgreementSections/LinesList/LinesList.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import {

const propTypes = {
agreement: PropTypes.shape({
id: PropTypes.string,
agreementLinesCount: PropTypes.number,
lines: PropTypes.arrayOf(PropTypes.object),
orderLines: PropTypes.arrayOf(PropTypes.object),
Expand All @@ -44,19 +45,20 @@ const columnMapping = {
};

const LinesList = ({
agreement: { agreementLinesCount, lines, orderLines },
agreement: { id: agreementId, agreementLinesCount, lines, orderLines },
onViewAgreementLine,
visibleColumns
}) => {
const settings = useAgreementsSettings();
const agreementLinesPageSize = parseMclPageSize(settings, 'agreementLines');
const agreementLinesPaginationId = `${AGREEMENT_LINES_PAGINATION_ID}-${agreementId}`;

const {
paginationMCLProps,
} = usePrevNextPagination({
count: agreementLinesCount,
pageSize: agreementLinesPageSize,
id: AGREEMENT_LINES_PAGINATION_ID,
id: agreementLinesPaginationId,
syncToLocation: false
});

Expand Down
Loading

0 comments on commit 7372a6c

Please sign in to comment.