This commit is contained in:
Ioannis Kalyvas 2018-02-08 17:54:42 +02:00
commit c8d43a3bed
5 changed files with 27 additions and 19 deletions

View File

@ -1,11 +1,10 @@
<mat-selection-list #datasetsprofiles>
<mat-list-option *ngFor="let profile of profiles">
<mat-list-option *ngFor="let profile of profiles" [value]="profile">
{{profile.label}}
</mat-list-option>
</mat-selection-list>
<p>
Dataset Profiles selected: {{datasetsprofiles.selectedOptions.selected.length}}
Dataset Profiles selected: {{datasetsprofiles.value}}
</p>
<button mat-raised-button color="primary" (click)="addProfiles(datasetsprofiles.selectedOptions.selected)">OK</button>
<button mat-raised-button color="primary" (click)="addProfiles(datasetsprofiles)">OK</button>

View File

@ -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);
}
}

View File

@ -85,8 +85,7 @@ export class DatasetListingComponent implements OnInit {
return defaultCriteria;
}
makeItPublic(id: String) {
debugger;
makeItPublic(id: String) {
this.datasetService.makeDatasetPublic(id).subscribe();
}

View File

@ -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;

View File

@ -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)