Adds dataset profile definition form on new dataset page

This commit is contained in:
apapachristou 2020-08-25 10:45:42 +03:00
parent be48a150b2
commit 15d2958c95
5 changed files with 23 additions and 25 deletions

View File

@ -7,7 +7,7 @@
<p>{{'DATASET-LISTING.TEXT-INFO' | translate}} <u class="pointer" [routerLink]="['/explore']">{{'DATASET-LISTING.LINK-PUBLIC-DATASETS' | translate}}</u> {{'DATASET-LISTING.TEXT-INFO-REST' | translate}}</p> <p>{{'DATASET-LISTING.TEXT-INFO' | translate}} <u class="pointer" [routerLink]="['/explore']">{{'DATASET-LISTING.LINK-PUBLIC-DATASETS' | translate}}</u> {{'DATASET-LISTING.TEXT-INFO-REST' | translate}}</p>
<p class="mt-4 pt-2">{{'DATASET-LISTING.TEXT-INFO-PAR' | translate}} <p class="mt-4 pt-2">{{'DATASET-LISTING.TEXT-INFO-PAR' | translate}}
<div class="col pl-0 pt-3"> <div class="col pl-0 pt-3">
<button mat-raised-button class="add-dataset align-self-center yellow-btn" [routerLink]="['/datasets/new']"> <button mat-raised-button class="add-dataset align-self-center yellow-btn" [routerLink]="['/new/dataset/']">
{{'DASHBOARD.ACTIONS.ADD-DATASET' | translate}} {{'DASHBOARD.ACTIONS.ADD-DATASET' | translate}}
</button> </button>
</div> </div>
@ -38,8 +38,8 @@
<div class="d-flex flex-row ml-auto"> <div class="d-flex flex-row ml-auto">
<!-- Guided Tour --> <!-- Guided Tour -->
<div class="center-content" [style.display]=" (!isVisible && isAuthenticated()) ? 'block' : 'none'" (click)="restartTour()"> <div class="center-content" [style.display]=" (!isVisible && isAuthenticated()) ? 'block' : 'none'" (click)="restartTour()">
{{ 'GENERAL.ACTIONS.TAKE-A-TOUR'| translate }} {{ 'GENERAL.ACTIONS.TAKE-A-TOUR'| translate }}
</div> </div>
<!-- End of Guided Tour --> <!-- End of Guided Tour -->
<!-- Search Filter--> <!-- Search Filter-->
<mat-form-field appearance="outline" class="search-form ml-auto col-auto" floatLabel="never"> <mat-form-field appearance="outline" class="search-form ml-auto col-auto" floatLabel="never">

View File

@ -93,8 +93,8 @@ export class DatasetEditorDetailsComponent extends BaseComponent implements OnIn
this.formGroup.disable(); this.formGroup.disable();
} }
// console.log(this.formGroup); this.datasetWizardModel = new DatasetWizardEditorModel();
// this.registerFormListeners(); this.registerFormListeners();
if (this.datasetId) { // never gets in here if (this.datasetId) { // never gets in here
this.datasetWizardService.getSingle(this.datasetId) this.datasetWizardService.getSingle(this.datasetId)
@ -187,8 +187,6 @@ export class DatasetEditorDetailsComponent extends BaseComponent implements OnIn
this.formGroup.get('profile').valueChanges this.formGroup.get('profile').valueChanges
.pipe(takeUntil(this._destroyed)) .pipe(takeUntil(this._destroyed))
.subscribe(x => { .subscribe(x => {
// console.log('inhere');
// console.log(this.formGroup.get('datasetProfileDefinition'));
this.datasetProfileValueChanged(x); this.datasetProfileValueChanged(x);
}); });
} }
@ -206,10 +204,10 @@ export class DatasetEditorDetailsComponent extends BaseComponent implements OnIn
} }
} }
datasetProfileValueChanged(profiledId: string) { datasetProfileValueChanged(profileId: string) {
if (profiledId && profiledId.length > 0) { if (profileId && profileId.length > 0) {
this.formGroup.removeControl('datasetProfileDefinition'); this.formGroup.removeControl('datasetProfileDefinition');
this.getDefinition(); this.getDefinition(profileId);
} }
} }
@ -221,9 +219,9 @@ export class DatasetEditorDetailsComponent extends BaseComponent implements OnIn
}); });
} }
getDefinition() { getDefinition(profileId: string) {
// if (this.formGroup.invalid) { setTimeout(() => this.stepper.selectedIndex = 0); return; } // if (this.formGroup.invalid) { setTimeout(() => this.stepper.selectedIndex = 0); return; }
this.datasetWizardService.getDefinition(this.formGroup.get('profile').value) this.datasetWizardService.getDefinition(profileId)
.pipe(takeUntil(this._destroyed)) .pipe(takeUntil(this._destroyed))
.subscribe(item => { .subscribe(item => {
this.datasetWizardModel.datasetProfileDefinition = new DatasetDescriptionFormEditorModel().fromModel(item); this.datasetWizardModel.datasetProfileDefinition = new DatasetDescriptionFormEditorModel().fromModel(item);

View File

@ -24,7 +24,7 @@
</button> </button>
</mat-form-field> </mat-form-field>
<mat-form-field *ngIf="isNewDataset"> <mat-form-field *ngIf="isNewDataset">
<mat-select placeholder=" {{'DATASET-WIZARD.FIRST-STEP.PROFILE'| translate}}" [required]="true" formControlName="profile"> <mat-select placeholder=" {{'DATASET-WIZARD.FIRST-STEP.PROFILE'| translate}}" [required]="true" [formControl]="this.formGroup.get('datasets')['controls'][0].get('profile')">
<mat-option *ngFor="let profile of availableProfiles" [value]="profile.id"> <mat-option *ngFor="let profile of availableProfiles" [value]="profile.id">
{{profile.label}} {{profile.label}}
</mat-option> </mat-option>

View File

@ -84,7 +84,8 @@ export class DatasetInfoComponent extends BaseComponent implements OnInit {
this.formGroup.get('extraProperties').get('publicDate').patchValue(new Date()); this.formGroup.get('extraProperties').get('publicDate').patchValue(new Date());
} }
this.formGroup.valueChanges.pipe(takeUntil(this._destroyed))
this.formGroup.get('datasets')['controls'][0].get('dmp').valueChanges.pipe(takeUntil(this._destroyed))
.subscribe(x => { .subscribe(x => {
// this.registerFormListeners(); // this.registerFormListeners();
this.loadDatasetProfiles(); this.loadDatasetProfiles();
@ -165,16 +166,16 @@ export class DatasetInfoComponent extends BaseComponent implements OnInit {
} }
registerFormListeners() { registerFormListeners() {
this.formGroup.get('datasets')['controls'][0].get('dmp').valueChanges // this.formGroup.get('datasets')['controls'][0].get('dmp').valueChanges
.pipe(takeUntil(this._destroyed)) // .pipe(takeUntil(this._destroyed))
.subscribe(x => { // .subscribe(x => {
this.dmpValueChanged(x); // this.dmpValueChanged(x);
}); // });
this.formGroup.get('profile').valueChanges // this.formGroup.get('profile').valueChanges
.pipe(takeUntil(this._destroyed)) // .pipe(takeUntil(this._destroyed))
.subscribe(x => { // .subscribe(x => {
this.datasetProfileValueChanged(x); // //this.datasetProfileValueChanged(x);
}); // });
} }
datasetProfileValueChanged(profiledId: string) { datasetProfileValueChanged(profiledId: string) {

View File

@ -84,7 +84,6 @@ export class MainInfoComponent extends BaseComponent implements OnInit {
} }
// this.formControl = this.formGroup.get('datasets')['controls'][0].get('dmp'); // this.formControl = this.formGroup.get('datasets')['controls'][0].get('dmp');
this.formGroup.valueChanges.pipe(takeUntil(this._destroyed)) this.formGroup.valueChanges.pipe(takeUntil(this._destroyed))
.subscribe(x => { .subscribe(x => {
this.onFormChanged.emit(); this.onFormChanged.emit();