QuickWizard Fix DatasetList And DefinitionProfile from Dmp Of DatasetsList
This commit is contained in:
parent
6ab752b99c
commit
2b7d663830
|
@ -29,7 +29,7 @@
|
|||
<mat-form-field class="col-12">
|
||||
<app-single-auto-complete [required]='true' [formControl]="formGroup.get('datasetProfile')"
|
||||
placeholder="{{'QUICKWIZARD.CREATE-ADD.CREATE.QUICKWIZARD_CREATE.SECOND-STEP.FIELDS.PROFILE' | translate}}"
|
||||
[configuration]="profilesAutoCompleteConfiguration">
|
||||
[configuration]="profilesAutoCompleteConfiguration" [disabled]="dataseteIsEmpty()">
|
||||
</app-single-auto-complete>
|
||||
<mat-error *ngIf="formGroup.get('datasetProfile').hasError('backendError')">
|
||||
{{formGroup.get('datasetProfile').getError('backendError').message}}</mat-error>
|
||||
|
|
|
@ -1,20 +1,20 @@
|
|||
import { Component, OnInit, Input } from '@angular/core';
|
||||
import { BaseComponent } from "../../../core/common/base/base.component";
|
||||
import { BreadcrumbItem } from '../../misc/breadcrumb/definition/breadcrumb-item';
|
||||
import { Observable } from 'rxjs';
|
||||
import { IBreadCrumbComponent } from '../../misc/breadcrumb/definition/IBreadCrumbComponent';
|
||||
import { Component, Input, OnInit } from '@angular/core';
|
||||
import { AbstractControl, FormArray, FormControl, FormGroup } from '@angular/forms';
|
||||
import { MatSnackBar } from '@angular/material';
|
||||
import { Router, ActivatedRoute } from '@angular/router';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { TranslateService } from '@ngx-translate/core';
|
||||
import { FormGroup, AbstractControl, FormControl, FormArray } from '@angular/forms';
|
||||
import { DmpEditorWizardModel } from './dmp-editor-wizard-model';
|
||||
import { UiNotificationService, SnackBarNotificationLevel } from '../../../core/services/notification/ui-notification-service';
|
||||
import { Observable } from 'rxjs';
|
||||
import { ValidationErrorModel } from '../../../common/forms/validation/error-model/validation-error-model';
|
||||
import { SingleAutoCompleteConfiguration } from '../../../library/auto-complete/single/single-auto-complete-configuration';
|
||||
import { BaseComponent } from "../../../core/common/base/base.component";
|
||||
import { DatasetProfileModel } from '../../../core/model/dataset/dataset-profile';
|
||||
import { RequestItem } from '../../../core/query/request-item';
|
||||
import { DatasetProfileCriteria } from '../../../core/query/dataset-profile/dataset-profile-criteria';
|
||||
import { RequestItem } from '../../../core/query/request-item';
|
||||
import { DmpService } from '../../../core/services/dmp/dmp.service';
|
||||
import { SnackBarNotificationLevel, UiNotificationService } from '../../../core/services/notification/ui-notification-service';
|
||||
import { SingleAutoCompleteConfiguration } from '../../../library/auto-complete/single/single-auto-complete-configuration';
|
||||
import { BreadcrumbItem } from '../../misc/breadcrumb/definition/breadcrumb-item';
|
||||
import { IBreadCrumbComponent } from '../../misc/breadcrumb/definition/IBreadCrumbComponent';
|
||||
import { DmpEditorWizardModel } from './dmp-editor-wizard-model';
|
||||
|
||||
|
||||
@Component({
|
||||
|
@ -30,10 +30,11 @@ export class DmpEditorWizardComponent extends BaseComponent implements OnInit, I
|
|||
dmp: DmpEditorWizardModel;
|
||||
@Input() formGroup: FormGroup;
|
||||
@Input() dmpLabel: string;
|
||||
@Input() datasetFormGroup: FormGroup;
|
||||
//formGroup: FormGroup = null;
|
||||
private uiNotificationService: UiNotificationService
|
||||
|
||||
profilesAutoCompleteConfiguration:SingleAutoCompleteConfiguration;
|
||||
profilesAutoCompleteConfiguration: SingleAutoCompleteConfiguration;
|
||||
filteredProfiles: DatasetProfileModel[];
|
||||
filteredProfilesAsync = false;
|
||||
|
||||
|
@ -62,8 +63,8 @@ export class DmpEditorWizardComponent extends BaseComponent implements OnInit, I
|
|||
this.dmp = new DmpEditorWizardModel();
|
||||
this.formGroup = this.dmp.buildForm();
|
||||
}
|
||||
this.formGroup.get('label').setValue(this.language.instant('QUICKWIZARD.CREATE-ADD.CREATE.QUICKWIZARD_CREATE.SECOND-STEP.DMP-NAME')+this.dmpLabel);
|
||||
this.formGroup.get('label').setValue(this.language.instant('QUICKWIZARD.CREATE-ADD.CREATE.QUICKWIZARD_CREATE.SECOND-STEP.DMP-NAME')+this.dmpLabel);
|
||||
this.formGroup.get('label').setValue(this.language.instant('QUICKWIZARD.CREATE-ADD.CREATE.QUICKWIZARD_CREATE.SECOND-STEP.DMP-NAME') + this.dmpLabel);
|
||||
this.formGroup.get('label').setValue(this.language.instant('QUICKWIZARD.CREATE-ADD.CREATE.QUICKWIZARD_CREATE.SECOND-STEP.DMP-NAME') + this.dmpLabel);
|
||||
|
||||
this.breadCrumbs = Observable.of([
|
||||
{
|
||||
|
@ -153,7 +154,12 @@ export class DmpEditorWizardComponent extends BaseComponent implements OnInit, I
|
|||
return this._service.searchDMPProfiles(request);
|
||||
}
|
||||
|
||||
|
||||
dataseteIsEmpty() {
|
||||
if (this.datasetFormGroup && this.datasetFormGroup.get('datasetsList') && (this.datasetFormGroup.get('datasetsList') as FormArray).length != 0) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -24,6 +24,7 @@
|
|||
<ng-container *ngIf="formGroup.get('project').valid">
|
||||
<div>
|
||||
<app-quick-wizard-dmp-editor-component class="col-12" [formGroup]="formGroup.get('dmp')"
|
||||
[datasetFormGroup]="formGroup.get('datasets')"
|
||||
[dmpLabel]=" getProjectLabel()">
|
||||
</app-quick-wizard-dmp-editor-component>
|
||||
</div>
|
||||
|
@ -40,7 +41,7 @@
|
|||
{{'QUICKWIZARD.CREATE-ADD.CREATE.QUICKWIZARD_CREATE.THIRD-STEP.TITLE' | translate}}
|
||||
</ng-template>
|
||||
<!-- <ng-container *ngIf="isAvtive('step3')"> -->
|
||||
<ng-container *ngIf="formGroup.get('dmp').valid && isAvtive('step3')">
|
||||
<ng-container *ngIf="formGroup.get('dmp').valid && isActive('step3')">
|
||||
<div *ngIf="formGroup.get('datasets')">
|
||||
<!-- <div *ngIf="this.isActiveStep(3)" class="row"> -->
|
||||
<app-dataset-editor-wizard-component class="col-12" [formGroup]="formGroup"
|
||||
|
|
|
@ -8,13 +8,11 @@ import { takeUntil } from 'rxjs/operators';
|
|||
import { ValidationErrorModel } from '../../../common/forms/validation/error-model/validation-error-model';
|
||||
import { BaseComponent } from "../../../core/common/base/base.component";
|
||||
import { SnackBarNotificationLevel, UiNotificationService } from '../../../core/services/notification/ui-notification-service';
|
||||
import { QuickWizardService } from '../../../core/services/quick-wizard/quick-wizard.service';
|
||||
import { BreadcrumbItem } from '../../misc/breadcrumb/definition/breadcrumb-item';
|
||||
import { IBreadCrumbComponent } from '../../misc/breadcrumb/definition/IBreadCrumbComponent';
|
||||
import { DmpEditorWizardModel } from '../dmp-editor/dmp-editor-wizard-model';
|
||||
import { ProjectEditorWizardModel } from '../project-editor/project-editor-wizard-model';
|
||||
import { QuickWizardEditorWizardModel } from './quick-wizard-editor.model';
|
||||
import { QuickWizardService } from '../../../core/services/quick-wizard/quick-wizard.service';
|
||||
import { DatasetEditorWizardModel } from '../dataset-editor/dataset-editor-wizard-model';
|
||||
|
||||
|
||||
|
||||
|
@ -50,8 +48,6 @@ export class QuickWizardEditorComponent extends BaseComponent implements OnInit,
|
|||
ngOnInit(): void {
|
||||
this.quickWizard = new QuickWizardEditorWizardModel();
|
||||
this.quickWizard.project = new ProjectEditorWizardModel();
|
||||
// this.quickWizard.dmp = new DmpEditorWizardModel();
|
||||
//this.quickWizard.datasets = new DatasetEditorWizardModel();
|
||||
this.formGroup = this.quickWizard.buildForm();
|
||||
this.breadCrumbs = Observable.of([
|
||||
{
|
||||
|
@ -60,50 +56,26 @@ export class QuickWizardEditorComponent extends BaseComponent implements OnInit,
|
|||
url: '/quick-wizard'
|
||||
}]
|
||||
);
|
||||
// this.route.params
|
||||
// .pipe(takeUntil(this._destroyed))
|
||||
// .subscribe((params: Params) => {
|
||||
// const itemId = params['id'];
|
||||
|
||||
// if (itemId != null) {
|
||||
// this.isNew = false;
|
||||
// this.projectService.getSingle(itemId).map(data => data as ProjectListingModel)
|
||||
// .pipe(takeUntil(this._destroyed))
|
||||
// .subscribe(data => {
|
||||
// this.project = new ProjectEditorModel().fromModel(data);
|
||||
// this.formGroup = this.project.buildForm(null, this.project.type === ProjectType.External || !this.editMode);
|
||||
// this.breadCrumbs = Observable.of([
|
||||
// { parentComponentName: 'ProjectListingComponent', label: 'Projects', url: '/projects' },
|
||||
// ]);
|
||||
// });
|
||||
// } else {
|
||||
// this.breadCrumbs = Observable.of([
|
||||
// { parentComponentName: '/', label: 'QuickWizard', url: '/quickwizard' },
|
||||
// ]);
|
||||
// setTimeout(() => {
|
||||
// this.formGroup = this.quickWizard.buildForm();
|
||||
// });
|
||||
// }
|
||||
// });
|
||||
}
|
||||
|
||||
isAvtive(step: string): boolean {
|
||||
isActive(step: string): boolean {
|
||||
switch (step) {
|
||||
case 'step1':
|
||||
return this.stepper.selectedIndex==0;
|
||||
return this.stepper.selectedIndex == 0;
|
||||
case 'step2':
|
||||
return this.stepper.selectedIndex==1;
|
||||
return this.stepper.selectedIndex == 1;
|
||||
case 'step3':
|
||||
return this.stepper.selectedIndex==2;
|
||||
return this.stepper.selectedIndex == 2;
|
||||
}
|
||||
}
|
||||
|
||||
formSubmit(): void {
|
||||
this.touchAllFormFields(this.formGroup);
|
||||
if (!this.isFormValid()) { return; }
|
||||
if(this.formGroup.get('datasets') && this.formGroup.get('datasets').get('datasetsList') && (this.formGroup.get('datasets').get('datasetsList')as FormArray).length>0){
|
||||
if (this.formGroup.get('datasets') && this.formGroup.get('datasets').get('datasetsList') && (this.formGroup.get('datasets').get('datasetsList') as FormArray).length > 0) {
|
||||
this.onSubmit();
|
||||
}else{
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -169,12 +141,16 @@ export class QuickWizardEditorComponent extends BaseComponent implements OnInit,
|
|||
}
|
||||
}
|
||||
|
||||
getProjectLabel():string{
|
||||
if(this.formGroup.get('project').get('existProject').value){
|
||||
getProjectLabel(): string {
|
||||
if (this.formGroup.get('project').get('existProject').value) {
|
||||
return this.formGroup.get('project').get('existProject').value['label'];
|
||||
}else{
|
||||
} else {
|
||||
return this.formGroup.get('project').get('label').value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
Loading…
Reference in New Issue