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">
|
<mat-form-field class="col-12">
|
||||||
<app-single-auto-complete [required]='true' [formControl]="formGroup.get('datasetProfile')"
|
<app-single-auto-complete [required]='true' [formControl]="formGroup.get('datasetProfile')"
|
||||||
placeholder="{{'QUICKWIZARD.CREATE-ADD.CREATE.QUICKWIZARD_CREATE.SECOND-STEP.FIELDS.PROFILE' | translate}}"
|
placeholder="{{'QUICKWIZARD.CREATE-ADD.CREATE.QUICKWIZARD_CREATE.SECOND-STEP.FIELDS.PROFILE' | translate}}"
|
||||||
[configuration]="profilesAutoCompleteConfiguration">
|
[configuration]="profilesAutoCompleteConfiguration" [disabled]="dataseteIsEmpty()">
|
||||||
</app-single-auto-complete>
|
</app-single-auto-complete>
|
||||||
<mat-error *ngIf="formGroup.get('datasetProfile').hasError('backendError')">
|
<mat-error *ngIf="formGroup.get('datasetProfile').hasError('backendError')">
|
||||||
{{formGroup.get('datasetProfile').getError('backendError').message}}</mat-error>
|
{{formGroup.get('datasetProfile').getError('backendError').message}}</mat-error>
|
||||||
|
|
|
@ -1,20 +1,20 @@
|
||||||
import { Component, OnInit, Input } from '@angular/core';
|
import { Component, Input, OnInit } from '@angular/core';
|
||||||
import { BaseComponent } from "../../../core/common/base/base.component";
|
import { AbstractControl, FormArray, FormControl, FormGroup } from '@angular/forms';
|
||||||
import { BreadcrumbItem } from '../../misc/breadcrumb/definition/breadcrumb-item';
|
|
||||||
import { Observable } from 'rxjs';
|
|
||||||
import { IBreadCrumbComponent } from '../../misc/breadcrumb/definition/IBreadCrumbComponent';
|
|
||||||
import { MatSnackBar } from '@angular/material';
|
import { MatSnackBar } from '@angular/material';
|
||||||
import { Router, ActivatedRoute } from '@angular/router';
|
import { ActivatedRoute, Router } from '@angular/router';
|
||||||
import { TranslateService } from '@ngx-translate/core';
|
import { TranslateService } from '@ngx-translate/core';
|
||||||
import { FormGroup, AbstractControl, FormControl, FormArray } from '@angular/forms';
|
import { Observable } from 'rxjs';
|
||||||
import { DmpEditorWizardModel } from './dmp-editor-wizard-model';
|
|
||||||
import { UiNotificationService, SnackBarNotificationLevel } from '../../../core/services/notification/ui-notification-service';
|
|
||||||
import { ValidationErrorModel } from '../../../common/forms/validation/error-model/validation-error-model';
|
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 { 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 { 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 { 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({
|
@Component({
|
||||||
|
@ -23,21 +23,22 @@ import { DmpService } from '../../../core/services/dmp/dmp.service';
|
||||||
styleUrls: ['./dmp-editor-wizard.component.scss']
|
styleUrls: ['./dmp-editor-wizard.component.scss']
|
||||||
})
|
})
|
||||||
export class DmpEditorWizardComponent extends BaseComponent implements OnInit, IBreadCrumbComponent {
|
export class DmpEditorWizardComponent extends BaseComponent implements OnInit, IBreadCrumbComponent {
|
||||||
|
|
||||||
breadCrumbs: Observable<BreadcrumbItem[]> = Observable.of([]);
|
breadCrumbs: Observable<BreadcrumbItem[]> = Observable.of([]);
|
||||||
|
|
||||||
isNew = true;
|
isNew = true;
|
||||||
dmp: DmpEditorWizardModel;
|
dmp: DmpEditorWizardModel;
|
||||||
@Input() formGroup: FormGroup;
|
@Input() formGroup: FormGroup;
|
||||||
@Input() dmpLabel: string;
|
@Input() dmpLabel: string;
|
||||||
|
@Input() datasetFormGroup: FormGroup;
|
||||||
//formGroup: FormGroup = null;
|
//formGroup: FormGroup = null;
|
||||||
private uiNotificationService: UiNotificationService
|
private uiNotificationService: UiNotificationService
|
||||||
|
|
||||||
profilesAutoCompleteConfiguration:SingleAutoCompleteConfiguration;
|
profilesAutoCompleteConfiguration: SingleAutoCompleteConfiguration;
|
||||||
filteredProfiles: DatasetProfileModel[];
|
filteredProfiles: DatasetProfileModel[];
|
||||||
filteredProfilesAsync = false;
|
filteredProfilesAsync = false;
|
||||||
|
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
public snackBar: MatSnackBar,
|
public snackBar: MatSnackBar,
|
||||||
public router: Router,
|
public router: Router,
|
||||||
|
@ -49,7 +50,7 @@ export class DmpEditorWizardComponent extends BaseComponent implements OnInit, I
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
|
|
||||||
this.profilesAutoCompleteConfiguration = {
|
this.profilesAutoCompleteConfiguration = {
|
||||||
filterFn: this.filterProfiles.bind(this),
|
filterFn: this.filterProfiles.bind(this),
|
||||||
initialItems: (extraData) => this.filterProfiles(''),
|
initialItems: (extraData) => this.filterProfiles(''),
|
||||||
|
@ -62,16 +63,16 @@ export class DmpEditorWizardComponent extends BaseComponent implements OnInit, I
|
||||||
this.dmp = new DmpEditorWizardModel();
|
this.dmp = new DmpEditorWizardModel();
|
||||||
this.formGroup = this.dmp.buildForm();
|
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([
|
this.breadCrumbs = Observable.of([
|
||||||
{
|
{
|
||||||
parentComponentName: 'project',
|
parentComponentName: 'project',
|
||||||
label: 'Dmp',
|
label: 'Dmp',
|
||||||
url: '/quick-wizard/dmp'
|
url: '/quick-wizard/dmp'
|
||||||
}]
|
}]
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -143,17 +144,22 @@ export class DmpEditorWizardComponent extends BaseComponent implements OnInit, I
|
||||||
|
|
||||||
filterProfiles(value: string): Observable<DatasetProfileModel[]> {
|
filterProfiles(value: string): Observable<DatasetProfileModel[]> {
|
||||||
|
|
||||||
this.filteredProfiles = undefined;
|
this.filteredProfiles = undefined;
|
||||||
this.filteredProfilesAsync = true;
|
this.filteredProfilesAsync = true;
|
||||||
|
|
||||||
const request = new RequestItem<DatasetProfileCriteria>();
|
|
||||||
const criteria = new DatasetProfileCriteria();
|
|
||||||
criteria.like = value;
|
|
||||||
request.criteria = criteria;
|
|
||||||
return this._service.searchDMPProfiles(request);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
const request = new RequestItem<DatasetProfileCriteria>();
|
||||||
|
const criteria = new DatasetProfileCriteria();
|
||||||
|
criteria.like = value;
|
||||||
|
request.criteria = criteria;
|
||||||
|
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">
|
<ng-container *ngIf="formGroup.get('project').valid">
|
||||||
<div>
|
<div>
|
||||||
<app-quick-wizard-dmp-editor-component class="col-12" [formGroup]="formGroup.get('dmp')"
|
<app-quick-wizard-dmp-editor-component class="col-12" [formGroup]="formGroup.get('dmp')"
|
||||||
|
[datasetFormGroup]="formGroup.get('datasets')"
|
||||||
[dmpLabel]=" getProjectLabel()">
|
[dmpLabel]=" getProjectLabel()">
|
||||||
</app-quick-wizard-dmp-editor-component>
|
</app-quick-wizard-dmp-editor-component>
|
||||||
</div>
|
</div>
|
||||||
|
@ -40,7 +41,7 @@
|
||||||
{{'QUICKWIZARD.CREATE-ADD.CREATE.QUICKWIZARD_CREATE.THIRD-STEP.TITLE' | translate}}
|
{{'QUICKWIZARD.CREATE-ADD.CREATE.QUICKWIZARD_CREATE.THIRD-STEP.TITLE' | translate}}
|
||||||
</ng-template>
|
</ng-template>
|
||||||
<!-- <ng-container *ngIf="isAvtive('step3')"> -->
|
<!-- <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="formGroup.get('datasets')">
|
||||||
<!-- <div *ngIf="this.isActiveStep(3)" class="row"> -->
|
<!-- <div *ngIf="this.isActiveStep(3)" class="row"> -->
|
||||||
<app-dataset-editor-wizard-component class="col-12" [formGroup]="formGroup"
|
<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 { ValidationErrorModel } from '../../../common/forms/validation/error-model/validation-error-model';
|
||||||
import { BaseComponent } from "../../../core/common/base/base.component";
|
import { BaseComponent } from "../../../core/common/base/base.component";
|
||||||
import { SnackBarNotificationLevel, UiNotificationService } from '../../../core/services/notification/ui-notification-service';
|
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 { BreadcrumbItem } from '../../misc/breadcrumb/definition/breadcrumb-item';
|
||||||
import { IBreadCrumbComponent } from '../../misc/breadcrumb/definition/IBreadCrumbComponent';
|
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 { ProjectEditorWizardModel } from '../project-editor/project-editor-wizard-model';
|
||||||
import { QuickWizardEditorWizardModel } from './quick-wizard-editor.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';
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -49,9 +47,7 @@ export class QuickWizardEditorComponent extends BaseComponent implements OnInit,
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
this.quickWizard = new QuickWizardEditorWizardModel();
|
this.quickWizard = new QuickWizardEditorWizardModel();
|
||||||
this.quickWizard.project = new ProjectEditorWizardModel();
|
this.quickWizard.project = new ProjectEditorWizardModel();
|
||||||
// this.quickWizard.dmp = new DmpEditorWizardModel();
|
|
||||||
//this.quickWizard.datasets = new DatasetEditorWizardModel();
|
|
||||||
this.formGroup = this.quickWizard.buildForm();
|
this.formGroup = this.quickWizard.buildForm();
|
||||||
this.breadCrumbs = Observable.of([
|
this.breadCrumbs = Observable.of([
|
||||||
{
|
{
|
||||||
|
@ -60,50 +56,26 @@ export class QuickWizardEditorComponent extends BaseComponent implements OnInit,
|
||||||
url: '/quick-wizard'
|
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) {
|
switch (step) {
|
||||||
case 'step1':
|
case 'step1':
|
||||||
return this.stepper.selectedIndex==0;
|
return this.stepper.selectedIndex == 0;
|
||||||
case 'step2':
|
case 'step2':
|
||||||
return this.stepper.selectedIndex==1;
|
return this.stepper.selectedIndex == 1;
|
||||||
case 'step3':
|
case 'step3':
|
||||||
return this.stepper.selectedIndex==2;
|
return this.stepper.selectedIndex == 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
formSubmit(): void {
|
formSubmit(): void {
|
||||||
this.touchAllFormFields(this.formGroup);
|
this.touchAllFormFields(this.formGroup);
|
||||||
if (!this.isFormValid()) { return; }
|
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();
|
this.onSubmit();
|
||||||
}else{
|
} else {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -169,12 +141,16 @@ export class QuickWizardEditorComponent extends BaseComponent implements OnInit,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
getProjectLabel():string{
|
getProjectLabel(): string {
|
||||||
if(this.formGroup.get('project').get('existProject').value){
|
if (this.formGroup.get('project').get('existProject').value) {
|
||||||
return this.formGroup.get('project').get('existProject').value['label'];
|
return this.formGroup.get('project').get('existProject').value['label'];
|
||||||
}else{
|
} else {
|
||||||
return this.formGroup.get('project').get('label').value;
|
return this.formGroup.get('project').get('label').value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue