Skip to content
Closed
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
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,45 @@
typeId: formatMessage({ id: 'ui-inventory.callNumberType' }),
volume: formatMessage({ id: 'ui-inventory.volume' }),
yearCaption: formatMessage({ id: 'ui-inventory.yearCaption' }),
additionalCallNumbers: formatMessage({ id: 'ui-inventory.additionalCallNumbers' }),
'additionalCallNumbers.prefix': formatMessage({ id: 'ui-inventory.additionalCallNumberPrefix' }),
'additionalCallNumbers.suffix': formatMessage({ id: 'ui-inventory.additionalCallNumberSuffix' }),
'additionalCallNumbers.typeId': formatMessage({ id: 'ui-inventory.additionalCallNumberType' }),
'additionalCallNumbers.callNumber': formatMessage({ id: 'ui-inventory.additionalCallNumber' }),
'circulationNotes.noteType': formatMessage({ id: 'ui-inventory.noteType' }),
'circulationNotes.note': formatMessage({ id: 'ui-inventory.note' }),
'circulationNotes.id': formatMessage({ id: 'ui-inventory.identifier' }),
'circulationNotes.date': formatMessage({ id: 'ui-inventory.date' }),
'circulationNotes.staffOnly': formatMessage({ id: 'ui-inventory.staffOnly' }),
'circulationNotes.source': formatMessage({ id: 'ui-inventory.source' }),
};

const fieldFormatter = createFieldFormatter(referenceData, circulationHistory);

Check failure on line 154 in src/Item/ViewItem/components/ItemVersionHistory/ItemVersionHistory.js

View workflow job for this annotation

GitHub Actions / ui / Install and lint / Install and lint

Trailing spaces not allowed
const itemFormatter = (item, i) => {

Check failure on line 155 in src/Item/ViewItem/components/ItemVersionHistory/ItemVersionHistory.js

View workflow job for this annotation

GitHub Actions / ui / Install and lint / Install and lint

'item' is already declared in the upper scope on line 62 column 3
if (!item) return null;

const { name: fieldName, value, collectionName } = item;
const compositeKey = collectionName && fieldName
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove itemFormatter here, it should be part of a separate Jira issue.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

moved the translation of effective call number to a separate PR instead: #2951

? `${collectionName}.${fieldName}`
: null;

const label = (compositeKey && fieldLabelsMap?.[compositeKey])
|| fieldLabelsMap?.[fieldName]
|| fieldLabelsMap?.[collectionName];

const formattedValue = (compositeKey && fieldFormatter?.[compositeKey]?.(value))
|| fieldFormatter?.[fieldName]?.(value)
|| fieldFormatter?.[collectionName]?.(value)
|| value;

return (
<li key={i}>
{fieldName && <strong>{label}: </strong>}
{formattedValue}
</li>
);
};

return (
<AuditLogPane
Expand All @@ -151,6 +187,7 @@
isInitialLoading={isLoading}
fieldLabelsMap={fieldLabelsMap}
fieldFormatter={fieldFormatter}
itemFormatter={itemFormatter}
actionsMap={actionsMap}
totalVersions={totalVersions}
/>
Expand Down
6 changes: 3 additions & 3 deletions src/edit/items/ItemForm.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@
...mockReferenceTables,
callNumberTypes: [{ id: '1', name: 'Library of Congress classification' }],
};
const { getByText, getAllByText, queryByText } = renderItemForm({

Check warning on line 261 in src/edit/items/ItemForm.test.js

View workflow job for this annotation

GitHub Actions / ui / Install and lint / Install and lint

'queryByText' is assigned a value but never used. Allowed unused vars must match /React/u
initialValues,
referenceTables,
});
Expand Down Expand Up @@ -291,9 +291,9 @@
'itemLevelCallNumberTypeId': { value: '2' },
'additionalCallNumbers': {
value: [{
callNumber: 'cn1',
prefix: 'prefix1',
suffix: 'suffix1',
additionalCallNumber: 'cn1',
additionalCallNumberPrefix: 'prefix1',
additionalCallNumberSuffix: 'suffix1',
typeId: '1'
}]
}
Expand Down
6 changes: 5 additions & 1 deletion translations/ui-inventory/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,11 @@
"callNumberPrefix": "Call number prefix",
"callNumberSuffix": "Call number suffix",
"primaryItemCallNumber": "Primary item call number",
"additionalItemCallNumbers": "Additional item call numbers",
"additionalCallNumbers": "Additional call numbers",
"additionalCallNumber": "Additional call number",
"additionalCallNumberPrefix": "Additional call number prefix",
"additionalCallNumberSuffix": "Additional call number suffix",
"additionalCallNumberType": "Additional call number type",
"primaryHoldingsCallNumber": "Primary holdings call number",
"additionalHoldingsCallNumbers": "Additional holdings call numbers",
"addAdditionalCallNumber": "Add additional call number",
Expand Down
Loading