From 250484fddaceb217361049181ab84dd376aec936 Mon Sep 17 00:00:00 2001
From: Baptiste Toulemonde <toulemonde@cines.fr>
Date: Fri, 23 Jul 2021 11:13:32 +0200
Subject: [PATCH] fix

---
 src/app/mapping/mapping.component.ts | 18 +++++++-----------
 1 file changed, 7 insertions(+), 11 deletions(-)

diff --git a/src/app/mapping/mapping.component.ts b/src/app/mapping/mapping.component.ts
index 16d95dfaa..0b54724dd 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: {
-- 
GitLab