From ee7ff21a5c88270040552078996559128ad4ffcf Mon Sep 17 00:00:00 2001 From: Baptiste Toulemonde <toulemonde@cines.fr> Date: Thu, 9 Sep 2021 15:47:01 +0200 Subject: [PATCH] add select item to selct mapping ontology --- src/app/mapping/mapping.component.html | 11 +++++++++- src/app/mapping/mapping.component.ts | 28 ++++++++++++++++---------- 2 files changed, 27 insertions(+), 12 deletions(-) diff --git a/src/app/mapping/mapping.component.html b/src/app/mapping/mapping.component.html index b631d2f17..8eaf9a745 100644 --- a/src/app/mapping/mapping.component.html +++ b/src/app/mapping/mapping.component.html @@ -1,4 +1,13 @@ -<form #form="ngForm"> +<nb-card> + <nb-card-body> + <nb-select placeholder="Select ontology" [(ngModel)]="ontology" (ngModelChange)="selectOntology()" name="ontology"> + <nb-option value="dcat">Dcat</nb-option> + <nb-option value="geodcat">GeoDcat</nb-option> + </nb-select> + </nb-card-body> +</nb-card> + +<form #form="ngForm" *ngIf="ontology"> <div class="card-row"> <div class="card-col"> <nb-card size="giant"> diff --git a/src/app/mapping/mapping.component.ts b/src/app/mapping/mapping.component.ts index 1b2f279a4..cc601eb52 100644 --- a/src/app/mapping/mapping.component.ts +++ b/src/app/mapping/mapping.component.ts @@ -22,6 +22,7 @@ import { FeedbackDialogComponent } from './dialog/feedback-dialog/feedback-dialo }) export class MappingComponent implements OnInit { + ontology: string; itemsdataset: Object[] = [] dcatVocabulary: Dataset[]; vocabularies: Dataset[]; @@ -45,17 +46,6 @@ export class MappingComponent implements OnInit { constructor(private dataSetService: DatasetCrudService, private dialog: MatDialog, private route: Router, private fileSaverService: FileSaverService) { } ngOnInit() { - this.dataSetService.getLocally('./assets/dcat.json').subscribe( - dataset => { - this.dcatVocabulary = dataset; - this.vocabularies = dataset; - this.obsDcatVocabulary = of(this.dcatVocabulary) - this.selectedPaths = []; - }, - error => { - console.error(error); - }, - ); this.itemsdataset = this.dataSetService.itemsDataset; this.ids = this.dataSetService.ids; this.ids @@ -64,6 +54,22 @@ export class MappingComponent implements OnInit { this.filteredOptions = of(this.keys); } + selectOntology(): void { + + this.dataSetService.getLocally('./assets/'+ this.ontology + '.json').subscribe( + dataset => { + this.dcatVocabulary = dataset; + this.vocabularies = dataset; + this.obsDcatVocabulary = of(this.dcatVocabulary); + this.selectedPaths = []; + + }, + error => { + console.error(error); + }, + ); + } + createDataset(item: Object): Map<number, string> { console.log("rerereer" + this.selectedPaths) -- GitLab