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 6b5f885fc14bea93165f872e1d0b85230641dbce
Author: Marcus Christie <[email protected]>
AuthorDate: Wed Jul 24 11:22:33 2019 -0400

    AIRAVATA-3177 Disable new deployment button for readonly admin
---
 .../src/components/applications/ApplicationDeploymentsList.vue    | 8 ++++++--
 .../src/components/applications/ApplicationEditorContainer.vue    | 2 +-
 django_airavata/static/common/js/layouts/ListLayout.vue           | 6 +++++-
 3 files changed, 12 insertions(+), 4 deletions(-)

diff --git 
a/django_airavata/apps/admin/static/django_airavata_admin/src/components/applications/ApplicationDeploymentsList.vue
 
b/django_airavata/apps/admin/static/django_airavata_admin/src/components/applications/ApplicationDeploymentsList.vue
index 0ea4fab..4fcfbdb 100644
--- 
a/django_airavata/apps/admin/static/django_airavata_admin/src/components/applications/ApplicationDeploymentsList.vue
+++ 
b/django_airavata/apps/admin/static/django_airavata_admin/src/components/applications/ApplicationDeploymentsList.vue
@@ -1,6 +1,6 @@
 <template>
   <div>
-    <list-layout @add-new-item="newApplicationDeployment" :items="deployments" 
title="Application Deployments" new-item-button-text="New Deployment">
+    <list-layout @add-new-item="newApplicationDeployment" :items="deployments" 
title="Application Deployments" new-item-button-text="New Deployment" 
:new-button-disabled="readonly">
       <template slot="item-list" slot-scope="slotProps">
 
         <b-table striped hover :fields="fields" :items="slotProps.items" 
sort-by="computeHostId">
@@ -50,7 +50,11 @@ export default {
       // app module id
       type: String,
       required: true
-    }
+    },
+    readonly: {
+      type: Boolean,
+      default: false
+    },
   },
   data() {
     return {
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 c7a7400..e1eb75b 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
@@ -22,7 +22,7 @@
           :validation-errors="appModuleValidationErrors" />
         <router-view name="interface" v-if="appInterface" 
v-model="appInterface" @input="appInterfaceIsDirty = true" 
:readonly="!appInterface.userHasWriteAccess"
         />
-        <router-view name="deployments" v-if="appDeployments" 
:deployments="appDeployments" @new="createNewDeployment" 
@delete="deleteApplicationDeployment"
+        <router-view name="deployments" v-if="appModule && appDeployments" 
:deployments="appDeployments" @new="createNewDeployment" 
@delete="deleteApplicationDeployment" :readonly="!appModule.userHasWriteAccess"
         />
         <router-view name="deployment" v-if="currentDeployment && 
currentDeploymentSharedEntity" v-model="currentDeployment" 
:shared-entity="currentDeploymentSharedEntity"
           @sharing-changed="deploymentSharingChanged" 
@input="currentDeploymentChanged" />
diff --git a/django_airavata/static/common/js/layouts/ListLayout.vue 
b/django_airavata/static/common/js/layouts/ListLayout.vue
index 69f5bbf..d94628f 100644
--- a/django_airavata/static/common/js/layouts/ListLayout.vue
+++ b/django_airavata/static/common/js/layouts/ListLayout.vue
@@ -8,7 +8,7 @@
       </div>
       <div class="col-auto">
         <slot name="new-item-button">
-          <b-btn variant="primary" @click="addNewItem">
+          <b-btn variant="primary" @click="addNewItem" 
:disabled="newButtonDisabled">
             {{ newItemButtonText }}
             <i class="fa fa-plus" aria-hidden="true"></i>
           </b-btn>
@@ -52,6 +52,10 @@ export default {
     newItemButtonText: {
       type: String,
       default: "New Item"
+    },
+    newButtonDisabled: {
+      type: Boolean,
+      default: false
     }
   },
   name: "list-layout",

Reply via email to