mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
template: Force delete template missing (#399)
Fixes #384 Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com> Co-authored-by: Rohit Yadav <rohit.yadav@shapeblue.com>
This commit is contained in:
parent
39bf93cf8e
commit
3587c9f142
@ -39,20 +39,12 @@
|
|||||||
@click="showCopyTemplate(record)" />
|
@click="showCopyTemplate(record)" />
|
||||||
</span>
|
</span>
|
||||||
<span style="margin-right: 5px">
|
<span style="margin-right: 5px">
|
||||||
<a-popconfirm
|
<a-button
|
||||||
v-if="'deleteTemplate' in $store.getters.apis"
|
:disabled="!('deleteTemplate' in $store.getters.apis)"
|
||||||
placement="topRight"
|
type="danger"
|
||||||
:title="$t('message.action.delete.template')"
|
icon="delete"
|
||||||
:ok-text="$t('label.yes')"
|
shape="circle"
|
||||||
:cancel-text="$t('label.no')"
|
@click="onShowDeleteModal(record)"/>
|
||||||
:loading="deleteLoading"
|
|
||||||
@confirm="deleteTemplate(record)"
|
|
||||||
>
|
|
||||||
<a-button
|
|
||||||
type="danger"
|
|
||||||
icon="delete"
|
|
||||||
shape="circle" />
|
|
||||||
</a-popconfirm>
|
|
||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
</a-table>
|
</a-table>
|
||||||
@ -75,7 +67,7 @@
|
|||||||
:visible="showCopyActionForm"
|
:visible="showCopyActionForm"
|
||||||
:closable="true"
|
:closable="true"
|
||||||
@ok="handleCopyTemplateSubmit"
|
@ok="handleCopyTemplateSubmit"
|
||||||
@cancel="onCloseCopyForm"
|
@cancel="onCloseModal"
|
||||||
:confirmLoading="copyLoading"
|
:confirmLoading="copyLoading"
|
||||||
centered>
|
centered>
|
||||||
<a-spin :spinning="copyLoading">
|
<a-spin :spinning="copyLoading">
|
||||||
@ -110,6 +102,22 @@
|
|||||||
</a-form>
|
</a-form>
|
||||||
</a-spin>
|
</a-spin>
|
||||||
</a-modal>
|
</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>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -141,7 +149,9 @@ export default {
|
|||||||
zones: [],
|
zones: [],
|
||||||
zoneLoading: false,
|
zoneLoading: false,
|
||||||
copyLoading: false,
|
copyLoading: false,
|
||||||
deleteLoading: false
|
deleteLoading: false,
|
||||||
|
showDeleteTemplate: false,
|
||||||
|
forcedDelete: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
beforeCreate () {
|
beforeCreate () {
|
||||||
@ -217,10 +227,11 @@ export default {
|
|||||||
this.pageSize = pageSize
|
this.pageSize = pageSize
|
||||||
this.fetchData()
|
this.fetchData()
|
||||||
},
|
},
|
||||||
deleteTemplate (record) {
|
deleteTemplate () {
|
||||||
const params = {
|
const params = {
|
||||||
id: record.id,
|
id: this.currentRecord.id,
|
||||||
zoneid: record.zoneid
|
forced: this.forcedDelete,
|
||||||
|
zoneid: this.currentRecord.zoneid
|
||||||
}
|
}
|
||||||
this.deleteLoading = true
|
this.deleteLoading = true
|
||||||
api('deleteTemplate', params).then(json => {
|
api('deleteTemplate', params).then(json => {
|
||||||
@ -249,6 +260,7 @@ export default {
|
|||||||
this.$notifyError(error)
|
this.$notifyError(error)
|
||||||
}).finally(() => {
|
}).finally(() => {
|
||||||
this.deleteLoading = false
|
this.deleteLoading = false
|
||||||
|
this.onCloseModal()
|
||||||
this.fetchData()
|
this.fetchData()
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
@ -270,9 +282,15 @@ export default {
|
|||||||
this.fetchZoneData()
|
this.fetchZoneData()
|
||||||
this.showCopyActionForm = true
|
this.showCopyActionForm = true
|
||||||
},
|
},
|
||||||
onCloseCopyForm () {
|
onShowDeleteModal (record) {
|
||||||
|
this.forcedDelete = false
|
||||||
|
this.currentRecord = record
|
||||||
|
this.showDeleteTemplate = true
|
||||||
|
},
|
||||||
|
onCloseModal () {
|
||||||
this.currentRecord = {}
|
this.currentRecord = {}
|
||||||
this.showCopyActionForm = false
|
this.showCopyActionForm = false
|
||||||
|
this.showDeleteTemplate = false
|
||||||
},
|
},
|
||||||
handleCopyTemplateSubmit (e) {
|
handleCopyTemplateSubmit (e) {
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
@ -311,7 +329,7 @@ export default {
|
|||||||
}).finally(() => {
|
}).finally(() => {
|
||||||
this.copyLoading = false
|
this.copyLoading = false
|
||||||
this.$emit('refresh-data')
|
this.$emit('refresh-data')
|
||||||
this.onCloseCopyForm()
|
this.onCloseModal()
|
||||||
this.fetchData()
|
this.fetchData()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user