Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
* Add icons to requests action menu. Refs UIREQ-1116.
* Revise "Enter" button on New request page. Refs UIREQ-1114.
* Change import of `exportToCsv` from `stripes-util` to `stripes-components`. Refs UIREQ-1138.
* Fix accessibility issues with requests list. Refs UIREQ-1231.

## [11.0.3] (https://github.com/folio-org/ui-requests/tree/v11.0.3) (2025-01-10)
[Full Changelog](https://github.com/folio-org/ui-requests/compare/v11.0.2...v11.0.3)
Expand Down
23 changes: 2 additions & 21 deletions src/deprecated/routes/RequestsRoute/RequestsRoute.js
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,6 @@ export const urls = {
export const getListFormatter = (
{
getRowURL,
setURL,
},
{
intl,
Expand Down Expand Up @@ -269,7 +268,7 @@ export const getListFormatter = (
? <FormattedMessage id={requestStatusesTranslations[rq.status]} />
: <NoValue />),
'type': rq => <FormattedMessage id={requestTypesTranslations[rq.requestType]} />,
'title': rq => <TextLink to={getRowURL(rq.id)} onClick={() => setURL(rq.id)}>{(rq.instance ? rq.instance.title : DEFAULT_FORMATTER_VALUE)}</TextLink>,
'title': rq => <TextLink to={getRowURL(rq.id)}>{(rq.instance ? rq.instance.title : DEFAULT_FORMATTER_VALUE)}</TextLink>,
'year': rq => getFormattedYears(rq.instance?.publication, DEFAULT_DISPLAYED_YEARS_AMOUNT),
'callNumber': rq => effectiveCallNumber(rq.item),
'servicePoint': rq => get(rq, 'pickupServicePoint.name', DEFAULT_FORMATTER_VALUE),
Expand Down Expand Up @@ -649,7 +648,6 @@ class RequestsRoute extends React.Component {
errorModalData: {},
servicePointId: '',
requests: [],
selectedId: '',
selectedRows: {},
titleLevelRequestsFeatureEnabled,
createTitleLevelRequestsByDefault,
Expand Down Expand Up @@ -1009,20 +1007,6 @@ class RequestsRoute extends React.Component {
return `${path}/view/${id}${search}`;
}

setURL = (id) => {
this.setState({
selectedId: id,
});
}

resultIsSelected = ({ item }) => item.id === this.state.selectedId;

viewRecordOnCollapse = () => {
this.setState({
selectedId: null,
});
}

getHelperResourcePath = (helper, id) => `circulation/requests/${id}`;

massageNewRecord = (requestData) => {
Expand Down Expand Up @@ -1438,7 +1422,6 @@ class RequestsRoute extends React.Component {
const resultsFormatter = getListFormatter(
{
getRowURL: this.getRowURL,
setURL: this.setURL,
},
{
intl,
Expand Down Expand Up @@ -1660,7 +1643,7 @@ class RequestsRoute extends React.Component {
copies: { max: 95 },
}}
columnMapping={columnLabels}
resultsRowClickHandlers={false}
hasRowClickHandlers={false}
resultsFormatter={resultsFormatter}
resultRowFormatter={DefaultMCLRowFormatter}
newRecordInitialValues={initialValues}
Expand Down Expand Up @@ -1689,11 +1672,9 @@ class RequestsRoute extends React.Component {
onDuplicate: this.onDuplicate,
buildRecordsForHoldsShelfReport: this.buildRecordsForHoldsShelfReport,
}}
viewRecordOnCollapse={this.viewRecordOnCollapse}
viewRecordPerms="ui-requests.view"
newRecordPerms="ui-requests.create"
renderFilters={this.renderFilters}
resultIsSelected={this.resultIsSelected}
onFilterChange={this.handleFilterChange}
sortableColumns={['requestDate', 'title', 'year', 'itemBarcode', 'callNumber', 'type', 'requestStatus',
'position', 'servicePoint', 'requester', 'requesterBarcode', 'proxy', 'copies', 'printed']}
Expand Down
11 changes: 0 additions & 11 deletions src/deprecated/routes/RequestsRoute/RequestsRoute.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -257,8 +257,6 @@ SearchAndSort.mockImplementation(jest.fn(({
onFilterChange,
parentResources,
renderFilters,
resultIsSelected,
viewRecordOnCollapse,
customPaneSub,
columnMapping,
resultsFormatter,
Expand All @@ -267,12 +265,6 @@ SearchAndSort.mockImplementation(jest.fn(({
onDuplicate(parentResources.records.records[0]);
buildRecordsForHoldsShelfReport();
massageNewRecord({});
resultIsSelected({
item: {
id: 'id',
},
});
viewRecordOnCollapse();
};
return (
// eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions
Expand Down Expand Up @@ -1119,7 +1111,6 @@ describe('RequestsRoute', () => {

describe('getListFormatter', () => {
const getRowURLMock = jest.fn(id => id);
const setURLMock = jest.fn(id => id);
const getPrintContentRefMock = jest.fn(id => id);
const isPrintableMock = jest.fn(id => id);
const toggleRowSelectionMock = jest.fn(id => id);
Expand All @@ -1128,7 +1119,6 @@ describe('RequestsRoute', () => {
const listFormatter = getListFormatter(
{
getRowURL: getRowURLMock,
setURL: setURLMock,
},
{
intl,
Expand Down Expand Up @@ -1336,7 +1326,6 @@ describe('RequestsRoute', () => {
it('should render "TextLink" with correct props', () => {
const expectedProps = {
to: requestWithData.id,
onClick: expect.any(Function),
};

render(listFormatter.title(requestWithData));
Expand Down
23 changes: 2 additions & 21 deletions src/routes/RequestsRoute.js
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,6 @@
export const getListFormatter = (
{
getRowURL,
setURL,
},
{
intl,
Expand Down Expand Up @@ -288,7 +287,7 @@
? <FormattedMessage id={requestStatusesTranslations[rq.status]} />
: <NoValue />),
'type': rq => <FormattedMessage id={requestTypesTranslations[rq.requestType]} />,
'title': rq => <TextLink to={getRowURL(rq.id)} onClick={() => setURL(rq.id)}>{(rq.instance ? rq.instance.title : DEFAULT_FORMATTER_VALUE)}</TextLink>,
'title': rq => <TextLink to={getRowURL(rq.id)}>{(rq.instance ? rq.instance.title : DEFAULT_FORMATTER_VALUE)}</TextLink>,
'year': rq => getFormattedYears(rq.instance?.publication, DEFAULT_DISPLAYED_YEARS_AMOUNT),
'callNumber': rq => effectiveCallNumber(rq.item),
'servicePoint': rq => get(rq, 'pickupServicePoint.name', DEFAULT_FORMATTER_VALUE),
Expand Down Expand Up @@ -660,7 +659,6 @@
errorModalData: {},
servicePointId: '',
requests: [],
selectedId: '',
selectedRows: {},
titleLevelRequestsFeatureEnabled,
createTitleLevelRequestsByDefault,
Expand Down Expand Up @@ -1077,20 +1075,6 @@
return `${path}/view/${id}${search}`;
}

setURL = (id) => {
this.setState({
selectedId: id,
});
}

resultIsSelected = ({ item }) => item.id === this.state.selectedId;

viewRecordOnCollapse = () => {
this.setState({
selectedId: null,
});
}

getHelperResourcePath = (helper, id) => `circulation/requests/${id}`;

massageNewRecord = (requestData) => {
Expand Down Expand Up @@ -1518,7 +1502,6 @@
const resultsFormatter = getListFormatter(
{
getRowURL: this.getRowURL,
setURL: this.setURL,
},
{
intl,
Expand Down Expand Up @@ -1552,7 +1535,7 @@
</Icon>
</Button>
</IfPermission>
{csvReportPending ?

Check failure on line 1538 in src/routes/RequestsRoute.js

View workflow job for this annotation

GitHub Actions / github-actions-ci

Expected indentation of 8 space characters but found 10

Check failure on line 1538 in src/routes/RequestsRoute.js

View workflow job for this annotation

GitHub Actions / github-actions-ci

Expected indentation of 8 space characters but found 10
<LoadingButton>
<FormattedMessage id="ui-requests.csvReportPending" />
</LoadingButton> :
Expand Down Expand Up @@ -1741,7 +1724,7 @@
copies: { max: 95 },
}}
columnMapping={columnLabels}
resultsRowClickHandlers={false}
hasRowClickHandlers={false}
resultsFormatter={resultsFormatter}
resultRowFormatter={DefaultMCLRowFormatter}
newRecordInitialValues={initialValues}
Expand Down Expand Up @@ -1772,11 +1755,9 @@
isEcsTlrSettingReceived,
isEcsTlrSettingEnabled,
}}
viewRecordOnCollapse={this.viewRecordOnCollapse}
viewRecordPerms="ui-requests.view"
newRecordPerms="ui-requests.create"
renderFilters={this.renderFilters}
resultIsSelected={this.resultIsSelected}
onFilterChange={this.handleFilterChange}
sortableColumns={['requestDate', 'title', 'year', 'itemBarcode', 'callNumber', 'type', 'requestStatus',
'position', 'servicePoint', 'requester', 'requesterBarcode', 'retrievalServicePoint', ...(isProxyAvailable ? ['proxy'] : []), 'copies', 'printed']}
Expand Down
11 changes: 0 additions & 11 deletions src/routes/RequestsRoute.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -269,8 +269,6 @@ SearchAndSort.mockImplementation(jest.fn(({
onFilterChange,
parentResources,
renderFilters,
resultIsSelected,
viewRecordOnCollapse,
customPaneSub,
columnMapping,
resultsFormatter,
Expand All @@ -280,12 +278,6 @@ SearchAndSort.mockImplementation(jest.fn(({
onDuplicate(parentResources.records.records[0]);
buildRecordsForHoldsShelfReport();
massageNewRecord({});
resultIsSelected({
item: {
id: 'id',
},
});
viewRecordOnCollapse();
};
return (
// eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions
Expand Down Expand Up @@ -1277,7 +1269,6 @@ describe('RequestsRoute', () => {

describe('getListFormatter', () => {
const getRowURLMock = jest.fn(id => id);
const setURLMock = jest.fn(id => id);
const getPrintContentRefMock = jest.fn(id => id);
const isPrintableMock = jest.fn(id => id);
const toggleRowSelectionMock = jest.fn(id => id);
Expand All @@ -1286,7 +1277,6 @@ describe('RequestsRoute', () => {
const listFormatter = getListFormatter(
{
getRowURL: getRowURLMock,
setURL: setURLMock,
},
{
intl,
Expand Down Expand Up @@ -1497,7 +1487,6 @@ describe('RequestsRoute', () => {
it('should render "TextLink" with correct props', () => {
const expectedProps = {
to: requestWithData.id,
onClick: expect.any(Function),
};

render(listFormatter.title(requestWithData));
Expand Down
Loading