Skip to content

Commit

Permalink
CM-406: get head from jsonExt (#35)
Browse files Browse the repository at this point in the history
* CM-406: add change log fe for group

* CM-406: get head from jsonExt

* CM-406: refetch on head change

---------

Co-authored-by: Jan <j.dolkowski@soldevelo.com>
  • Loading branch information
jdolkowski and Jan authored Jan 3, 2024
1 parent 0409574 commit 41704d5
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 11 deletions.
25 changes: 15 additions & 10 deletions src/components/GroupHistorySearcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,24 +32,29 @@ function GroupHistorySearcher({
'groupHistory.head',
'groupHistory.dateUpdated',
'groupHistory.version',
'groupHistory.jsonExt',
'groupHistory.members',
];

const itemFormatters = () => [
(groupHistory) => groupHistory.id,
(groupHistory) => `${groupHistory?.head?.firstName} ${groupHistory?.head?.lastName}`,
(groupHistory) => (groupHistory.dateUpdated
? formatDateFromISO(groupHistory.dateUpdated) : EMPTY_STRING
),
(groupHistory) => groupHistory.version,
(groupHistory) => groupHistory.jsonExt,
(groupHistory) => groupHistory?.id || EMPTY_STRING,
(groupHistory) => {
const jsonExt = groupHistory?.jsonExt ? JSON.parse(groupHistory.jsonExt) : null;
return jsonExt?.head ?? EMPTY_STRING;
},
(groupHistory) => (groupHistory?.dateUpdated
? formatDateFromISO(groupHistory.dateUpdated)
: EMPTY_STRING),
(groupHistory) => groupHistory?.version || EMPTY_STRING,
(groupHistory) => {
const jsonExt = groupHistory?.jsonExt ? JSON.parse(groupHistory.jsonExt) : null;
return jsonExt?.members ?? EMPTY_STRING;
},
];

const rowIdentifier = (groupHistory) => groupHistory.id;

const sorts = () => [
['id', false],
['head', false],
['id', true],
['dateUpdated', true],
['version', true],
];
Expand Down
3 changes: 3 additions & 0 deletions src/components/GroupIndividualSearcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ function GroupIndividualSearcher({
const [deletedGroupIndividualUuids, setDeletedGroupIndividualUuids] = useState([]);
const prevSubmittingMutationRef = useRef();
const [updatedGroupIndividuals, setUpdatedGroupIndividuals] = useState([]);
const [refetch, setRefetch] = useState(null);

function groupIndividualUpdatePageUrl(groupIndividual) {
return `${modulesManager.getRef('individual.route.individual')}/${groupIndividual.individual?.id}`;
Expand Down Expand Up @@ -156,6 +157,7 @@ function GroupIndividualSearcher({
id: editedGroupIndividual?.individual?.id,
}),
);
setRefetch(editedGroupIndividual?.individual?.id);
}
};

Expand Down Expand Up @@ -265,6 +267,7 @@ function GroupIndividualSearcher({
return (
<div>
<Searcher
key={refetch}
module="individual"
FilterPane={groupBeneficiaryFilter}
fetch={fetch}
Expand Down
3 changes: 2 additions & 1 deletion src/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,8 @@
"version": "Version",
"any": "ANY",
"ok": "ok",
"jsonExt": "Additional fields"
"jsonExt": "Additional fields",
"members": "Members"
},
"groupHistoryList": {
"pageTitle": "Groups History",
Expand Down

0 comments on commit 41704d5

Please sign in to comment.