update dynamically the stakeholders' alias list on create, edit, delete

This commit is contained in:
Alex Martzios 2022-02-09 11:41:23 +02:00
parent 7734212747
commit 85b1fc7a9a
2 changed files with 10 additions and 2 deletions

View File

@ -195,11 +195,17 @@ export class ManageStakeholdersComponent implements OnInit, OnDestroy {
this.editStakeholderComponent.init(this.stakeholder, this.alias, this.defaultStakeholders, isDefault, this.index === -1);
if (this.index !== -1) {
this.callback = (stakeholder: Stakeholder) => {
let index = -1;
if (stakeholder.defaultId == null) {
index = this.alias.findIndex(value => value == this.defaultStakeholders[this.index].alias);
this.defaultStakeholders[this.index] = stakeholder;
} else {
index = this.alias.findIndex(value => value == this.stakeholders[this.index].alias);
this.stakeholders[this.index] = stakeholder;
}
if(index != -1) {
this.alias[index] = stakeholder.alias;
}
};
this.editStakeholderModal.okButtonText = 'Save Changes';
} else {
@ -207,8 +213,9 @@ export class ManageStakeholdersComponent implements OnInit, OnDestroy {
if (stakeholder.defaultId === null) {
this.defaultStakeholders.push(stakeholder);
} else {
this.stakeholders.push(stakeholder);
this.stakeholders.push(stakeholder);
}
this.alias.push(stakeholder.alias);
};
this.editStakeholderModal.okButtonText = 'Create';
}
@ -239,6 +246,7 @@ export class ManageStakeholdersComponent implements OnInit, OnDestroy {
timeout: 6000,
pos: 'bottom-right'
});
this.alias = this.alias.filter(item => item !== this.stakeholder.alias);
if (!this.stakeholder.defaultId) {
this.defaultStakeholders.splice(this.index, 1);
} else {

@ -1 +1 @@
Subproject commit 0561d945c55068dc9297f83cf7caff1eb7b0b97b
Subproject commit 965b1ee134bc56313b5912e83a2ae23387e4c493