Handle Edge cases

This commit is contained in:
fayazara 2022-09-27 13:19:54 +05:30
parent 34700d508d
commit 76a878c0ef
2 changed files with 29 additions and 17 deletions

View file

@ -39,7 +39,13 @@ export default {
mounted() { mounted() {
const { team_ids: teamIds } = this.value; const { team_ids: teamIds } = this.value;
if (teamIds) { if (teamIds) {
this.selectedTeams = this.teams.filter(team => teamIds.includes(team.id)); if (typeof teamIds[0] !== 'object') {
this.selectedTeams = this.teams.filter(team =>
teamIds.includes(team.id)
);
} else {
this.selectedTeams = teamIds;
}
} }
this.message = this.value.message; this.message = this.value.message;
}, },

View file

@ -231,9 +231,10 @@ export default {
uiFlags: 'macros/getUIFlags', uiFlags: 'macros/getUIFlags',
}), }),
macroActionTypes() { macroActionTypes() {
// Because we do not support attachments in macros - yet! // Because we do not support attachments and email transcripts in macros - yet!
const itemsToRemove = ['send_attachment', 'send_email_transcript'];
return AUTOMATION_ACTION_TYPES.filter( return AUTOMATION_ACTION_TYPES.filter(
obj => obj.key !== 'send_attachment' item => !itemsToRemove.includes(item.key)
); );
}, },
macroId() { macroId() {
@ -241,10 +242,14 @@ export default {
}, },
}, },
watch: { watch: {
'$route.params.macroId': { $route: {
handler() { handler() {
this.$v.$reset(); this.$v.$reset();
if (this.$route.params.macroId) {
this.fetchMacro(); this.fetchMacro();
} else {
this.initializeMacro();
}
}, },
immediate: true, immediate: true,
}, },
@ -363,7 +368,9 @@ export default {
this.$store.dispatch('teams/get'); this.$store.dispatch('teams/get');
this.$store.dispatch('labels/get'); this.$store.dispatch('labels/get');
this.manifestMacro(); this.manifestMacro();
} else { }
},
initializeMacro() {
this.mode = 'CREATE'; this.mode = 'CREATE';
this.macro = { this.macro = {
name: '', name: '',
@ -375,7 +382,6 @@ export default {
], ],
visibility: 'global', visibility: 'global',
}; };
}
}, },
isActive(key) { isActive(key) {
return { active: this.macro.visibility === key }; return { active: this.macro.visibility === key };