airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From machris...@apache.org
Subject [airavata-django-portal] 06/28: AIRAVATA-2876 Application module editor, save and cancel
Date Tue, 11 Sep 2018 17:11:54 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 34f351af74292eb6741aaaef0b99395770d789fb
Author: Marcus Christie <machrist@iu.edu>
AuthorDate: Wed Aug 29 14:01:40 2018 -0400

    AIRAVATA-2876 Application module editor, save and cancel
---
 .../applications/ApplicationEditorContainer.vue    | 15 +++++-
 .../applications/ApplicationModuleEditor.vue       | 61 +++++++++++++++++++++-
 2 files changed, 73 insertions(+), 3 deletions(-)

diff --git a/django_airavata/apps/admin/static/django_airavata_admin/src/components/applications/ApplicationEditorContainer.vue
b/django_airavata/apps/admin/static/django_airavata_admin/src/components/applications/ApplicationEditorContainer.vue
index f0badb4..21ec362 100644
--- a/django_airavata/apps/admin/static/django_airavata_admin/src/components/applications/ApplicationEditorContainer.vue
+++ b/django_airavata/apps/admin/static/django_airavata_admin/src/components/applications/ApplicationEditorContainer.vue
@@ -14,7 +14,7 @@
                     <b-nav-item exact-active-class="active" exact :to="{name: 'application_interface',
params: {id: id}}" :disabled="!id">Interface</b-nav-item>
                     <b-nav-item active-class="active" :to="{name: 'application_deployments',
params: {id: id}}" :disabled="!id">Deployments</b-nav-item>
                 </b-nav>
-                <router-view name="module"/>
+                <router-view name="module" v-if="module" v-model="module" @save="saveModule"
@cancel="cancelModule"/>
                 <router-view name="interface"/>
                 <router-view name="deployments"/>
                 <router-view name="deployment"/>
@@ -65,6 +65,19 @@ export default {
             } else {
                 this.module = new models.ApplicationModule();
             }
+        },
+        saveModule() {
+            if (this.id) {
+                this.updateApplicationModule(this.module)
+                    .then(() => {
+                        this.$router.push({path: '/applications'});
+                    });
+            } else {
+                this.createApplicationModule(this.module)
+                    .then(appModule => {
+                        this.$router.push({name: 'application', params: {id: appModule.appModuleId}});
+                    });
+            }
         }
     },
     watch: {
diff --git a/django_airavata/apps/admin/static/django_airavata_admin/src/components/applications/ApplicationModuleEditor.vue
b/django_airavata/apps/admin/static/django_airavata_admin/src/components/applications/ApplicationModuleEditor.vue
index fcc70a9..9f929ff 100644
--- a/django_airavata/apps/admin/static/django_airavata_admin/src/components/applications/ApplicationModuleEditor.vue
+++ b/django_airavata/apps/admin/static/django_airavata_admin/src/components/applications/ApplicationModuleEditor.vue
@@ -1,10 +1,67 @@
 <template>
-    <div>Application Module Editor</div>
+    <div>
+        <div class="row">
+            <div class="col">
+                <h1 class="h4 mb-4">
+                    Application Details
+                </h1>
+                <b-form-group label="Application Name" label-for="application-name">
+                    <b-form-input id="application-name"
+                    type="text" v-model="appModule.appModuleName" required
+                    @input="emitChanged"></b-form-input>
+                </b-form-group>
+                <b-form-group label="Application Version" label-for="application-version">
+                    <b-form-input id="application-version"
+                    type="text" v-model="appModule.appModuleVersion"
+                    @input="emitChanged"></b-form-input>
+                </b-form-group>
+                <b-form-group label="Application Description" label-for="application-description">
+                    <b-form-textarea id="application-description"
+                        v-model="appModule.appModuleDescription"
+                        :rows="3"></b-form-textarea>
+                </b-form-group>
+            </div>
+        </div>
+        <div class="row">
+            <div class="col">
+                <b-button variant="primary" @click="save">
+                    Save
+                </b-button>
+                <b-button variant="secondary" @click="cancel">
+                    Cancel
+                </b-button>
+            </div>
+        </div>
+    </div>
 </template>
 
 <script>
+import {models} from 'django-airavata-api'
+
 export default {
-    name: 'application-module-editor'
+    name: 'application-module-editor',
+    props: {
+        value: {
+            type: models.ApplicationModule,
+            required: true,
+        }
+    },
+    data: function() {
+        return {
+            appModule: this.value.clone(),
+        }
+    },
+    methods: {
+        emitChanged() {
+            this.$emit('input', this.appModule);
+        },
+        save() {
+            this.$emit('save');
+        },
+        cancel() {
+            this.$emit('cancel');
+        }
+    }
 }
 </script>
 


Mime
View raw message