Skip to content

Commit

Permalink
Merge pull request #1318 from folio-org/release_10.1.0
Browse files Browse the repository at this point in the history
Release 10.1.0
  • Loading branch information
EthanFreestone authored May 26, 2024
2 parents b3150d4 + fa3f845 commit d3c7024
Show file tree
Hide file tree
Showing 17 changed files with 159 additions and 75 deletions.
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

## 10.1.0 2024-05-26
* 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-3200 Backport ERM-3186 to Poppy compatible release
* ERM-3186 Change default search options for Local KB titles to exclude identifiers

## 10.0.1 2023-11-09
* ERM-3082 Backport grouping and spaces fix for Poppy
* ERM-3065 Agreement lines are displayed by default on the "Agreement lines" pane.
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": "10.0.1",
"version": "10.1.0",
"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
90 changes: 61 additions & 29 deletions src/components/RelatedTitleInfo/RelatedTitleInfo.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
import React from 'react';
import PropTypes from 'prop-types';
import { FormattedMessage } from 'react-intl';
import { useHistory } from 'react-router-dom';
import { AppIcon } from '@folio/stripes/core';
import {
Col,
Headline,
InfoPopover,
KeyValue,
NoValue,
Row,
TextLink
} from '@folio/stripes/components';

import { resourceTypes } from '../../constants';
Expand Down Expand Up @@ -37,39 +41,67 @@ const propTypes = {
value: PropTypes.string,
}),
}).isRequired,
showLink: PropTypes.bool,
};

const RelatedTitleInfo = ({
relatedTitle
}) => (
<div data-test-related-titles>
<div className={css.separator} />
<Headline data-test-title-instance-name size="large" tag="h3">
<FormattedMessage id="ui-agreements.eresources.relatedTitle" values={{ name: relatedTitle.name }} />
</Headline>
<Row>
<Col xs={3}>
<KeyValue label={<FormattedMessage id="ui-agreements.eresources.materialType" />}>
<div data-test-title-instance-sub-type>{relatedTitle.subType?.label ?? <NoValue />}</div>
</KeyValue>
</Col>
{relatedTitle.type.value === resourceTypes.MONOGRAPH || relatedTitle.type.value === resourceTypes.BOOK ?
<>
<EResourceIdentifier titleInstance={relatedTitle} type="isbn" />
<EResourceIdentifier titleInstance={relatedTitle} type="doi" />
</>
:
<>
<EResourceIdentifier titleInstance={relatedTitle} type="ezb" />
<EResourceIdentifier titleInstance={relatedTitle} type="zdb" />
<EResourceIdentifier titleInstance={relatedTitle} type="eissn" />
<EResourceIdentifier titleInstance={relatedTitle} type="pissn" />
<EResourceIdentifier titleInstance={relatedTitle} type="issn" />
</>
relatedTitle,
showLink = false
}) => {
const { location: { search: searchString } } = useHistory();

const renderElectronicLink = () => {
const relatedTitleLink = `${relatedTitle.id}${searchString}`;
return (
<Row>
<Col xs={12}>
<AppIcon
app="agreements"
iconAlignment="baseline"
iconKey="title"
size="small"
>
<TextLink to={relatedTitleLink}><FormattedMessage id="ui-agreements.eresources.electronicTitle" values={{ name: relatedTitle.name }} /></TextLink>
<InfoPopover
content={<FormattedMessage id="ui-agreements.eresources.relatedTitle.infoPopover" />}
/>
</AppIcon>
</Col>
</Row>
);
};

return (
<div data-test-related-titles>
<div className={css.separator} />
<Headline data-test-title-instance-name size="large" tag="h3">
<FormattedMessage id="ui-agreements.eresources.relatedTitle" values={{ name: relatedTitle.name }} />
</Headline>
<Row>
<Col xs={3}>
<KeyValue label={<FormattedMessage id="ui-agreements.eresources.materialType" />}>
<div data-test-title-instance-sub-type>{relatedTitle.subType?.label ?? <NoValue />}</div>
</KeyValue>
</Col>
{relatedTitle.type.value === resourceTypes.MONOGRAPH || relatedTitle.type.value === resourceTypes.BOOK ?
<>
<EResourceIdentifier titleInstance={relatedTitle} type="isbn" />
<EResourceIdentifier titleInstance={relatedTitle} type="doi" />
</>
:
<>
<EResourceIdentifier titleInstance={relatedTitle} type="ezb" />
<EResourceIdentifier titleInstance={relatedTitle} type="zdb" />
<EResourceIdentifier titleInstance={relatedTitle} type="eissn" />
<EResourceIdentifier titleInstance={relatedTitle} type="pissn" />
<EResourceIdentifier titleInstance={relatedTitle} type="issn" />
</>
}
</Row>
</div>
);
</Row>
{showLink && renderElectronicLink()}
</div>
);
};

RelatedTitleInfo.propTypes = propTypes;
export default RelatedTitleInfo;
9 changes: 9 additions & 0 deletions src/components/RelatedTitleInfo/RelatedTitleInfo.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,15 @@ import translationsProperties from '../../../test/helpers';
import RelatedTitleInfo from './RelatedTitleInfo';
import { relatedMonographTitle, relatedSerialTitle } from './testResources';

jest.mock('react-router-dom', () => ({
...jest.requireActual('react-router-dom'),
useHistory: () => ({
location: {
search: ''
}
}),
}));

let renderComponent;
describe('RelatedTitleInfo', () => {
describe('with monograph resource', () => {
Expand Down
9 changes: 6 additions & 3 deletions src/components/TitleCard/TitleCardInfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ import RelatedTitleInfo from '../RelatedTitleInfo';

const propTypes = {
title: PropTypes.shape({
subType: PropTypes.shape({
value: PropTypes.string,
}),
type: PropTypes.oneOfType([
PropTypes.shape({ label: PropTypes.string }),
PropTypes.string,
Expand All @@ -27,13 +30,13 @@ const TitleCardInfo = ({ title }) => {
const type = (titleInstance?.type?.label ?? titleInstance?.type ?? '').toLowerCase();
return (
<>
{ type === resourceTypes.MONOGRAPH || type === resourceTypes.BOOK ?
{type === resourceTypes.MONOGRAPH || type === resourceTypes.BOOK ?
<MonographResourceInfo titleInstance={titleInstance} />
:
<SerialResourceInfo titleInstance={titleInstance} />
}
{ titleInstance?.relatedTitles?.map((relatedTitle, i) => (
<RelatedTitleInfo key={i} relatedTitle={relatedTitle} />
{titleInstance?.relatedTitles?.map((relatedTitle, i) => (
<RelatedTitleInfo key={i} relatedTitle={relatedTitle} showLink={title.subType?.value === 'print' && relatedTitle.subType?.value === 'electronic'} />
))
}
</>
Expand Down
21 changes: 13 additions & 8 deletions src/components/views/EResource/EResource.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ const EResource = ({
if (eresource.class === resourceClasses.TITLEINSTANCE) {
EResourceViewComponent = Title;
icon = 'title';
if (eresource.subType?.value === 'print') {
icon = 'printTitle';
}
} else if (eresource.class === resourceClasses.PCI) {
EResourceViewComponent = PCI;
icon = 'pci';
Expand All @@ -78,14 +81,16 @@ const EResource = ({
entity={eresource}
/>
}
<Button
buttonStyle="primary"
id="clickable-edit-eresource"
marginBottom0
onClick={handlers.onEdit}
>
<FormattedMessage id="stripes-components.button.edit" />
</Button>
{eresource.subType?.value !== 'print' &&
<Button
buttonStyle="primary"
id="clickable-edit-eresource"
marginBottom0
onClick={handlers.onEdit}
>
<FormattedMessage id="stripes-components.button.edit" />
</Button>
}
</PaneMenu>
</IfPermission>
) : null
Expand Down
18 changes: 11 additions & 7 deletions src/components/views/Title/Title.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,16 @@ export default class Title extends React.Component {
</Col>
</Row>
<AccordionSet initialStatus={this.getInitialAccordionsState()}>
<Agreements
{...this.getSectionProps('eresourceAgreements')}
isEmptyMessage={<FormattedMessage id="ui-agreements.emptyAccordion.noAgreementsEresource" />}
visibleColumns={['name', 'type', 'startDate', 'endDate', 'eresource', 'acqMethod', 'coverage', 'isCustomCoverage']}
/>
<AcquisitionOptions {...this.getSectionProps('acquisitionOptions')} />
{data.eresource.subType.value !== 'print' &&
<>
<Agreements
{...this.getSectionProps('eresourceAgreements')}
isEmptyMessage={<FormattedMessage id="ui-agreements.emptyAccordion.noAgreementsEresource" />}
visibleColumns={['name', 'type', 'startDate', 'endDate', 'eresource', 'acqMethod', 'coverage', 'isCustomCoverage']}
/>
<AcquisitionOptions {...this.getSectionProps('acquisitionOptions')} />
</>
}
<NotesSmartAccordion
{...this.getSectionProps('notes')}
domainName="agreements"
Expand All @@ -129,7 +133,7 @@ export default class Title extends React.Component {
pathToNoteDetails={urls.notes()}
/>
{
handlers.isSuppressFromDiscoveryEnabled('title') &&
handlers.isSuppressFromDiscoveryEnabled('title') && data.eresource.subType?.value !== 'print' &&
<DiscoverySettings
handlers={handlers}
id="discoverySettings"
Expand Down
29 changes: 18 additions & 11 deletions src/components/views/Titles/Titles.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import {

import {
getResourceIdentifier,
getSiblingIdentifier,
EResourceType,
useHandleSubmitSearch,
usePrevNextPagination,
Expand All @@ -36,6 +35,7 @@ import IdentifierReassignmentForm from '../../IdentifierReassignmentForm';

import { urls } from '../../utilities';
import {
defaultTitlesQIndex as defaultQIndex,
KB_TAB_FILTER_PANE,
KB_TAB_PANESET,
KB_TAB_PANE_ID,
Expand Down Expand Up @@ -89,10 +89,16 @@ const Titles = ({
pageSize: RESULT_COUNT_INCREMENT_MEDIUM
});

/*
* NOTE: This is not directly defaulting the qIndex,
* rather setting up the "default" for inclusion in qIndexSASQProps,
* which are passed to SASQ below. Then SASQ will be responsible for setting
* initial qIndex values in the url on mount.
*/
const {
qIndexChanged,
qIndexSASQProps
} = useSASQQIndex();
} = useSASQQIndex({ defaultQIndex });

const [storedFilterPaneVisibility] = useLocalStorage(filterPaneVisibilityKey, true);
const [filterPaneIsVisible, setFilterPaneIsVisible] = useState(storedFilterPaneVisibility);
Expand Down Expand Up @@ -272,35 +278,36 @@ const Titles = ({
columnMapping={{
name: <FormattedMessage id="ui-agreements.eresources.name" />,
publicationType: <FormattedMessage id="ui-agreements.eresources.publicationType" />,
materialType: <FormattedMessage id="ui-agreements.eresources.materialType" />,
isbn: <FormattedMessage id="ui-agreements.identifier.isbn" />,
eissn: <FormattedMessage id="ui-agreements.identifier.eissn" />,
pissn: <FormattedMessage id="ui-agreements.identifier.pissn" />,
issn: <FormattedMessage id="ui-agreements.identifier.issn" />,
}}
columnWidths={{
name: 300,
publicationType: 100,
publicationType: 150,
materialType: 150,
isbn: 150,
eissn: 150,
pissn: 150,
issn: 150,
}}
contentData={data.titles}
formatter={{
name: e => {
const iconKey = e.subType?.value === 'print' ? 'printTitle' : 'title';
return (
<AppIcon
app="agreements"
iconAlignment="baseline"
iconKey="title"
iconKey={iconKey}
size="small"
>
{e?.longName ?? e.name}
</AppIcon>
);
},
publicationType: e => <EResourceType resource={e} />,
materialType: e => e?.subType?.label,
isbn: e => getResourceIdentifier(e, 'isbn'),
eissn: e => getResourceIdentifier(e, 'eissn') ?? getResourceIdentifier(e, 'issn'),
pissn: e => getResourceIdentifier(e, 'pissn') ?? getSiblingIdentifier(e, 'issn'),
issn: e => (getResourceIdentifier(e, 'issn') ?? getResourceIdentifier(e, 'eissn')) ?? getResourceIdentifier(e, 'pissn'),
}}
id="list-titles"
isEmptyMessage={
Expand All @@ -325,7 +332,7 @@ const Titles = ({
sortDirection={sortOrder.startsWith('-') ? 'descending' : 'ascending'}
sortOrder={sortOrder.replace(/^-/, '').replace(/,.*/, '')}
totalCount={count}
visibleColumns={['name', 'publicationType', 'isbn', 'eissn', 'pissn']}
visibleColumns={['name', 'publicationType', 'materialType', 'isbn', 'issn']}
/>
</Pane>
{children}
Expand Down
4 changes: 2 additions & 2 deletions src/components/views/Titles/Titles.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,9 @@ describe('Titles', () => {
columns: [
'Name',
'Publication type',
'Material type',
'ISBN',
'ISSN (Online)',
'ISSN (Print)'
'ISSN',
],
}).exists();
});
Expand Down
2 changes: 1 addition & 1 deletion src/constants/defaultQIndex.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
// Defined as a constant here because we use it as a fallback for the query AND within the SASQ initial setup
export const defaultAgreementsQIndex = 'name,alternateNames.name,description';
export const defaultTitlesQIndex = 'name,identifiers.identifier.value,alternateResourceNames.name,description';
export const defaultTitlesQIndex = 'name,alternateResourceNames.name,description';
3 changes: 2 additions & 1 deletion src/constants/endpoints.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export const AGREEMENTS_ENDPOINT = 'erm/sas';
export const AGREEMENT_ENDPOINT = (agreementId) => `${AGREEMENTS_ENDPOINT}/${agreementId}`;

export const AGREEMENT_ERESOURCES_ENDPOINT = (agreementId, filterPath) => `${AGREEMENT_ENDPOINT(agreementId)}/resources/${filterPath}`;
export const AGREEMENT_ERESOURCES_ENDPOINT_STATIC = (agreementId, filterPath) => `${AGREEMENT_ENDPOINT(agreementId)}/resources/static/${filterPath}`;

export const AGREEMENT_LINES_ENDPOINT = 'erm/entitlements';
export const AGREEMENT_LINES_EXTERNAL_ENDPOINT = 'erm/entitlements/external';
Expand All @@ -18,7 +19,7 @@ export const ERESOURCE_ENDPOINT = (eresourceId) => `${ERESOURCES_ENDPOINT}/${ere

export const ERESOURCE_ENTITLEMENTS_ENDPOINT = (eresourceId) => `${ERESOURCE_ENDPOINT(eresourceId)}/entitlements`;
export const ERESOURCE_RELATED_ENTITLEMENTS_ENDPOINT = (eresourceId) => `${ERESOURCE_ENDPOINT(eresourceId)}/entitlements/related`;
export const ERESOURCE_ENTITLEMENT_OPTIONS_ENDPOINT = (eresourceId) => `${ERESOURCE_ENDPOINT(eresourceId)}/entitlementOptions`;
export const ERESOURCE_ENTITLEMENT_OPTIONS_ENDPOINT = (eresourceId) => `${ERESOURCE_ENDPOINT(eresourceId)}/static/entitlementOptions`; // Do a straight swap for static here and use stats as before

export const PCIS_ENDPOINT = 'erm/pci';
export const PCI_ENDPOINT = (pciId) => `erm/pci/${pciId}`;
Expand Down
Loading

0 comments on commit d3c7024

Please sign in to comment.