Skip to content

Commit d3c7024

Browse files
Merge pull request #1318 from folio-org/release_10.1.0
Release 10.1.0
2 parents b3150d4 + fa3f845 commit d3c7024

File tree

17 files changed

+159
-75
lines changed

17 files changed

+159
-75
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# Change history for ui-agreements
22

3+
## 10.1.0 2024-05-26
4+
* ERM-3248 Use static endpoints for /resources and /entitlementOptions in Poppy Compatible release
5+
* ERM-3246 Improve performance of entitlementOptions endpoint
6+
* ERM-3239 Query all titles rather than just /electronic in local KB title search
7+
* ERM-3200 Backport ERM-3186 to Poppy compatible release
8+
* ERM-3186 Change default search options for Local KB titles to exclude identifiers
9+
310
## 10.0.1 2023-11-09
411
* ERM-3082 Backport grouping and spaces fix for Poppy
512
* ERM-3065 Agreement lines are displayed by default on the "Agreement lines" pane.

icons/printTitle.png

452 Bytes
Loading

icons/printTitle.svg

Lines changed: 1 addition & 0 deletions
Loading

package.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@folio/agreements",
3-
"version": "10.0.1",
3+
"version": "10.1.0",
44
"description": "ERM agreement functionality for Stripes",
55
"main": "src/index.js",
66
"publishConfig": {
@@ -338,6 +338,11 @@
338338
"name": "platform",
339339
"alt": " ",
340340
"title": "platform"
341+
},
342+
{
343+
"name": "printTitle",
344+
"alt": " ",
345+
"title": "Print title"
341346
}
342347
]
343348
}
Lines changed: 61 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
import React from 'react';
22
import PropTypes from 'prop-types';
33
import { FormattedMessage } from 'react-intl';
4+
import { useHistory } from 'react-router-dom';
5+
import { AppIcon } from '@folio/stripes/core';
46
import {
57
Col,
68
Headline,
9+
InfoPopover,
710
KeyValue,
811
NoValue,
912
Row,
13+
TextLink
1014
} from '@folio/stripes/components';
1115

1216
import { resourceTypes } from '../../constants';
@@ -37,39 +41,67 @@ const propTypes = {
3741
value: PropTypes.string,
3842
}),
3943
}).isRequired,
44+
showLink: PropTypes.bool,
4045
};
4146

4247
const RelatedTitleInfo = ({
43-
relatedTitle
44-
}) => (
45-
<div data-test-related-titles>
46-
<div className={css.separator} />
47-
<Headline data-test-title-instance-name size="large" tag="h3">
48-
<FormattedMessage id="ui-agreements.eresources.relatedTitle" values={{ name: relatedTitle.name }} />
49-
</Headline>
50-
<Row>
51-
<Col xs={3}>
52-
<KeyValue label={<FormattedMessage id="ui-agreements.eresources.materialType" />}>
53-
<div data-test-title-instance-sub-type>{relatedTitle.subType?.label ?? <NoValue />}</div>
54-
</KeyValue>
55-
</Col>
56-
{relatedTitle.type.value === resourceTypes.MONOGRAPH || relatedTitle.type.value === resourceTypes.BOOK ?
57-
<>
58-
<EResourceIdentifier titleInstance={relatedTitle} type="isbn" />
59-
<EResourceIdentifier titleInstance={relatedTitle} type="doi" />
60-
</>
61-
:
62-
<>
63-
<EResourceIdentifier titleInstance={relatedTitle} type="ezb" />
64-
<EResourceIdentifier titleInstance={relatedTitle} type="zdb" />
65-
<EResourceIdentifier titleInstance={relatedTitle} type="eissn" />
66-
<EResourceIdentifier titleInstance={relatedTitle} type="pissn" />
67-
<EResourceIdentifier titleInstance={relatedTitle} type="issn" />
68-
</>
48+
relatedTitle,
49+
showLink = false
50+
}) => {
51+
const { location: { search: searchString } } = useHistory();
52+
53+
const renderElectronicLink = () => {
54+
const relatedTitleLink = `${relatedTitle.id}${searchString}`;
55+
return (
56+
<Row>
57+
<Col xs={12}>
58+
<AppIcon
59+
app="agreements"
60+
iconAlignment="baseline"
61+
iconKey="title"
62+
size="small"
63+
>
64+
<TextLink to={relatedTitleLink}><FormattedMessage id="ui-agreements.eresources.electronicTitle" values={{ name: relatedTitle.name }} /></TextLink>
65+
<InfoPopover
66+
content={<FormattedMessage id="ui-agreements.eresources.relatedTitle.infoPopover" />}
67+
/>
68+
</AppIcon>
69+
</Col>
70+
</Row>
71+
);
72+
};
73+
74+
return (
75+
<div data-test-related-titles>
76+
<div className={css.separator} />
77+
<Headline data-test-title-instance-name size="large" tag="h3">
78+
<FormattedMessage id="ui-agreements.eresources.relatedTitle" values={{ name: relatedTitle.name }} />
79+
</Headline>
80+
<Row>
81+
<Col xs={3}>
82+
<KeyValue label={<FormattedMessage id="ui-agreements.eresources.materialType" />}>
83+
<div data-test-title-instance-sub-type>{relatedTitle.subType?.label ?? <NoValue />}</div>
84+
</KeyValue>
85+
</Col>
86+
{relatedTitle.type.value === resourceTypes.MONOGRAPH || relatedTitle.type.value === resourceTypes.BOOK ?
87+
<>
88+
<EResourceIdentifier titleInstance={relatedTitle} type="isbn" />
89+
<EResourceIdentifier titleInstance={relatedTitle} type="doi" />
90+
</>
91+
:
92+
<>
93+
<EResourceIdentifier titleInstance={relatedTitle} type="ezb" />
94+
<EResourceIdentifier titleInstance={relatedTitle} type="zdb" />
95+
<EResourceIdentifier titleInstance={relatedTitle} type="eissn" />
96+
<EResourceIdentifier titleInstance={relatedTitle} type="pissn" />
97+
<EResourceIdentifier titleInstance={relatedTitle} type="issn" />
98+
</>
6999
}
70-
</Row>
71-
</div>
72-
);
100+
</Row>
101+
{showLink && renderElectronicLink()}
102+
</div>
103+
);
104+
};
73105

74106
RelatedTitleInfo.propTypes = propTypes;
75107
export default RelatedTitleInfo;

src/components/RelatedTitleInfo/RelatedTitleInfo.test.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,15 @@ import translationsProperties from '../../../test/helpers';
66
import RelatedTitleInfo from './RelatedTitleInfo';
77
import { relatedMonographTitle, relatedSerialTitle } from './testResources';
88

9+
jest.mock('react-router-dom', () => ({
10+
...jest.requireActual('react-router-dom'),
11+
useHistory: () => ({
12+
location: {
13+
search: ''
14+
}
15+
}),
16+
}));
17+
918
let renderComponent;
1019
describe('RelatedTitleInfo', () => {
1120
describe('with monograph resource', () => {

src/components/TitleCard/TitleCardInfo.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ import RelatedTitleInfo from '../RelatedTitleInfo';
88

99
const propTypes = {
1010
title: PropTypes.shape({
11+
subType: PropTypes.shape({
12+
value: PropTypes.string,
13+
}),
1114
type: PropTypes.oneOfType([
1215
PropTypes.shape({ label: PropTypes.string }),
1316
PropTypes.string,
@@ -27,13 +30,13 @@ const TitleCardInfo = ({ title }) => {
2730
const type = (titleInstance?.type?.label ?? titleInstance?.type ?? '').toLowerCase();
2831
return (
2932
<>
30-
{ type === resourceTypes.MONOGRAPH || type === resourceTypes.BOOK ?
33+
{type === resourceTypes.MONOGRAPH || type === resourceTypes.BOOK ?
3134
<MonographResourceInfo titleInstance={titleInstance} />
3235
:
3336
<SerialResourceInfo titleInstance={titleInstance} />
3437
}
35-
{ titleInstance?.relatedTitles?.map((relatedTitle, i) => (
36-
<RelatedTitleInfo key={i} relatedTitle={relatedTitle} />
38+
{titleInstance?.relatedTitles?.map((relatedTitle, i) => (
39+
<RelatedTitleInfo key={i} relatedTitle={relatedTitle} showLink={title.subType?.value === 'print' && relatedTitle.subType?.value === 'electronic'} />
3740
))
3841
}
3942
</>

src/components/views/EResource/EResource.js

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ const EResource = ({
5858
if (eresource.class === resourceClasses.TITLEINSTANCE) {
5959
EResourceViewComponent = Title;
6060
icon = 'title';
61+
if (eresource.subType?.value === 'print') {
62+
icon = 'printTitle';
63+
}
6164
} else if (eresource.class === resourceClasses.PCI) {
6265
EResourceViewComponent = PCI;
6366
icon = 'pci';
@@ -78,14 +81,16 @@ const EResource = ({
7881
entity={eresource}
7982
/>
8083
}
81-
<Button
82-
buttonStyle="primary"
83-
id="clickable-edit-eresource"
84-
marginBottom0
85-
onClick={handlers.onEdit}
86-
>
87-
<FormattedMessage id="stripes-components.button.edit" />
88-
</Button>
84+
{eresource.subType?.value !== 'print' &&
85+
<Button
86+
buttonStyle="primary"
87+
id="clickable-edit-eresource"
88+
marginBottom0
89+
onClick={handlers.onEdit}
90+
>
91+
<FormattedMessage id="stripes-components.button.edit" />
92+
</Button>
93+
}
8994
</PaneMenu>
9095
</IfPermission>
9196
) : null

src/components/views/Title/Title.js

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -113,12 +113,16 @@ export default class Title extends React.Component {
113113
</Col>
114114
</Row>
115115
<AccordionSet initialStatus={this.getInitialAccordionsState()}>
116-
<Agreements
117-
{...this.getSectionProps('eresourceAgreements')}
118-
isEmptyMessage={<FormattedMessage id="ui-agreements.emptyAccordion.noAgreementsEresource" />}
119-
visibleColumns={['name', 'type', 'startDate', 'endDate', 'eresource', 'acqMethod', 'coverage', 'isCustomCoverage']}
120-
/>
121-
<AcquisitionOptions {...this.getSectionProps('acquisitionOptions')} />
116+
{data.eresource.subType.value !== 'print' &&
117+
<>
118+
<Agreements
119+
{...this.getSectionProps('eresourceAgreements')}
120+
isEmptyMessage={<FormattedMessage id="ui-agreements.emptyAccordion.noAgreementsEresource" />}
121+
visibleColumns={['name', 'type', 'startDate', 'endDate', 'eresource', 'acqMethod', 'coverage', 'isCustomCoverage']}
122+
/>
123+
<AcquisitionOptions {...this.getSectionProps('acquisitionOptions')} />
124+
</>
125+
}
122126
<NotesSmartAccordion
123127
{...this.getSectionProps('notes')}
124128
domainName="agreements"
@@ -129,7 +133,7 @@ export default class Title extends React.Component {
129133
pathToNoteDetails={urls.notes()}
130134
/>
131135
{
132-
handlers.isSuppressFromDiscoveryEnabled('title') &&
136+
handlers.isSuppressFromDiscoveryEnabled('title') && data.eresource.subType?.value !== 'print' &&
133137
<DiscoverySettings
134138
handlers={handlers}
135139
id="discoverySettings"

src/components/views/Titles/Titles.js

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ import {
2424

2525
import {
2626
getResourceIdentifier,
27-
getSiblingIdentifier,
2827
EResourceType,
2928
useHandleSubmitSearch,
3029
usePrevNextPagination,
@@ -36,6 +35,7 @@ import IdentifierReassignmentForm from '../../IdentifierReassignmentForm';
3635

3736
import { urls } from '../../utilities';
3837
import {
38+
defaultTitlesQIndex as defaultQIndex,
3939
KB_TAB_FILTER_PANE,
4040
KB_TAB_PANESET,
4141
KB_TAB_PANE_ID,
@@ -89,10 +89,16 @@ const Titles = ({
8989
pageSize: RESULT_COUNT_INCREMENT_MEDIUM
9090
});
9191

92+
/*
93+
* NOTE: This is not directly defaulting the qIndex,
94+
* rather setting up the "default" for inclusion in qIndexSASQProps,
95+
* which are passed to SASQ below. Then SASQ will be responsible for setting
96+
* initial qIndex values in the url on mount.
97+
*/
9298
const {
9399
qIndexChanged,
94100
qIndexSASQProps
95-
} = useSASQQIndex();
101+
} = useSASQQIndex({ defaultQIndex });
96102

97103
const [storedFilterPaneVisibility] = useLocalStorage(filterPaneVisibilityKey, true);
98104
const [filterPaneIsVisible, setFilterPaneIsVisible] = useState(storedFilterPaneVisibility);
@@ -272,35 +278,36 @@ const Titles = ({
272278
columnMapping={{
273279
name: <FormattedMessage id="ui-agreements.eresources.name" />,
274280
publicationType: <FormattedMessage id="ui-agreements.eresources.publicationType" />,
281+
materialType: <FormattedMessage id="ui-agreements.eresources.materialType" />,
275282
isbn: <FormattedMessage id="ui-agreements.identifier.isbn" />,
276-
eissn: <FormattedMessage id="ui-agreements.identifier.eissn" />,
277-
pissn: <FormattedMessage id="ui-agreements.identifier.pissn" />,
283+
issn: <FormattedMessage id="ui-agreements.identifier.issn" />,
278284
}}
279285
columnWidths={{
280286
name: 300,
281-
publicationType: 100,
287+
publicationType: 150,
288+
materialType: 150,
282289
isbn: 150,
283-
eissn: 150,
284-
pissn: 150,
290+
issn: 150,
285291
}}
286292
contentData={data.titles}
287293
formatter={{
288294
name: e => {
295+
const iconKey = e.subType?.value === 'print' ? 'printTitle' : 'title';
289296
return (
290297
<AppIcon
291298
app="agreements"
292299
iconAlignment="baseline"
293-
iconKey="title"
300+
iconKey={iconKey}
294301
size="small"
295302
>
296303
{e?.longName ?? e.name}
297304
</AppIcon>
298305
);
299306
},
300307
publicationType: e => <EResourceType resource={e} />,
308+
materialType: e => e?.subType?.label,
301309
isbn: e => getResourceIdentifier(e, 'isbn'),
302-
eissn: e => getResourceIdentifier(e, 'eissn') ?? getResourceIdentifier(e, 'issn'),
303-
pissn: e => getResourceIdentifier(e, 'pissn') ?? getSiblingIdentifier(e, 'issn'),
310+
issn: e => (getResourceIdentifier(e, 'issn') ?? getResourceIdentifier(e, 'eissn')) ?? getResourceIdentifier(e, 'pissn'),
304311
}}
305312
id="list-titles"
306313
isEmptyMessage={
@@ -325,7 +332,7 @@ const Titles = ({
325332
sortDirection={sortOrder.startsWith('-') ? 'descending' : 'ascending'}
326333
sortOrder={sortOrder.replace(/^-/, '').replace(/,.*/, '')}
327334
totalCount={count}
328-
visibleColumns={['name', 'publicationType', 'isbn', 'eissn', 'pissn']}
335+
visibleColumns={['name', 'publicationType', 'materialType', 'isbn', 'issn']}
329336
/>
330337
</Pane>
331338
{children}

0 commit comments

Comments
 (0)