feat: Clone automation rules (#3893)

Co-authored-by: Muhsin Keloth <muhsinkeramam@gmail.com>
This commit is contained in:
Fayaz Ahmed
2022-02-03 09:14:22 +05:30
committed by GitHub
parent 8821106da9
commit fc1f257793
6 changed files with 70 additions and 26 deletions

View File

@@ -54,17 +54,17 @@
@click="openEditPopup(automation)"
>
</woot-button>
<!-- <woot-button
v-tooltip.top="'Clone'"
<woot-button
v-tooltip.top="$t('AUTOMATION.CLONE.TOOLTIP')"
variant="smooth"
size="tiny"
color-scheme="primary"
class-names="grey-btn"
:is-loading="loading[automation.id]"
icon="copy"
@click="openEditPopup(automation)"
@click="cloneAutomation(automation.id)"
>
</woot-button> -->
</woot-button>
<woot-button
v-tooltip.top="$t('AUTOMATION.FORM.DELETE')"
variant="smooth"
@@ -204,6 +204,16 @@ export default {
this.showAlert(this.$t('AUTOMATION.DELETE.API.ERROR_MESSAGE'));
}
},
async cloneAutomation(id) {
try {
await this.$store.dispatch('automations/clone', id);
this.showAlert(this.$t('AUTOMATION.CLONE.API.SUCCESS_MESSAGE'));
this.$store.dispatch('automations/get');
this.loading[this.selectedResponse.id] = false;
} catch (error) {
this.showAlert(this.$t('AUTOMATION.CLONE.API.ERROR_MESSAGE'));
}
},
async submitAutomation(payload, mode) {
try {
const action =