diff --git a/ui/src/views/image/TemplateZones.vue b/ui/src/views/image/TemplateZones.vue index 1c2e2b41c03..b0093452481 100644 --- a/ui/src/views/image/TemplateZones.vue +++ b/ui/src/views/image/TemplateZones.vue @@ -39,20 +39,12 @@ @click="showCopyTemplate(record)" /> - - - + @@ -75,7 +67,7 @@ :visible="showCopyActionForm" :closable="true" @ok="handleCopyTemplateSubmit" - @cancel="onCloseCopyForm" + @cancel="onCloseModal" :confirmLoading="copyLoading" centered> @@ -110,6 +102,22 @@ + + + + + + + + + @@ -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() }) })