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
- add the original values to the params object sent to the server
- orig values displayed in table
- reorder siblings commands now records the names rather than just their id's
- bonus: removed console.log in involved-people-section.js

finos#6694
  • Loading branch information
davidwatkins73 committed Nov 19, 2023
1 parent 34d3575 commit 2a55ccd
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 7 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
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ function determineValue(change) {
return `To: ${params.destinationName}`;
case "MERGE":
return `Into: ${params.targetName}`;
case "REORDER_SIBLINGS":
return params.listAsNames;
default:
return "-";
}
Expand All @@ -67,7 +69,13 @@ function determineValue(change) {

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


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 2a55ccd

Please sign in to comment.