Skip to content

Commit

Permalink
Merge pull request #6873 from davidwatkins73/waltz-6694-taxonomy-mgmt…
Browse files Browse the repository at this point in the history
…-orig-value

Show orig values in taxonomy mgmt history table
  • Loading branch information
jessica-woodland-scott-db authored Nov 21, 2023
2 parents 5c66eac + 84970b2 commit 4156921
Show file tree
Hide file tree
Showing 6 changed files with 80 additions and 67 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,6 @@ function controller($q, displayNameService, descriptionService, serviceBroker, i
.filter(d => d.direction === "EXACT")
.value();
applyFilters();
console.log({raw: vm.rawGridData, curr: vm.currentInvolvements})
});
};

Expand Down

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,52 @@ 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}`;
case "REORDER_SIBLINGS":
return params.listAsNames;
default:
return "-";
}
}


function determineOriginalValue(change) {
const params = change.params;
const orig = params.originalValue || "-";
switch (change.changeType) {
case "MOVE":
return `From: ${orig}`;
default:
return orig;
}
}


function mkValueAndOriginalValueProps(change) {

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


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

Expand All @@ -52,11 +100,21 @@ function controller(serviceBroker) {
.then(r => vm.items = _
.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
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,8 @@ function controller($scope,
},
onChange: () => {
vm.submitDisabled = vm.commandParams.name === vm.measurable.name;
}
},
paramProcessor: (d) => Object.assign(d, {originalValue: vm.measurable.name})
}, {
name: "Description",
code: "UPDATE_DESCRIPTION",
Expand All @@ -143,7 +144,8 @@ function controller($scope,
},
onChange: () => {
vm.submitDisabled = vm.commandParams.description === vm.measurable.description;
}
},
paramProcessor: (d) => Object.assign(d, {originalValue: vm.measurable.description})
}, {
name: "Concrete",
code: "UPDATE_CONCRETENESS",
Expand All @@ -157,7 +159,8 @@ function controller($scope,
resetForm({ concrete: !vm.measurable.concrete });
vm.submitDisabled = false;
calcPreview();
}
},
paramProcessor: (d) => Object.assign(d, {originalValue: vm.measurable.concrete})
}, {
name: "External Id",
code: "UPDATE_EXTERNAL_ID",
Expand All @@ -171,7 +174,8 @@ function controller($scope,
},
onChange: () => {
vm.submitDisabled = vm.commandParams.externalId === vm.measurable.externalId;
}
},
paramProcessor: (d) => Object.assign(d, {originalValue: vm.measurable.externalId})
}, {
name: "Move",
code: "MOVE",
Expand All @@ -197,6 +201,7 @@ function controller($scope,
resetForm();
},
paramProcessor: (d) => ({
originalValue: vm.parent.name,
destinationId: d.destination.id,
destinationName: d.destination.name
})
Expand All @@ -221,7 +226,9 @@ function controller($scope,
},
paramProcessor: (commandParams) => {
return {
list: JSON.stringify(_.map(commandParams.list, d => d.id))
originalValue: JSON.stringify(_.map(vm.siblings, d => d.name)),
list: JSON.stringify(_.map(commandParams.list, d => d.id)),
listAsNames: JSON.stringify(_.map(commandParams.list, d => d.name))
}
}
}
Expand Down

0 comments on commit 4156921

Please sign in to comment.