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 class="mt-4 pt-2">{{'DATASET-LISTING.TEXT-INFO-PAR' | translate}}
<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}}
</button>
</div>
@ -38,8 +38,8 @@
<div class="d-flex flex-row ml-auto">
<!-- Guided Tour -->
<div class="center-content" [style.display]=" (!isVisible && isAuthenticated()) ? 'block' : 'none'" (click)="restartTour()">
{{ 'GENERAL.ACTIONS.TAKE-A-TOUR'| translate }}
</div>
{{ 'GENERAL.ACTIONS.TAKE-A-TOUR'| translate }}
</div>
<!-- End of Guided Tour -->
<!-- Search Filter-->
<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();
}
// console.log(this.formGroup);
// this.registerFormListeners();
this.datasetWizardModel = new DatasetWizardEditorModel();
this.registerFormListeners();
if (this.datasetId) { // never gets in here
this.datasetWizardService.getSingle(this.datasetId)
@ -187,8 +187,6 @@ export class DatasetEditorDetailsComponent extends BaseComponent implements OnIn
this.formGroup.get('profile').valueChanges
.pipe(takeUntil(this._destroyed))
.subscribe(x => {
// console.log('inhere');
// console.log(this.formGroup.get('datasetProfileDefinition'));
this.datasetProfileValueChanged(x);
});
}
@ -206,10 +204,10 @@ export class DatasetEditorDetailsComponent extends BaseComponent implements OnIn
}
}
datasetProfileValueChanged(profiledId: string) {
if (profiledId && profiledId.length > 0) {
datasetProfileValueChanged(profileId: string) {
if (profileId && profileId.length > 0) {
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; }
this.datasetWizardService.getDefinition(this.formGroup.get('profile').value)
this.datasetWizardService.getDefinition(profileId)
.pipe(takeUntil(this._destroyed))
.subscribe(item => {
this.datasetWizardModel.datasetProfileDefinition = new DatasetDescriptionFormEditorModel().fromModel(item);

View File

@ -24,7 +24,7 @@
</button>
</mat-form-field>
<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">
{{profile.label}}
</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.valueChanges.pipe(takeUntil(this._destroyed))
this.formGroup.get('datasets')['controls'][0].get('dmp').valueChanges.pipe(takeUntil(this._destroyed))
.subscribe(x => {
// this.registerFormListeners();
this.loadDatasetProfiles();
@ -165,16 +166,16 @@ export class DatasetInfoComponent extends BaseComponent implements OnInit {
}
registerFormListeners() {
this.formGroup.get('datasets')['controls'][0].get('dmp').valueChanges
.pipe(takeUntil(this._destroyed))
.subscribe(x => {
this.dmpValueChanged(x);
});
this.formGroup.get('profile').valueChanges
.pipe(takeUntil(this._destroyed))
.subscribe(x => {
this.datasetProfileValueChanged(x);
});
// this.formGroup.get('datasets')['controls'][0].get('dmp').valueChanges
// .pipe(takeUntil(this._destroyed))
// .subscribe(x => {
// this.dmpValueChanged(x);
// });
// this.formGroup.get('profile').valueChanges
// .pipe(takeUntil(this._destroyed))
// .subscribe(x => {
// //this.datasetProfileValueChanged(x);
// });
}
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.formGroup.valueChanges.pipe(takeUntil(this._destroyed))
.subscribe(x => {
this.onFormChanged.emit();