From 9606ee4d91404b5cfa33b9e15bf11737ebcdcbd9 Mon Sep 17 00:00:00 2001
From: kfilippopolitis <kostasfilippop@gmail.com>
Date: Thu, 1 Jul 2021 04:00:05 -0700
Subject: [PATCH] Proper url for mip engine

---
 docker/README.md                                 |  2 +-
 docker/config/application.tmpl                   |  2 +-
 .../eu/hbp/mip/controllers/AlgorithmsAPI.java    |  6 +++---
 .../mip/models/DTOs/MIPEngineAlgorithmDTO.java   | 16 +++++++++++++---
 src/main/resources/application.yml               |  4 ++--
 5 files changed, 20 insertions(+), 10 deletions(-)

diff --git a/docker/README.md b/docker/README.md
index 8693aad09..36a3e1245 100644
--- a/docker/README.md
+++ b/docker/README.md
@@ -24,7 +24,7 @@ To use this image, you need a running instance of PostgreSQL and to configure th
 
 
 ### EXTERNAL SERVICES ###
-* MIPENGINE_URL: URL to MIPENGINE server. Default is "http://localhost:5000" .
+* MIPENGINE_URL: URL to MIPENGINE server. Default is "http://192.168.124.129:5000" .
 
 * EXAREME_URL: URL to Exareme server. Default is "http://localhost:9090" .
 
diff --git a/docker/config/application.tmpl b/docker/config/application.tmpl
index 0913c99e7..6059a902b 100644
--- a/docker/config/application.tmpl
+++ b/docker/config/application.tmpl
@@ -35,7 +35,7 @@ spring:
 ### EXTERNAL SERVICES ###
 services:
   mipengine:
-    algorithmsUrl: {{ default .Env.MIPENGINE_URL "http://localhost:5000" }}/algorithms
+    algorithmsUrl: {{ default .Env.MIPENGINE_URL "http://192.168.124.129:5000" }}/algorithms
 
   exareme:
     queryExaremeUrl: {{ default .Env.EXAREME_URL "http://localhost:9090" }}/mining/query
diff --git a/src/main/java/eu/hbp/mip/controllers/AlgorithmsAPI.java b/src/main/java/eu/hbp/mip/controllers/AlgorithmsAPI.java
index 1ca68f13b..68eb31340 100644
--- a/src/main/java/eu/hbp/mip/controllers/AlgorithmsAPI.java
+++ b/src/main/java/eu/hbp/mip/controllers/AlgorithmsAPI.java
@@ -68,7 +68,7 @@ public class AlgorithmsAPI {
     public ResponseEntity<List<AlgorithmDTO>> getAlgorithms() {
         Logger logger = new Logger(activeUserService.getActiveUser().getUsername(), "(GET) /algorithms");
 
-//        logger.LogUserAction("Executing...");
+        logger.LogUserAction("Executing...");
         LinkedList<AlgorithmDTO> mipengineAlgorithms = getMIPEngineAlgorithms(logger);
         logger.LogUserAction("Loaded " + mipengineAlgorithms.size() + " mipengine algorithms");
         LinkedList<AlgorithmDTO> exaremeAlgorithms = getExaremeAlgorithms(logger);
@@ -78,7 +78,7 @@ public class AlgorithmsAPI {
 
         LinkedList<AlgorithmDTO> algorithms = new LinkedList<>();
         if (exaremeAlgorithms != null) {
-//            algorithms.addAll(exaremeAlgorithms);
+            algorithms.addAll(exaremeAlgorithms);
         } else {
             logger.LogUserAction("Getting exareme algorithms failed and returned null");
         }
@@ -242,4 +242,4 @@ public class AlgorithmsAPI {
                 }.getType()
         );
     }
-}
+}
\ No newline at end of file
diff --git a/src/main/java/eu/hbp/mip/models/DTOs/MIPEngineAlgorithmDTO.java b/src/main/java/eu/hbp/mip/models/DTOs/MIPEngineAlgorithmDTO.java
index 4400ff9e7..f253bab6d 100644
--- a/src/main/java/eu/hbp/mip/models/DTOs/MIPEngineAlgorithmDTO.java
+++ b/src/main/java/eu/hbp/mip/models/DTOs/MIPEngineAlgorithmDTO.java
@@ -5,6 +5,7 @@ import lombok.Getter;
 import lombok.Setter;
 
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.Hashtable;
 import java.util.List;
 
@@ -62,10 +63,16 @@ public class MIPEngineAlgorithmDTO {
             AlgorithmDTO.AlgorithmParamDTO algorithmParamDTO = new AlgorithmDTO.AlgorithmParamDTO();
             algorithmParamDTO.setName(name);
             algorithmParamDTO.setDesc(this.desc);
-            algorithmParamDTO.setLabel(this.label);
-            if(name.equals("datasets") || name.equals("filter") || name.equals("pathology")){
-                algorithmParamDTO.setType(name.equals("datasets")? "dataset":name);
+            if(name.equals("datasets") || name.equals("filters") || name.equals("pathology")){
                 algorithmParamDTO.setValueType(this.types.get(0));
+                if(name.equals("filters")){
+                    algorithmParamDTO.setName("filter");
+                    algorithmParamDTO.setType("filter");
+                }
+                if(name.equals("datasets")){
+                    algorithmParamDTO.setName("dataset");
+                    algorithmParamDTO.setType("dataset");
+                }
             }
             else{
                 algorithmParamDTO.setType("column");
@@ -75,6 +82,9 @@ public class MIPEngineAlgorithmDTO {
             algorithmParamDTO.setValue("");
             algorithmParamDTO.setValueNotBlank(this.notblank);
             algorithmParamDTO.setValueMultiple(this.multiple);
+            String[] hidden = {"x","y","dataset", "filter","pathology","centers","formula"};
+            algorithmParamDTO.setLabel(Arrays.asList(hidden).contains(algorithmParamDTO.getName()) ? algorithmParamDTO.getName():this.label);
+
             return algorithmParamDTO;
         }
         private String getColumnValuesIsCategorical(List<String> stattypes) throws Exception {
diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml
index 660671108..8aadac388 100644
--- a/src/main/resources/application.yml
+++ b/src/main/resources/application.yml
@@ -11,7 +11,7 @@ logging:
 
 ### AUTHENTICATION ###
 authentication:
-  enabled: true
+  enabled: false
 
 
 ### DATABASE CONFIGURATION ###
@@ -35,7 +35,7 @@ spring:
 ### EXTERNAL SERVICES ###
 services:
   mipengine:
-    algorithmsUrl: "http://127.0.0.1:5000/algorithms"
+    algorithmsUrl: "http://192.168.124.129:5000/algorithms"
   exareme:
     queryExaremeUrl: "http://127.0.0.1:9090/mining/query"
     algorithmsUrl: "http://127.0.0.1:9090/mining/algorithms.json"
-- 
GitLab