TSK-660 - Undo of changes in classification form resets also saved changes

This commit is contained in:
Jose Ignacio Recuerda Cambil 2018-07-31 11:50:34 +02:00 committed by Martin Rojas Miguel Angel
parent 5e4a681de4
commit 85721f0853
1 changed files with 7 additions and 2 deletions

View File

@ -182,6 +182,7 @@ export class ClassificationDetailsComponent implements OnInit, OnDestroy {
this.classification = classification;
this.afterRequest();
this.alertService.triggerAlert(new AlertModel(AlertType.SUCCESS, `Classification ${classification.key} was saved successfully`));
this.cloneClassification(classification);
}, error => {
this.errorModalService.triggerError(new ErrorModel('There was error while saving your classification', error))
this.afterRequest();
@ -232,7 +233,7 @@ export class ClassificationDetailsComponent implements OnInit, OnDestroy {
this.initClassificationOnCreation(classificationSelected);
} else {
this.classification = classificationSelected;
this.classificationClone = { ...classificationSelected };
this.cloneClassification(classificationSelected);
this.checkDomainAndRedirect();
}
}
@ -253,7 +254,7 @@ export class ClassificationDetailsComponent implements OnInit, OnDestroy {
if (this.classification) { this.classification.type = type; }
});
this.addDateToClassification();
this.classificationClone = { ...this.classification };
this.cloneClassification(this.classification);
}
private checkDomainAndRedirect() {
@ -288,6 +289,10 @@ export class ClassificationDetailsComponent implements OnInit, OnDestroy {
})
}
private cloneClassification (classification: ClassificationDefinition) {
this.classificationClone = { ...classification };
}
validChanged(): void {
this.classification.isValidInDomain = !this.classification.isValidInDomain;
}