airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From machris...@apache.org
Subject [airavata-django-portal] 02/03: AIRAVATA-2975 Change data product lookup to computed props
Date Wed, 08 May 2019 12:56:13 GMT
This is an automated email from the ASF dual-hosted git repository.

machristie pushed a commit to branch airavata-2975
in repository https://gitbox.apache.org/repos/asf/airavata-django-portal.git

commit cc2f55d0cf27d7e50bc32154889c2a74ba11bdd3
Author: Marcus Christie <machristie@apache.org>
AuthorDate: Tue May 7 19:00:20 2019 -0400

    AIRAVATA-2975 Change data product lookup to computed props
---
 .../js/components/experiment/ExperimentSummary.vue | 46 +++++++++-------------
 1 file changed, 18 insertions(+), 28 deletions(-)

diff --git a/django_airavata/apps/workspace/static/django_airavata_workspace/js/components/experiment/ExperimentSummary.vue
b/django_airavata/apps/workspace/static/django_airavata_workspace/js/components/experiment/ExperimentSummary.vue
index dedf98f..e7e9496 100644
--- a/django_airavata/apps/workspace/static/django_airavata_workspace/js/components/experiment/ExperimentSummary.vue
+++ b/django_airavata/apps/workspace/static/django_airavata_workspace/js/components/experiment/ExperimentSummary.vue
@@ -59,7 +59,7 @@
                           {{ output.value }}
                         </template>
                         <template v-else-if="output.type.isFileValueType">
-                          <data-product-viewer v-for="dp in getDataProducts(output, localFullExperiment.outputDataProducts)"
+                          <data-product-viewer v-for="dp in outputDataProducts[output.name]"
                             :data-product="dp" class="data-product" :key="dp.productUri"/>
                         </template>
                       </li>
@@ -158,7 +158,7 @@
                         <template v-if="input.type.isSimpleValueType">
                           {{ input.value }}
                         </template>
-                        <data-product-viewer v-for="dp in getDataProducts(input, localFullExperiment.inputDataProducts)"
+                        <data-product-viewer v-for="dp in inputDataProducts[input.name]"
                           v-else-if="input.type.isFileValueType"
                           :data-product="dp" :input-file="true" class="data-product" :key="dp.productUri"/>
                       </li>
@@ -212,33 +212,23 @@ export default {
     "share-button": components.ShareButton
   },
   computed: {
-    stringInputs: function() {
-      return this.localFullExperiment.experiment.experimentInputs.filter(function (e) {
-          return e.type.value == 0
-      })
+    inputDataProducts() {
+      const result = {};
+      if (this.localFullExperiment && this.localFullExperiment.inputDataProducts)
{
+        this.localFullExperiment.experiment.experimentInputs.forEach(input => {
+          result[input.name] = this.getDataProducts(input, this.localFullExperiment.inputDataProducts);
+        });
+      }
+      return result;
     },
-    dataProductInputs: function(){
-      // Filters out only data products. These objects will contain
-      // name of the file and inputOrder also
-      var allFileInputs = this.localFullExperiment.experiment.experimentInputs.filter(function
(e) {
-            return e.type.value == 3;
-      });
-
-      // For each data product, find the "name" and "inputOrder" field for it
-      // from the array evaluated above. Product URI is used as a key to find
-      // matching data products (as it is unique to each file)
-      // Returns the array sorted by inputOrder in ascending order
-      var allDataProducts =  this.localFullExperiment.inputDataProducts.filter(function (dp)
{
-        for(var i = 0; i < allFileInputs.length; i++){
-          if(allFileInputs[i]["value"] == dp["productUri"]){
-            dp["name"] = allFileInputs[i]["name"]
-            dp["inputOrder"] = allFileInputs[i]["inputOrder"]
-          }
-        }
-        return dp
-      })
-
-      return sortByKey(allDataProducts, "inputOrder");
+    outputDataProducts() {
+      const result = {};
+      if (this.localFullExperiment && this.localFullExperiment.outputDataProducts)
{
+        this.localFullExperiment.experiment.experimentOutputs.forEach(output => {
+          result[output.name] = this.getDataProducts(output, this.localFullExperiment.outputDataProducts);
+        });
+      }
+      return result;
     },
     creationTime: function() {
       return moment(this.localFullExperiment.experiment.creationTime).fromNow();


Mime
View raw message