diff --git a/src/app/mapping/mapping.component.ts b/src/app/mapping/mapping.component.ts index 16d95dfaa73101c145e14a5a3607e8d34d717b9a..0b54724dd06582b84f18413325ae0824ed56f5af 100644 --- a/src/app/mapping/mapping.component.ts +++ b/src/app/mapping/mapping.component.ts @@ -64,13 +64,9 @@ export class MappingComponent implements OnInit { this.ids = this.dataSetService.ids; this.ids this.keys = []; - for (let i = 0; i < this.itemsdataset.length; i++) { - if (i === 0) { - this.getKeysFromMetadata(this.itemsdataset[i], ''); - this.keysMap.set(this.itemsdataset.length, this.keys); - this.filteredOptions = of(this.keysMap.get(1)); - } - } + this.getKeysFromMetadata(this.itemsdataset[0], ''); + this.keysMap.set(this.itemsdataset.length, this.keys); + this.filteredOptions = of(this.keysMap.get(1)); } createDataset(item: Object): Map<string, string> { @@ -86,7 +82,7 @@ export class MappingComponent implements OnInit { return mappedMetadata; } - publishDataset() { + publishDataset() { let data: string = ''; let properties: string = ''; let postedDatastes = []; @@ -134,8 +130,8 @@ export class MappingComponent implements OnInit { dct:isPartOf <https://f2ds.eosc-pillar.eu/catalog/' + this.catalogId + '>. } '*/ - let requestPromise = this.dataSetService.createDataset(data).then( (resp: HttpResponse<any>) => { - if (resp.status.toString().startsWith('2') && resp) { + let requestPromise = this.dataSetService.createDataset(data).then((resp: HttpResponse<any>) => { + if (resp.status.toString().startsWith('2')) { postedDatastes.push(this.ids[i]); } else { notPostedDatasets.push(this.ids[i]); @@ -143,7 +139,7 @@ export class MappingComponent implements OnInit { }) requestPromises.push(requestPromise); } - Promise.all(requestPromises).finally( () => { + Promise.all(requestPromises).finally(() => { this.loading = false; this.dialog.open(FeedbackDialogComponent, { data: {