diff --git a/CHANGELOG.md b/CHANGELOG.md
index f862d458..37e312c3 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -3,6 +3,7 @@
## (6.1.0 IN PROGRESS)
* Add `useDebouncedQuery` hook to fix endless request for `DynamicSelection` component. Refs UISACQCOMP-233.
+* Display system change label for version cards. Refs UISACQCOMP-231.
## [6.0.1](https://github.com/folio-org/stripes-acq-components/tree/v6.0.1) (2024-11-14)
[Full Changelog](https://github.com/folio-org/stripes-acq-components/compare/v6.0.0...v6.0.1)
diff --git a/lib/VersionHistory/VersionCard/VersionCard.js b/lib/VersionHistory/VersionCard/VersionCard.js
index 79a61367..86b718e7 100644
--- a/lib/VersionHistory/VersionCard/VersionCard.js
+++ b/lib/VersionHistory/VersionCard/VersionCard.js
@@ -16,10 +16,11 @@ import css from './VersionCard.css';
const itemFormatter = (item, i) => (
{item});
const VersionCard = ({
- changedFields,
+ changedFields = [],
id,
isCurrent,
isLatest,
+ isOriginal,
onSelect,
source,
title,
@@ -62,6 +63,49 @@ const VersionCard = ({
), [id, isCurrent, onSelectVersion, tooltip]);
+ const message = useMemo(() => {
+ if (isOriginal) {
+ return (
+
+
+
+ );
+ }
+
+ if (changedFields?.length) {
+ return (
+ <>
+
+
+ >
+ );
+ }
+
+ return (
+ <>
+
+
+ >
+ );
+ }, [changedFields, isOriginal]);
+
return (
)}
-
- {
- changedFields
- ? (
- <>
-
-
- >
- )
- : (
-
-
-
- )
- }
-
+ {message}
);
};
@@ -120,6 +138,7 @@ VersionCard.propTypes = {
id: PropTypes.string.isRequired,
isCurrent: PropTypes.bool,
isLatest: PropTypes.bool,
+ isOriginal: PropTypes.bool,
onSelect: PropTypes.func.isRequired,
source: PropTypes.node.isRequired,
title: PropTypes.node.isRequired,
diff --git a/lib/VersionHistory/VersionHistoryPane/VersionHistoryPane.js b/lib/VersionHistory/VersionHistoryPane/VersionHistoryPane.js
index 17bf8887..1491053e 100644
--- a/lib/VersionHistory/VersionHistoryPane/VersionHistoryPane.js
+++ b/lib/VersionHistory/VersionHistoryPane/VersionHistoryPane.js
@@ -26,7 +26,7 @@ const VersionHistoryPane = ({
isLoading: isLoadingProp,
onClose,
onSelectVersion,
- hiddenFields,
+ hiddenFields = [],
labelsMap,
versions,
}) => {
@@ -54,7 +54,7 @@ const VersionHistoryPane = ({
const versionCards = useMemo(() => (
versionsToDisplay.map(({
id: versionId,
- actionDate,
+ eventDate,
userId,
}, i) => {
const user = usersMap[userId];
@@ -65,6 +65,8 @@ const VersionHistoryPane = ({
hiddenFields,
);
+ const isOriginal = i === versionsToDisplay.length - 1 && !changedFields?.length;
+
const source = (
}
+ title={}
source={source}
changedFields={changedFields}
/>
@@ -143,8 +146,4 @@ VersionHistoryPane.propTypes = {
versions: PropTypes.arrayOf(PropTypes.object).isRequired,
};
-VersionHistoryPane.defaultProps = {
- hiddenFields: [],
-};
-
export default memo(VersionHistoryPane);
diff --git a/lib/VersionHistory/getVersionMetadata.js b/lib/VersionHistory/getVersionMetadata.js
new file mode 100644
index 00000000..cbc08fb8
--- /dev/null
+++ b/lib/VersionHistory/getVersionMetadata.js
@@ -0,0 +1,7 @@
+import get from 'lodash/get';
+
+export const getVersionMetadata = (version, entity) => ({
+ ...get(entity, 'metadata', {}),
+ updatedByUserId: version?.userId,
+ updatedDate: version?.eventDate,
+});
diff --git a/translations/stripes-acq-components/en.json b/translations/stripes-acq-components/en.json
index c642972f..2f31ec2a 100644
--- a/translations/stripes-acq-components/en.json
+++ b/translations/stripes-acq-components/en.json
@@ -217,6 +217,7 @@
"validation.shouldBeGreaterThan": "Value must be greater than or equal to {minNumber}",
"versionHistory.card.changed": "Changed",
+ "versionHistory.card.systemChange": "System maintenance update",
"versionHistory.card.select.tooltip": "View this version",
"versionHistory.card.version.current": "Current version",
"versionHistory.card.version.original": "Original version",