diff --git a/dmp-frontend/src/app/available-profiles/available-profiles.component.html b/dmp-frontend/src/app/available-profiles/available-profiles.component.html index ab3d95fae..4efca5868 100644 --- a/dmp-frontend/src/app/available-profiles/available-profiles.component.html +++ b/dmp-frontend/src/app/available-profiles/available-profiles.component.html @@ -1,11 +1,10 @@ - + {{profile.label}}

Dataset Profiles selected: {{datasetsprofiles.selectedOptions.selected.length}} - Dataset Profiles selected: {{datasetsprofiles.value}}

- \ No newline at end of file + \ No newline at end of file diff --git a/dmp-frontend/src/app/available-profiles/available-profiles.component.ts b/dmp-frontend/src/app/available-profiles/available-profiles.component.ts index b2cd1ea34..48f5a5dc3 100644 --- a/dmp-frontend/src/app/available-profiles/available-profiles.component.ts +++ b/dmp-frontend/src/app/available-profiles/available-profiles.component.ts @@ -6,6 +6,7 @@ import { Params, ActivatedRoute, Router } from '@angular/router'; import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material'; import { DatasetService } from '@app/services/dataset/dataset.service'; import { DatasetProfileModel } from '@app/models/datasetprofile/DatasetProfileModel'; +import { DatasetProfileModule } from '@app/dataset-profile-form/dataset-profile.module'; @Component({ selector: 'available-profiles-component', @@ -16,7 +17,8 @@ import { DatasetProfileModel } from '@app/models/datasetprofile/DatasetProfileMo export class AvailableProfilesComponent implements OnInit { private formGroup: FormGroup; - private profiles: DatasetProfileModel[] =[]; + private profiles: DatasetProfileModel[] = []; + private selectedProfiles: DatasetProfileModel[] = []; constructor( private datasetService: DatasetService, @@ -27,14 +29,26 @@ export class AvailableProfilesComponent implements OnInit { ) { } ngOnInit(): void { - - this.datasetService.getDatasetProfiles().subscribe(data=>{ + + this.datasetService.getDatasetProfiles().subscribe(data => { this.profiles = JsonSerializer.fromJSONArray(data, DatasetProfileModel) - } + } ) } - addProfiles(profiles){ - this.dialogRef.close(); + addProfiles(profiles) { + console.log(profiles) + // profiles.selectedOptions.forEach(element => { + // selectedProfiles.push(element.value) + // }); + + profiles.selectedOptions.selected.forEach(element => { + let selectedElement = new DatasetProfileModel(); + selectedElement.id = element.value.id; + selectedElement.label = element.value.label; + this.selectedProfiles.push(selectedElement) + }) + + this.dialogRef.close(this.selectedProfiles); } } \ No newline at end of file diff --git a/dmp-frontend/src/app/datasets/listing/dataset-listing.component.ts b/dmp-frontend/src/app/datasets/listing/dataset-listing.component.ts index 712e81adf..c8471bf38 100644 --- a/dmp-frontend/src/app/datasets/listing/dataset-listing.component.ts +++ b/dmp-frontend/src/app/datasets/listing/dataset-listing.component.ts @@ -85,8 +85,7 @@ export class DatasetListingComponent implements OnInit { return defaultCriteria; } - makeItPublic(id: String) { - debugger; + makeItPublic(id: String) { this.datasetService.makeDatasetPublic(id).subscribe(); } diff --git a/dmp-frontend/src/app/dmps/editor/dmp-editor.component.ts b/dmp-frontend/src/app/dmps/editor/dmp-editor.component.ts index a776bd3a4..5099433e3 100644 --- a/dmp-frontend/src/app/dmps/editor/dmp-editor.component.ts +++ b/dmp-frontend/src/app/dmps/editor/dmp-editor.component.ts @@ -108,8 +108,7 @@ export class DataManagementPlanEditorComponent implements AfterViewInit { return this.formGroup.valid; } - onSubmit(): void { - debugger; + onSubmit(): void { this.dataManagementPlanService.createDataManagementPlan(this.formGroup.value).subscribe( complete => this.onCallbackSuccess(), error => this.onCallbackError(error) @@ -228,10 +227,8 @@ export class DataManagementPlanEditorComponent implements AfterViewInit { } }); - - dialogRef.afterClosed().subscribe(result => { - console.log(result); - + dialogRef.afterClosed().subscribe(result => { + this.formGroup.get("profiles").setValue(result); }); return false; diff --git a/dmp-frontend/src/app/dmps/wizard/editor/dmp-wizard-editor.component.ts b/dmp-frontend/src/app/dmps/wizard/editor/dmp-wizard-editor.component.ts index 30504ac3c..00135a0ee 100644 --- a/dmp-frontend/src/app/dmps/wizard/editor/dmp-wizard-editor.component.ts +++ b/dmp-frontend/src/app/dmps/wizard/editor/dmp-wizard-editor.component.ts @@ -75,8 +75,7 @@ export class DataManagementPlanWizardEditorComponent implements AfterViewInit { return this.formGroup.valid; } - onSubmit(): void { - debugger; + onSubmit(): void { this.dataManagementPlanService.createDataManagementPlan(this.formGroup.value).subscribe( complete => this.onCallbackSuccess(), error => this.onCallbackError(error)