You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ro...@apache.org on 2020/06/14 01:16:06 UTC
[cloudstack-primate] branch master updated: template: Force delete
template missing (#399)
This is an automated email from the ASF dual-hosted git repository.
rohit pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cloudstack-primate.git
The following commit(s) were added to refs/heads/master by this push:
new ee5a1a9 template: Force delete template missing (#399)
ee5a1a9 is described below
commit ee5a1a9792ab8f1a1c23e67cc676570b01f832c9
Author: Hoang Nguyen <ho...@unitech.vn>
AuthorDate: Sun Jun 14 08:16:01 2020 +0700
template: Force delete template missing (#399)
Fixes #384
Signed-off-by: Rohit Yadav <ro...@shapeblue.com>
Co-authored-by: Rohit Yadav <ro...@shapeblue.com>
---
src/views/image/TemplateZones.vue | 60 +++++++++++++++++++++++++--------------
1 file changed, 39 insertions(+), 21 deletions(-)
diff --git a/src/views/image/TemplateZones.vue b/src/views/image/TemplateZones.vue
index 1c2e2b4..b009345 100644
--- a/src/views/image/TemplateZones.vue
+++ b/src/views/image/TemplateZones.vue
@@ -39,20 +39,12 @@
@click="showCopyTemplate(record)" />
</span>
<span style="margin-right: 5px">
- <a-popconfirm
- v-if="'deleteTemplate' in $store.getters.apis"
- placement="topRight"
- :title="$t('message.action.delete.template')"
- :ok-text="$t('label.yes')"
- :cancel-text="$t('label.no')"
- :loading="deleteLoading"
- @confirm="deleteTemplate(record)"
- >
- <a-button
- type="danger"
- icon="delete"
- shape="circle" />
- </a-popconfirm>
+ <a-button
+ :disabled="!('deleteTemplate' in $store.getters.apis)"
+ type="danger"
+ icon="delete"
+ shape="circle"
+ @click="onShowDeleteModal(record)"/>
</span>
</template>
</a-table>
@@ -75,7 +67,7 @@
:visible="showCopyActionForm"
:closable="true"
@ok="handleCopyTemplateSubmit"
- @cancel="onCloseCopyForm"
+ @cancel="onCloseModal"
:confirmLoading="copyLoading"
centered>
<a-spin :spinning="copyLoading">
@@ -110,6 +102,22 @@
</a-form>
</a-spin>
</a-modal>
+
+ <a-modal
+ :title="$t('label.action.delete.template')"
+ :visible="showDeleteTemplate"
+ :closable="true"
+ @ok="deleteTemplate"
+ @cancel="onCloseModal"
+ :confirmLoading="deleteLoading"
+ centered>
+ <a-spin :spinning="deleteLoading">
+ <a-alert :message="$t('message.action.delete.template')" type="warning" />
+ <a-form-item :label="$t('label.isforced')" style="margin-bottom: 0;">
+ <a-switch v-model="forcedDelete"></a-switch>
+ </a-form-item>
+ </a-spin>
+ </a-modal>
</div>
</template>
@@ -141,7 +149,9 @@ export default {
zones: [],
zoneLoading: false,
copyLoading: false,
- deleteLoading: false
+ deleteLoading: false,
+ showDeleteTemplate: false,
+ forcedDelete: false
}
},
beforeCreate () {
@@ -217,10 +227,11 @@ export default {
this.pageSize = pageSize
this.fetchData()
},
- deleteTemplate (record) {
+ deleteTemplate () {
const params = {
- id: record.id,
- zoneid: record.zoneid
+ id: this.currentRecord.id,
+ forced: this.forcedDelete,
+ zoneid: this.currentRecord.zoneid
}
this.deleteLoading = true
api('deleteTemplate', params).then(json => {
@@ -249,6 +260,7 @@ export default {
this.$notifyError(error)
}).finally(() => {
this.deleteLoading = false
+ this.onCloseModal()
this.fetchData()
})
},
@@ -270,9 +282,15 @@ export default {
this.fetchZoneData()
this.showCopyActionForm = true
},
- onCloseCopyForm () {
+ onShowDeleteModal (record) {
+ this.forcedDelete = false
+ this.currentRecord = record
+ this.showDeleteTemplate = true
+ },
+ onCloseModal () {
this.currentRecord = {}
this.showCopyActionForm = false
+ this.showDeleteTemplate = false
},
handleCopyTemplateSubmit (e) {
e.preventDefault()
@@ -311,7 +329,7 @@ export default {
}).finally(() => {
this.copyLoading = false
this.$emit('refresh-data')
- this.onCloseCopyForm()
+ this.onCloseModal()
this.fetchData()
})
})