-
Notifications
You must be signed in to change notification settings - Fork 18
UIIN-3558: Add additional call number to version history for item #2953
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
a0605da
e15ad7a
d536990
df2deb9
9b78f4e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -58,6 +58,32 @@ export const createFieldFormatter = (referenceData, circulationHistory) => ({ | |
| }, | ||
| }); | ||
|
|
||
| export const createItemFormatter = (fieldLabelsMap, fieldFormatter) => (element, i) => { | ||
| if (!element) return null; | ||
|
|
||
| const { name: fieldName, value, collectionName } = element; | ||
| const compositeKey = collectionName && fieldName | ||
| ? `${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> | ||
| ); | ||
| }; | ||
|
|
||
|
|
||
| const ItemVersionHistory = ({ | ||
| item, | ||
| onClose, | ||
|
|
@@ -137,9 +163,21 @@ const ItemVersionHistory = ({ | |
| typeId: formatMessage({ id: 'ui-inventory.effectiveCallNumberType' }), | ||
| 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); | ||
| const itemFormatter = createItemFormatter(fieldLabelsMap, fieldFormatter); | ||
|
|
||
| return ( | ||
| <AuditLogPane | ||
|
|
@@ -151,6 +189,7 @@ const ItemVersionHistory = ({ | |
| isInitialLoading={isLoading} | ||
| fieldLabelsMap={fieldLabelsMap} | ||
| fieldFormatter={fieldFormatter} | ||
| itemFormatter={itemFormatter} | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. could you describe the difference between itemFormatter and fieldFormatter, please?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. But you are right, I have to adapt the
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I added |
||
| actionsMap={actionsMap} | ||
| totalVersions={totalVersions} | ||
| /> | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do you think it is possible to use stripes'
Listcomponent here?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Stripes List component includes
<ul>:https://github.com/folio-org/stripes-components/blob/58e8eb022e3ef11726fcb90d129e946f57b9703d/lib/List/List.js#L52
but for the
itemFormatter, we just like to define<li>, since theitemFormatteris called already inside aList: