Fixes bug: after discard grant was not set to previous value
This commit is contained in:
parent
166f0f7c37
commit
d856255405
|
@ -51,6 +51,7 @@ import { CloneDialogComponent } from '../clone/clone-dialog/clone-dialog.compone
|
|||
import { DatasetWizardModel } from '@app/core/model/dataset/dataset-wizard';
|
||||
import { DatasetService } from '@app/core/services/dataset/dataset.service';
|
||||
import { DmpToDatasetDialogComponent } from '../dmp-to-dataset/dmp-to-dataset-dialog.component';
|
||||
import { GrantEditorModel } from '@app/ui/grant/editor/grant-editor.model';
|
||||
|
||||
@Component({
|
||||
selector: 'app-dmp-editor-component',
|
||||
|
@ -826,7 +827,19 @@ export class DmpEditorComponent extends BaseComponent implements OnInit, IBreadC
|
|||
this.isDiscarded = true;
|
||||
this.hasChanges = false;
|
||||
if (!this.isNew) {
|
||||
let grantControl;
|
||||
if(this.formGroup.get('grant').get('existGrant')) {
|
||||
grantControl = new GrantTabModel();
|
||||
grantControl.fromModel(this.formGroup.get('grant').get('existGrant').value);
|
||||
} else {
|
||||
grantControl = new GrantEditorModel();
|
||||
grantControl.fromModel(this.formGroup.get('grant').value);
|
||||
}
|
||||
grantControl.buildForm()
|
||||
|
||||
this.formGroup.patchValue(JSON.parse(JSON.stringify(this.formGroupRawValue)));
|
||||
|
||||
this.formGroup.get('grant').get('existGrant').setValue(grantControl.existGrant);
|
||||
} else {
|
||||
this.formGroup.reset();
|
||||
this.formGroup.get('extraProperties').get('visible').setValue(false);
|
||||
|
|
Loading…
Reference in New Issue