Fixes bug on save and finalize button on DMP wizard

This commit is contained in:
apapachristou 2019-08-28 18:34:04 +03:00
parent 5c1df31d88
commit 5d1d1e36d7
4 changed files with 4 additions and 10 deletions

View File

@ -39,7 +39,7 @@ export class ProjectFormModel {
baseContext.validation.push({ key: 'label', validators: [Validators.required, BackendErrorValidator(this.validationErrorModel, 'label')] });
baseContext.validation.push({ key: 'status', validators: [] });
baseContext.validation.push({ key: 'description', validators: [Validators.required, BackendErrorValidator(this.validationErrorModel, 'description')] });
baseContext.validation.push({ key: 'existProject', validators: [Validators.required, ValidJsonValidator, BackendErrorValidator(this.validationErrorModel, 'existProject')] });
baseContext.validation.push({ key: 'existProject', validators: [BackendErrorValidator(this.validationErrorModel, 'existProject')] });
return baseContext;
}

View File

@ -8,10 +8,6 @@
<mat-form-field class="col-md-12 mt-2">
<app-single-auto-complete [formControl]="formGroup.get('existFunder')" placeholder="{{'QUICKWIZARD.CREATE-ADD.CREATE.QUICKWIZARD_CREATE.FIRST-STEP.FIELDS.SELECT-FUNDER' | translate}}" [configuration]="funderAutoCompleteConfiguration">
</app-single-auto-complete>
<mat-error *ngIf="formGroup.hasError('backendError')">
{{formGroup.get('existFunder').getError('backendError').message}}</mat-error>
<mat-error *ngIf="formGroup.hasError('required')">
{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
</mat-form-field>
</div>

View File

@ -9,10 +9,6 @@
<mat-form-field class="col-md-12 mt-2">
<app-single-auto-complete [formControl]="formGroup.get('existProject')" placeholder="{{'QUICKWIZARD.CREATE-ADD.CREATE.QUICKWIZARD_CREATE.FIRST-STEP.FIELDS.SELECT-PROJECT' | translate}}" [configuration]="projectAutoCompleteConfiguration">
</app-single-auto-complete>
<mat-error *ngIf="formGroup.hasError('backendError')">
{{formGroup.get('project').getError('backendError').message}}</mat-error>
<mat-error *ngIf="formGroup.hasError('required')">
{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
</mat-form-field>
</div>

View File

@ -20,6 +20,7 @@ import { DatasetEditorWizardComponent } from '../dataset-editor/dataset-editor-w
import { GrantEditorWizardModel } from '../grant-editor/grant-editor-wizard-model';
import { QuickWizardEditorWizardModel } from './quick-wizard-editor.model';
import { FunderFormModel } from '../../dmp/editor/grant-tab/funder-form-model';
import { ProjectFormModel } from '../../dmp/editor/grant-tab/project-form-model';
@Component({
selector: 'app-quick-wizard-editor-component',
@ -53,6 +54,7 @@ export class QuickWizardEditorComponent extends BaseComponent implements OnInit,
this.quickWizard = new QuickWizardEditorWizardModel();
this.quickWizard.grant = new GrantEditorWizardModel();
this.quickWizard.funder = new FunderFormModel();
this.quickWizard.project = new ProjectFormModel();
this.formGroup = this.quickWizard.buildForm();
this.language.get('NAV-BAR.DMP-WIZARD').pipe(takeUntil(this._destroyed)).subscribe(x => {
this.breadCrumbs = Observable.of([
@ -125,7 +127,7 @@ export class QuickWizardEditorComponent extends BaseComponent implements OnInit,
}
public isFormValid() {
return this.formGroup.valid;
return this.formGroup.get('grant').valid;
}
public touchAllFormFields(formControl: AbstractControl) {