Fixes bug on Create New Dmp
This commit is contained in:
parent
8f381c6d85
commit
2572d3e760
|
@ -98,7 +98,7 @@ export class DmpEditorModel {
|
||||||
baseContext.validation.push({ key: 'version', validators: [BackendErrorValidator(this.validationErrorModel, 'version')] });
|
baseContext.validation.push({ key: 'version', validators: [BackendErrorValidator(this.validationErrorModel, 'version')] });
|
||||||
baseContext.validation.push({ key: 'status', validators: [Validators.required, BackendErrorValidator(this.validationErrorModel, 'status')] });
|
baseContext.validation.push({ key: 'status', validators: [Validators.required, BackendErrorValidator(this.validationErrorModel, 'status')] });
|
||||||
baseContext.validation.push({ key: 'description', validators: [Validators.required, BackendErrorValidator(this.validationErrorModel, 'description')] });
|
baseContext.validation.push({ key: 'description', validators: [Validators.required, BackendErrorValidator(this.validationErrorModel, 'description')] });
|
||||||
baseContext.validation.push({ key: 'project', validators: [Validators.required, ValidJsonValidator, BackendErrorValidator(this.validationErrorModel, 'project')] });
|
baseContext.validation.push({ key: 'project', validators: [Validators.required, BackendErrorValidator(this.validationErrorModel, 'project')] });
|
||||||
baseContext.validation.push({ key: 'organisations', validators: [BackendErrorValidator(this.validationErrorModel, 'organisations')] });
|
baseContext.validation.push({ key: 'organisations', validators: [BackendErrorValidator(this.validationErrorModel, 'organisations')] });
|
||||||
baseContext.validation.push({ key: 'researchers', validators: [BackendErrorValidator(this.validationErrorModel, 'researchers')] });
|
baseContext.validation.push({ key: 'researchers', validators: [BackendErrorValidator(this.validationErrorModel, 'researchers')] });
|
||||||
baseContext.validation.push({ key: 'profiles', validators: [Validators.required, ValidJsonValidator, BackendErrorValidator(this.validationErrorModel, 'profiles')] });
|
baseContext.validation.push({ key: 'profiles', validators: [Validators.required, ValidJsonValidator, BackendErrorValidator(this.validationErrorModel, 'profiles')] });
|
||||||
|
|
|
@ -43,6 +43,9 @@ export class ProjectTabComponent implements OnInit {
|
||||||
this.project = new ProjectTabModel();
|
this.project = new ProjectTabModel();
|
||||||
this.formGroup = this.project.buildForm();
|
this.formGroup = this.project.buildForm();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.isCreateNew = (this.formGroup.get('label').value != null && this.formGroup.get('label').value.length > 0);
|
||||||
|
this.setValidators();
|
||||||
}
|
}
|
||||||
|
|
||||||
searchProject(query: string) {
|
searchProject(query: string) {
|
||||||
|
@ -54,9 +57,12 @@ export class ProjectTabComponent implements OnInit {
|
||||||
|
|
||||||
create() {
|
create() {
|
||||||
this.isCreateNew = !this.isCreateNew;
|
this.isCreateNew = !this.isCreateNew;
|
||||||
|
this.setValidators();
|
||||||
|
}
|
||||||
|
|
||||||
|
setValidators() {
|
||||||
if (this.isCreateNew) {
|
if (this.isCreateNew) {
|
||||||
this.formGroup.get('existProject').disable();
|
this.formGroup.get('existProject').disable();
|
||||||
// this.formGroup.get('existProject').reset();
|
|
||||||
this.formGroup.get('label').enable();
|
this.formGroup.get('label').enable();
|
||||||
this.formGroup.get('description').enable();
|
this.formGroup.get('description').enable();
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue