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/02: AIRAVATA-2598 load application and use app name to set initial exp name
Date Fri, 01 Dec 2017 21:58:30 GMT
This is an automated email from the ASF dual-hosted git repository.

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

commit 0744336833cb8fdbc60e2b43227fb48d8c1438cc
Author: Marcus Christie <machrist@iu.edu>
AuthorDate: Fri Dec 1 16:55:31 2017 -0500

    AIRAVATA-2598 load application and use app name to set initial exp name
---
 .../js/services/ApplicationModuleService.js                 |  5 +++--
 .../django_airavata_workspace/js/entry-create-experiment.js |  9 ++++++++-
 .../js/views/CreateExperimentContainer.vue                  | 13 +++++++++++--
 .../django_airavata_workspace/create_experiment.html        |  2 +-
 django_airavata/apps/workspace/views.py                     |  4 +++-
 5 files changed, 26 insertions(+), 7 deletions(-)

diff --git a/django_airavata/apps/api/static/django_airavata_api/js/services/ApplicationModuleService.js
b/django_airavata/apps/api/static/django_airavata_api/js/services/ApplicationModuleService.js
index 46637e7..f433412 100644
--- a/django_airavata/apps/api/static/django_airavata_api/js/services/ApplicationModuleService.js
+++ b/django_airavata/apps/api/static/django_airavata_api/js/services/ApplicationModuleService.js
@@ -20,8 +20,9 @@ class ApplicationModuleService {
         // TODO
     }
 
-    get() {
-        // TODO
+    get(appModuleId) {
+        return FetchUtils.get('/api/applications/' + encodeURIComponent(appModuleId))
+            .then(json => new ApplicationModule(json))
     }
 }
 
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 bd277fa..867e528 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
@@ -10,10 +10,17 @@ Vue.use(BootstrapVue);
 
 new Vue({
   el: '#create-experiment',
-  template: '<create-experiment-container></create-experiment-container>',
+  template: '<create-experiment-container v-bind:appModuleId="appModuleId"></create-experiment-container>',
   data: {
+      appModuleId: null,
   },
   components: {
       CreateExperimentContainer,
+  },
+  beforeMount: function () {
+      if (this.$el.dataset.appModuleId) {
+          this.appModuleId = this.$el.dataset.appModuleId;
+      }
   }
+
 })
diff --git a/django_airavata/apps/workspace/static/django_airavata_workspace/js/views/CreateExperimentContainer.vue
b/django_airavata/apps/workspace/static/django_airavata_workspace/js/views/CreateExperimentContainer.vue
index c3b33ce..d9e7fcb 100644
--- a/django_airavata/apps/workspace/static/django_airavata_workspace/js/views/CreateExperimentContainer.vue
+++ b/django_airavata/apps/workspace/static/django_airavata_workspace/js/views/CreateExperimentContainer.vue
@@ -7,8 +7,13 @@
 import {models, services} from 'django-airavata-api'
 import ExperimentEditor from './ExperimentEditor.vue'
 
+import moment from 'moment';
+
 export default {
     name: 'create-experiment-container',
+    props: [
+        'app-module-id',
+    ],
     data () {
         return {
             'experiment': new models.Experiment(),
@@ -21,8 +26,12 @@ export default {
     },
     computed: {
     },
-    beforeMount: function () {
-        this.experiment.experimentName = 'XX Exp Name';
+    mounted: function () {
+        // TODO: integrate loading spinner
+        services.ApplicationModuleService.get(this.appModuleId)
+            .then(appModule => {
+                this.experiment.experimentName = appModule.appModuleName + ' ' + moment().format('lll');
+            });
     }
 }
 </script>
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 407b2e9..c1dbb11 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
@@ -9,7 +9,7 @@
 
 {% block content %}
 
-<div id="create-experiment"></div>
+<div id="create-experiment" data-app-module-id="{{ app_module_id }}"></div>
 
 {% endblock content %}
 
diff --git a/django_airavata/apps/workspace/views.py b/django_airavata/apps/workspace/views.py
index 23cd944..74c6b9f 100644
--- a/django_airavata/apps/workspace/views.py
+++ b/django_airavata/apps/workspace/views.py
@@ -36,4 +36,6 @@ def projects_list(request):
 def create_experiment(request, app_module_id):
     request.active_nav_item = 'dashboard'
 
-    return render(request, 'django_airavata_workspace/create_experiment.html')
+    return render(request, 'django_airavata_workspace/create_experiment.html', {
+        'app_module_id': app_module_id
+    })

-- 
To stop receiving notification emails like this one, please contact
"commits@airavata.apache.org" <commits@airavata.apache.org>.

Mime
View raw message