You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by ma...@apache.org on 2020/05/26 19:36:14 UTC

[airavata-django-portal] branch develop updated: AIRAVATA-3334 allow passing through string type inputs

This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/develop by this push:
     new ce62839  AIRAVATA-3334 allow passing through string type inputs
     new f909337  Merge branch 'AIRAVATA-3334-allow-passing-data-product-uris-for-inputs-to-crea' into develop
ce62839 is described below

commit ce6283950bbfc855a81131316190bce646335a7d
Author: Marcus Christie <ma...@apache.org>
AuthorDate: Tue May 26 15:34:41 2020 -0400

    AIRAVATA-3334 allow passing through string type inputs
---
 .../js/containers/CreateExperimentContainer.vue              |  8 ++++----
 .../django_airavata_workspace/js/entry-create-experiment.js  |  8 ++++----
 .../django_airavata_workspace/create_experiment.html         |  2 +-
 django_airavata/apps/workspace/views.py                      | 12 ++++++++----
 4 files changed, 17 insertions(+), 13 deletions(-)

diff --git a/django_airavata/apps/workspace/static/django_airavata_workspace/js/containers/CreateExperimentContainer.vue b/django_airavata/apps/workspace/static/django_airavata_workspace/js/containers/CreateExperimentContainer.vue
index ff17345..a1c1600 100644
--- a/django_airavata/apps/workspace/static/django_airavata_workspace/js/containers/CreateExperimentContainer.vue
+++ b/django_airavata/apps/workspace/static/django_airavata_workspace/js/containers/CreateExperimentContainer.vue
@@ -20,7 +20,7 @@ import moment from "moment";
 
 export default {
   name: "create-experiment-container",
-  props: ["app-module-id", "user-input-files", "experiment-data-dir"],
+  props: ["app-module-id", "user-input-values", "experiment-data-dir"],
   data() {
     return {
       experiment: null,
@@ -56,13 +56,13 @@ export default {
         experiment.experimentName =
           appModule.appModuleName + " on " + moment().format("lll");
         this.appModule = appModule;
-        if (this.userInputFiles) {
-          Object.keys(this.userInputFiles).forEach(k => {
+        if (this.userInputValues) {
+          Object.keys(this.userInputValues).forEach(k => {
             const experimentInput = experiment.experimentInputs.find(
               inp => inp.name === k
             );
             if (experimentInput) {
-              experimentInput.value = this.userInputFiles[k];
+              experimentInput.value = this.userInputValues[k];
             }
           });
         }
diff --git a/django_airavata/apps/workspace/static/django_airavata_workspace/js/entry-create-experiment.js b/django_airavata/apps/workspace/static/django_airavata_workspace/js/entry-create-experiment.js
index 4f2e983..6cdd934 100644
--- a/django_airavata/apps/workspace/static/django_airavata_workspace/js/entry-create-experiment.js
+++ b/django_airavata/apps/workspace/static/django_airavata_workspace/js/entry-create-experiment.js
@@ -8,7 +8,7 @@ entry(Vue => {
         h(CreateExperimentContainer, {
           props: {
             appModuleId: this.appModuleId,
-            userInputFiles: this.userInputFiles,
+            userInputValues: this.userInputValues,
             experimentDataDir: this.experimentDataDir
           }
         })
@@ -17,15 +17,15 @@ entry(Vue => {
     data() {
       return {
         appModuleId: null,
-        userInputFiles: null
+        userInputValues: null
       };
     },
     beforeMount() {
       if (this.$el.dataset.appModuleId) {
         this.appModuleId = this.$el.dataset.appModuleId;
       }
-      if (this.$el.dataset.userInputFiles) {
-        this.userInputFiles = JSON.parse(this.$el.dataset.userInputFiles);
+      if (this.$el.dataset.userInputValues) {
+        this.userInputValues = JSON.parse(this.$el.dataset.userInputValues);
       }
       if (this.$el.dataset.experimentDataDir) {
         this.experimentDataDir = this.$el.dataset.experimentDataDir;
diff --git a/django_airavata/apps/workspace/templates/django_airavata_workspace/create_experiment.html b/django_airavata/apps/workspace/templates/django_airavata_workspace/create_experiment.html
index 08939a2..f618f18 100644
--- a/django_airavata/apps/workspace/templates/django_airavata_workspace/create_experiment.html
+++ b/django_airavata/apps/workspace/templates/django_airavata_workspace/create_experiment.html
@@ -2,7 +2,7 @@
 
 {% block content %}
 
-<div id="{{ bundle_name }}" data-app-module-id="{{ app_module_id }}" data-user-input-files="{{ user_input_files }}"
+<div id="{{ bundle_name }}" data-app-module-id="{{ app_module_id }}" data-user-input-values="{{ user_input_values }}"
   {% if experiment_data_dir %}data-experiment-data-dir="{{ experiment_data_dir }}"{% endif %}
 >
 </div>
diff --git a/django_airavata/apps/workspace/views.py b/django_airavata/apps/workspace/views.py
index c0da11e..4d3289f 100644
--- a/django_airavata/apps/workspace/views.py
+++ b/django_airavata/apps/workspace/views.py
@@ -82,7 +82,7 @@ def create_experiment(request, app_module_id):
     if app_interface.status_code != 200:
         raise Exception("Failed to load application module data: {}".format(
             app_interface.data['detail']))
-    user_input_files = {}
+    user_input_values = {}
     for app_input in app_interface.data['applicationInputs']:
         if (app_input['type'] ==
                 DataType.URI and app_input['name'] in request.GET):
@@ -95,7 +95,7 @@ def create_experiment(request, app_module_id):
                         data_product = request.airavata_client.getDataProduct(
                             request.authz_token, dp_uri)
                         if data_products_helper.exists(request, data_product):
-                            user_input_files[app_input['name']] = dp_uri
+                            user_input_values[app_input['name']] = dp_uri
                     except Exception as e:
                         logger.exception(
                             "Failed checking data product uri: {dp_uri}")
@@ -103,13 +103,17 @@ def create_experiment(request, app_module_id):
                     data_product_uri = data_products_helper.user_file_exists(
                         request, user_file_url.path)
                     if data_product_uri is not None:
-                        user_input_files[app_input['name']] = data_product_uri
+                        user_input_values[app_input['name']] = data_product_uri
             except ValueError as e:
                 logger.exception(f"Invalid user file value: {user_file_value}")
+        elif (app_input['type'] == DataType.STRING and
+              app_input['name'] in request.GET):
+            name = app_input['name']
+            user_input_values[name] = request.GET[name]
     context = {
         'bundle_name': 'create-experiment',
         'app_module_id': app_module_id,
-        'user_input_files': json.dumps(user_input_files)
+        'user_input_values': json.dumps(user_input_values)
     }
     if 'experiment-data-dir' in request.GET:
         context['experiment_data_dir'] = request.GET['experiment-data-dir']