Dmp Clone - NewVersion Fix Disabled Propertys

This commit is contained in:
Diamantis Tziotzios 2019-02-13 17:11:10 +02:00
parent 89e13b2e03
commit b498a53441
4 changed files with 11 additions and 8 deletions

View File

@ -44,7 +44,7 @@
<div class="centered-row-item col-auto"> <div class="centered-row-item col-auto">
<mat-checkbox [formControl]="fieldFormGroup.get('required')">{{'DMP-PROFILE-EDITOR.FIELDS.REQUIRED' | translate}}</mat-checkbox> <mat-checkbox [formControl]="fieldFormGroup.get('required')">{{'DMP-PROFILE-EDITOR.FIELDS.REQUIRED' | translate}}</mat-checkbox>
</div> </div>
<div class="centered-row-item col-auto"><button mat-icon-button color="primary" type="button" (click)="removeField(i)"> <div class="centered-row-item col-auto"><button mat-icon-button type="button" (click)="removeField(i)">
<mat-icon class="mat-24">delete</mat-icon> <mat-icon class="mat-24">delete</mat-icon>
</button> </button>
</div> </div>

View File

@ -22,5 +22,6 @@
bottom: 10px !important; bottom: 10px !important;
left: auto !important; left: auto !important;
position: fixed !important; position: fixed !important;
z-index: 5;
} }
} }

View File

@ -47,8 +47,15 @@ export class DmpWizardComponent extends BaseComponent implements OnInit, IBreadC
.subscribe(data => { .subscribe(data => {
this.dmp = new DmpWizardEditorModel().fromModel(data); this.dmp = new DmpWizardEditorModel().fromModel(data);
this.isClone = this.route.snapshot.data.clone; this.isClone = this.route.snapshot.data.clone;
if (this.isClone === false) { this.dmp.version = this.dmp.version + 1; }
this.formGroup = this.dmp.buildForm(); this.formGroup = this.dmp.buildForm();
if (this.route.routeConfig.path.startsWith('new_version/')) {
this.formGroup.get('version').setValue(this.dmp.version + 1);
this.formGroup.controls['label'].disable();
this.formGroup.controls['project'].disable();
} else if (this.route.routeConfig.path.startsWith('clone/')) {
this.formGroup.get('label').setValue(this.dmp.label + "New");
}
}); });
}); });
} }

View File

@ -99,11 +99,6 @@ export class DmpWizardEditorComponent extends BaseComponent implements OnInit {
this.route.data this.route.data
.pipe(takeUntil(this._destroyed)) .pipe(takeUntil(this._destroyed))
.subscribe(value => { .subscribe(value => {
if (value.clone === false && this.formGroup.get('label').value) {
this.labelDisabled = true;
this.formGroup.controls['label'].disable();
this.formGroup.controls['project'].disable();
}
this.formGroup.controls['version'].disable(); this.formGroup.controls['version'].disable();
}); });
} }