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 d30077beb635aaa5d004f8bd7f2c6702f35b9837 Author: Marcus Christie <machr...@iu.edu> AuthorDate: Fri Nov 16 16:11:18 2018 -0500 AIRAVATA-2907 Delete storage prefs --- .../GatewayResourceProfileEditorContainer.vue | 12 +++++++++++- .../components/gatewayprofile/StoragePreferenceList.vue | 16 ++++++++++++++-- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/django_airavata/apps/admin/static/django_airavata_admin/src/components/gatewayprofile/GatewayResourceProfileEditorContainer.vue b/django_airavata/apps/admin/static/django_airavata_admin/src/components/gatewayprofile/GatewayResourceProfileEditorContainer.vue index 6f175ed..3e827c0 100644 --- a/django_airavata/apps/admin/static/django_airavata_admin/src/components/gatewayprofile/GatewayResourceProfileEditorContainer.vue +++ b/django_airavata/apps/admin/static/django_airavata_admin/src/components/gatewayprofile/GatewayResourceProfileEditorContainer.vue @@ -15,7 +15,7 @@ <div class="card-body"> <storage-preference-list v-if="gatewayResourceProfile" :storagePreferences="gatewayResourceProfile.storagePreferences" :default-credential-store-token="gatewayResourceProfile.credentialStoreToken" @updated="updatedStoragePreference" - @added="addedStoragePreference" /> + @added="addedStoragePreference" @delete="deleteStoragePreference" /> </div> </div> </div> @@ -88,6 +88,16 @@ export default { }).then(sp => { this.gatewayResourceProfile.storagePreferences.push(sp); }); + }, + deleteStoragePreference(storageResourceId) { + services.StoragePreferenceService.delete({ + lookup: storageResourceId + }).then(() => { + const index = this.gatewayResourceProfile.storagePreferences.findIndex( + sp => sp.storageResourceId === storageResourceId + ); + this.gatewayResourceProfile.storagePreferences.splice(index, 1); + }); } } }; diff --git a/django_airavata/apps/admin/static/django_airavata_admin/src/components/gatewayprofile/StoragePreferenceList.vue b/django_airavata/apps/admin/static/django_airavata_admin/src/components/gatewayprofile/StoragePreferenceList.vue index 00c259f..7ec5c1c 100644 --- a/django_airavata/apps/admin/static/django_airavata_admin/src/components/gatewayprofile/StoragePreferenceList.vue +++ b/django_airavata/apps/admin/static/django_airavata_admin/src/components/gatewayprofile/StoragePreferenceList.vue @@ -23,10 +23,13 @@ <b-table striped hover :fields="fields" :items="slotProps.items" sort-by="storageResourceId"> <template slot="action" slot-scope="data"> - <b-link @click="toggleDetails(data)"> + <b-link class="action-link" @click="toggleDetails(data)"> Edit <i class="fa fa-edit" aria-hidden="true"></i> </b-link> + <delete-link @delete="deleteStoragePreference(data.item.storageResourceId)"> + Are you sure you want to delete the storage preference for {{ getStorageResourceName(data.item.storageResourceId) }}? + </delete-link> </template> <template slot="row-details" slot-scope="row"> <b-card> @@ -42,12 +45,13 @@ <script> import { models, services, utils } from "django-airavata-api"; -import { layouts } from "django-airavata-common-ui"; +import { components, layouts } from "django-airavata-common-ui"; import StoragePreferenceEditor from "./StoragePreferenceEditor.vue"; export default { name: "storage-preference-list", components: { + "delete-link": components.DeleteLink, "list-layout": layouts.ListLayout, StoragePreferenceEditor }, @@ -172,6 +176,9 @@ export default { row.item.storageResourceId ]; }, + deleteStoragePreference(storageResourceId) { + this.$emit('delete', storageResourceId); + }, addNewStoragePreference() { this.newStoragePreference = new models.StoragePreference(); this.showNewItemEditor = true; @@ -187,3 +194,8 @@ export default { }; </script> +<style scoped> +.action-link { + white-space: nowrap; +} +</style>