Skip to content

Commit

Permalink
Pre compute old/new values for the change table
Browse files Browse the repository at this point in the history
- decom'd the old `taxonomy-change-summary-cell` component
- updated the new values to cover more command types
- TODO: add the original values to the params object sent to the server

finos#6694
  • Loading branch information
davidwatkins73 committed Nov 19, 2023
1 parent 5c66eac commit 34d3575
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 62 deletions.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,23 @@ const initialState = {
},
mkEntityLinkGridCell("Entity", "primaryReference", "none", "right"),
{
field: "params",
displayName: "Parameters",
cellTemplate: `
<div class="ui-grid-cell-contents">
<waltz-taxonomy-change-summary-cell change="row.entity">
</waltz-taxonomy-change-summary-cell>
</div>`
field: "value",
displayName: "Value"
}, {
field: "originalValue",
displayName: "Original Value"
}, {
field: "lastUpdatedBy",
displayName: "Updated By",
width: "10%",
}, {
field: "lastUpdatedAt",
displayName: "Updated At",
cellTemplate: "<div class=\"ui-grid-cell-contents\"><waltz-from-now timestamp=\"COL_FIELD\"></waltz-from-now></div>"
cellTemplate: `
<div class="ui-grid-cell-contents">
<waltz-from-now timestamp="COL_FIELD">
</waltz-from-now>
</div>`
}
]
};
Expand All @@ -40,6 +42,44 @@ const bindings = {
};


function determineValue(change) {
const params = change.params;
switch (change.changeType) {
case "ADD_CHILD":
return params.name;
case "UPDATE_NAME":
return params.name;
case "UPDATE_DESCRIPTION":
return params.description;
case "UPDATE_CONCRETENESS":
return params.concrete;
case "UPDATE_EXTERNAL_ID":
return params.externalId;
case "MOVE":
return `To: ${params.destinationName}`;
case "MERGE":
return `Into: ${params.targetName}`;
default:
return "-";
}
}


function determineOriginalValue(change) {
const params = change.params;
return params.originalValue || "-";
}


function mkValueAndOriginalValueProps(change) {

return {
value: determineValue(change),
originalValue: determineOriginalValue(change)
};
}


function controller(serviceBroker) {
const vm = initialiseData(this, initialState);

Expand All @@ -49,14 +89,24 @@ function controller(serviceBroker) {
.execute(
CORE_API.TaxonomyManagementStore.findAllChangesByDomain,
[vm.parentEntityRef])
.then(r => vm.items = _
.then(r => vm.items = console.log(r.data) || _
.chain(r.data)
.filter(d => d.status === "EXECUTED")
.map(d => {
return Object.assign(
{
changeType: d.changeType,
primaryReference: d.primaryReference,
lastUpdatedBy: d.lastUpdatedBy,
lastUpdatedAt: d.lastUpdatedAt,
params: d.params
},
mkValueAndOriginalValueProps(d));
})
.orderBy(
[d => d.lastUpdatedAt, d => d.createdAt],
["desc", "desc"])
.value());

}
};
}
Expand Down
4 changes: 1 addition & 3 deletions waltz-ng/client/measurable-category/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import angular from "angular";
import CategoryStore from "./services/measurable-category-store";
import TaxonomyChangesSection from "./components/taxonomy-changes/taxonomy-changes-section"
import TaxonomyChangeSummaryCell from "./components/taxonomy-change-summary-cell/taxonomy-change-summary-cell"
import Routes from "./routes";
import {registerComponents, registerStores} from "../common/module-utils";

Expand All @@ -32,8 +31,7 @@ export default () => {
registerComponents(
module,
[
TaxonomyChangesSection,
TaxonomyChangeSummaryCell
TaxonomyChangesSection
]);

module.config(Routes);
Expand Down

0 comments on commit 34d3575

Please sign in to comment.