diff --git a/app/javascript/dashboard/i18n/locale/en/integrations.json b/app/javascript/dashboard/i18n/locale/en/integrations.json
index 47349d1b1..9db2f0b96 100644
--- a/app/javascript/dashboard/i18n/locale/en/integrations.json
+++ b/app/javascript/dashboard/i18n/locale/en/integrations.json
@@ -8,7 +8,10 @@
"DISABLED": "Captain is not enabled on your account.",
"CLICK_HERE_TO_CONFIGURE": "Click here to configure",
"LOADING_CONSOLE": "Loading Captain Console...",
- "FAILED_TO_LOAD_CONSOLE": "Failed to load Captain Console. Please refresh and try again."
+ "FAILED_TO_LOAD_CONSOLE": "Failed to load Captain Console. Please refresh and try again.",
+ "ERRORS": {
+ "CREATE_INBOX_IDS": "Please select at least one inbox to enable Captain"
+ }
},
"WEBHOOK": {
"SUBSCRIBED_EVENTS": "Subscribed Events",
@@ -46,10 +49,7 @@
"LIST": {
"404": "There are no webhooks configured for this account.",
"TITLE": "Manage webhooks",
- "TABLE_HEADER": [
- "Webhook endpoint",
- "Actions"
- ]
+ "TABLE_HEADER": ["Webhook endpoint", "Actions"]
},
"EDIT": {
"BUTTON_TEXT": "Edit",
@@ -182,10 +182,7 @@
"LIST": {
"404": "There are no dashboard apps configured on this account yet",
"LOADING": "Fetching dashboard apps...",
- "TABLE_HEADER": [
- "Name",
- "Endpoint"
- ],
+ "TABLE_HEADER": ["Name", "Endpoint"],
"EDIT_TOOLTIP": "Edit app",
"DELETE_TOOLTIP": "Delete app"
},
diff --git a/app/javascript/dashboard/routes/dashboard/settings/integrations/NewHook.vue b/app/javascript/dashboard/routes/dashboard/settings/integrations/NewHook.vue
index 9f0b21515..04c9f2d7f 100644
--- a/app/javascript/dashboard/routes/dashboard/settings/integrations/NewHook.vue
+++ b/app/javascript/dashboard/routes/dashboard/settings/integrations/NewHook.vue
@@ -3,8 +3,14 @@
import { mapGetters } from 'vuex';
import { useAlert } from 'dashboard/composables';
import hookMixin from './hookMixin';
+import WithLabel from 'v3/components/Form/WithLabel.vue';
+import InboxFilter from 'dashboard/routes/dashboard/settings/reports/components/Filters/Inboxes.vue';
export default {
+ components: {
+ InboxFilter,
+ WithLabel,
+ },
mixins: [hookMixin],
props: {
integration: {
@@ -17,6 +23,7 @@ export default {
endPoint: '',
alertMessage: '',
values: {},
+ inboxIds: [],
};
},
computed: {
@@ -55,6 +62,9 @@ export default {
onClose() {
this.$emit('close');
},
+ setInboxes(selectedInboxes) {
+ this.inboxIds = selectedInboxes.map(inbox => inbox.id);
+ },
buildHookPayload() {
const hookPayload = {
app_id: this.integration.id,
@@ -76,6 +86,10 @@ export default {
}
});
+ if (this.isIntegrationCaptain) {
+ hookPayload.settings.inbox_ids = this.inboxIds;
+ }
+
if (this.isHookTypeInbox && this.values.inbox) {
hookPayload.inbox_id = this.values.inbox;
}
@@ -83,6 +97,14 @@ export default {
return hookPayload;
},
async submitForm() {
+ if (this.isIntegrationCaptain && !this.inboxIds.length) {
+ this.alertMessage = this.$t(
+ 'INTEGRATION_SETTINGS.CAPTAIN.ERRORS.CREATE_INBOX_IDS'
+ );
+ useAlert(this.alertMessage);
+ return;
+ }
+
try {
await this.$store.dispatch(
'integrations/createHook',
@@ -120,7 +142,7 @@ export default {
v-bind="item"
/>