Merge branch 'RED-8092' into 'master'
RED-8092: fixed revert when there is a pre-existing value. See merge request redactmanager/red-ui!240
This commit is contained in:
commit
333700073b
@ -23,6 +23,7 @@ export class EditDossierAttributesComponent implements EditDossierSectionInterfa
|
||||
imageAttributes: DossierAttributeWithValue[] = [];
|
||||
attributes: DossierAttributeWithValue[] = [];
|
||||
form: UntypedFormGroup;
|
||||
initialFormValue: { [key: string]: string } = {};
|
||||
|
||||
constructor(
|
||||
private readonly _permissionsService: PermissionsService,
|
||||
@ -58,6 +59,7 @@ export class EditDossierAttributesComponent implements EditDossierSectionInterfa
|
||||
this._loadingService.start();
|
||||
await this._loadAttributes();
|
||||
this.form = this._getForm();
|
||||
this.initialFormValue = this.form.getRawValue();
|
||||
this._loadingService.stop();
|
||||
}
|
||||
|
||||
@ -73,6 +75,7 @@ export class EditDossierAttributesComponent implements EditDossierSectionInterfa
|
||||
await firstValueFrom(this._dossierAttributesService.setAttributes(this.dossier, dossierAttributeList));
|
||||
await firstValueFrom(this._dossierAttributesService.loadAll(this.dossier.dossierTemplateId));
|
||||
await this._loadAttributes();
|
||||
this.initialFormValue = this.form.getRawValue();
|
||||
return { success: true };
|
||||
} catch (error) {
|
||||
this._toaster.error(_('edit-dossier-dialog.attributes.error.generic'));
|
||||
@ -106,7 +109,7 @@ export class EditDossierAttributesComponent implements EditDossierSectionInterfa
|
||||
}
|
||||
|
||||
revert() {
|
||||
this._loadAttributes().then(() => this.form.reset());
|
||||
this._loadAttributes().then(() => this.form.reset(this.initialFormValue));
|
||||
}
|
||||
|
||||
currentAttrValue(attr: DossierAttributeWithValue): string {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user