[editor] [#23] Add confirmation for delete buttons
resolves #23 Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
parent
e1a947494b
commit
05064b08b3
2 changed files with 38 additions and 8 deletions
|
@ -352,11 +352,26 @@ export default {
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
deleteAutoMessage(uuid) {
|
deleteAutoMessage(uuid) {
|
||||||
axios.delete(`config-editor/auto-messages/${uuid}`, this.$root.axiosOptions)
|
this.$bvModal.msgBoxConfirm('Do you really want to delete this message?', {
|
||||||
.then(() => {
|
buttonSize: 'sm',
|
||||||
this.$bus.$emit(constants.NOTIFY_CHANGE_PENDING, true)
|
cancelTitle: 'NO',
|
||||||
|
centered: true,
|
||||||
|
okTitle: 'YES',
|
||||||
|
okVariant: 'danger',
|
||||||
|
size: 'sm',
|
||||||
|
title: 'Please Confirm',
|
||||||
|
})
|
||||||
|
.then(val => {
|
||||||
|
if (!val) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
return axios.delete(`config-editor/auto-messages/${uuid}`, this.$root.axiosOptions)
|
||||||
|
.then(() => {
|
||||||
|
this.$bus.$emit(constants.NOTIFY_CHANGE_PENDING, true)
|
||||||
|
})
|
||||||
|
.catch(err => this.$bus.$emit(constants.NOTIFY_FETCH_ERROR, err))
|
||||||
})
|
})
|
||||||
.catch(err => this.$bus.$emit(constants.NOTIFY_FETCH_ERROR, err))
|
|
||||||
},
|
},
|
||||||
|
|
||||||
editAutoMessage(msg) {
|
editAutoMessage(msg) {
|
||||||
|
|
|
@ -657,11 +657,26 @@ export default {
|
||||||
},
|
},
|
||||||
|
|
||||||
deleteRule(uuid) {
|
deleteRule(uuid) {
|
||||||
axios.delete(`config-editor/rules/${uuid}`, this.$root.axiosOptions)
|
this.$bvModal.msgBoxConfirm('Do you really want to delete this rule?', {
|
||||||
.then(() => {
|
buttonSize: 'sm',
|
||||||
this.$bus.$emit(constants.NOTIFY_CHANGE_PENDING, true)
|
cancelTitle: 'NO',
|
||||||
|
centered: true,
|
||||||
|
okTitle: 'YES',
|
||||||
|
okVariant: 'danger',
|
||||||
|
size: 'sm',
|
||||||
|
title: 'Please Confirm',
|
||||||
|
})
|
||||||
|
.then(val => {
|
||||||
|
if (!val) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
return axios.delete(`config-editor/rules/${uuid}`, this.$root.axiosOptions)
|
||||||
|
.then(() => {
|
||||||
|
this.$bus.$emit(constants.NOTIFY_CHANGE_PENDING, true)
|
||||||
|
})
|
||||||
|
.catch(err => this.$bus.$emit(constants.NOTIFY_FETCH_ERROR, err))
|
||||||
})
|
})
|
||||||
.catch(err => this.$bus.$emit(constants.NOTIFY_FETCH_ERROR, err))
|
|
||||||
},
|
},
|
||||||
|
|
||||||
editRule(msg) {
|
editRule(msg) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue