diff --git a/app/javascript/dashboard/components/widgets/ShowMore.vue b/app/javascript/dashboard/components/widgets/ShowMore.vue index c17c32e2a..37e2f9a68 100644 --- a/app/javascript/dashboard/components/widgets/ShowMore.vue +++ b/app/javascript/dashboard/components/widgets/ShowMore.vue @@ -1,38 +1,34 @@ - @@ -41,16 +37,10 @@ export default { {{ textToBeDisplayed }} - - diff --git a/app/javascript/dashboard/helper/featureHelper.js b/app/javascript/dashboard/helper/featureHelper.js index b4d131ce4..529c0a44e 100644 --- a/app/javascript/dashboard/helper/featureHelper.js +++ b/app/javascript/dashboard/helper/featureHelper.js @@ -17,6 +17,7 @@ const FEATURE_HELP_URLS = { reports: 'https://chwt.app/hc/reports', sla: 'https://chwt.app/hc/sla', team_management: 'https://chwt.app/hc/teams', + webhook: 'https://chwt.app/hc/webhooks', }; export function getHelpUrlForFeature(featureName) { diff --git a/app/javascript/dashboard/i18n/locale/en/integrations.json b/app/javascript/dashboard/i18n/locale/en/integrations.json index 47349d1b1..f478b71b4 100644 --- a/app/javascript/dashboard/i18n/locale/en/integrations.json +++ b/app/javascript/dashboard/i18n/locale/en/integrations.json @@ -12,6 +12,7 @@ }, "WEBHOOK": { "SUBSCRIBED_EVENTS": "Subscribed Events", + "LEARN_MORE": "Learn more about webhooks", "FORM": { "CANCEL": "Cancel", "DESC": "Webhook events provide you the realtime information about what's happening in your Chatwoot account. Please enter a valid URL to configure a callback.", diff --git a/app/javascript/dashboard/routes/dashboard/settings/attributes/CustomAttribute.vue b/app/javascript/dashboard/routes/dashboard/settings/attributes/CustomAttribute.vue index e5e85cdd1..9e55c619d 100644 --- a/app/javascript/dashboard/routes/dashboard/settings/attributes/CustomAttribute.vue +++ b/app/javascript/dashboard/routes/dashboard/settings/attributes/CustomAttribute.vue @@ -2,7 +2,7 @@ import { useAlert } from 'dashboard/composables'; import EditAttribute from './EditAttribute.vue'; import { useStoreGetters, useStore } from 'dashboard/composables/store'; -import { computed, onMounted, ref } from 'vue'; +import { computed, ref } from 'vue'; import { useI18n } from 'dashboard/composables/useI18n'; const props = defineProps({ attributeModel: { diff --git a/app/javascript/dashboard/routes/dashboard/settings/integrations/Webhooks/Index.vue b/app/javascript/dashboard/routes/dashboard/settings/integrations/Webhooks/Index.vue index e9ec855dc..23d0baa9c 100644 --- a/app/javascript/dashboard/routes/dashboard/settings/integrations/Webhooks/Index.vue +++ b/app/javascript/dashboard/routes/dashboard/settings/integrations/Webhooks/Index.vue @@ -3,16 +3,18 @@ import { mapGetters } from 'vuex'; import { useAlert } from 'dashboard/composables'; import NewWebhook from './NewWebHook.vue'; import EditWebhook from './EditWebHook.vue'; -import globalConfigMixin from 'shared/mixins/globalConfigMixin'; import WebhookRow from './WebhookRow.vue'; +import BaseSettingsHeader from '../../components/BaseSettingsHeader.vue'; +import SettingsLayout from '../../SettingsLayout.vue'; export default { components: { + SettingsLayout, + BaseSettingsHeader, NewWebhook, EditWebhook, WebhookRow, }, - mixins: [globalConfigMixin], data() { return { loading: {}, @@ -26,8 +28,10 @@ export default { ...mapGetters({ records: 'webhooks/getWebhooks', uiFlags: 'webhooks/getUIFlags', - globalConfig: 'globalConfig/get', }), + integration() { + return this.$store.getters['integrations/getIntegration']('webhook'); + }, }, mounted() { this.$store.dispatch('webhooks/get'); @@ -75,69 +79,59 @@ export default { diff --git a/app/javascript/dashboard/routes/dashboard/settings/integrations/Webhooks/WebhookForm.vue b/app/javascript/dashboard/routes/dashboard/settings/integrations/Webhooks/WebhookForm.vue index d399adbdd..f5fbc6a3d 100644 --- a/app/javascript/dashboard/routes/dashboard/settings/integrations/Webhooks/WebhookForm.vue +++ b/app/javascript/dashboard/routes/dashboard/settings/integrations/Webhooks/WebhookForm.vue @@ -1,8 +1,8 @@ @@ -105,10 +105,10 @@ export default { type="checkbox" :value="event" name="subscriptions" - class="checkbox" + class="mr-2" /> @@ -129,9 +129,3 @@ export default { - - diff --git a/app/javascript/dashboard/routes/dashboard/settings/integrations/Webhooks/WebhookRow.vue b/app/javascript/dashboard/routes/dashboard/settings/integrations/Webhooks/WebhookRow.vue index 20e6d6c1a..447913ecb 100644 --- a/app/javascript/dashboard/routes/dashboard/settings/integrations/Webhooks/WebhookRow.vue +++ b/app/javascript/dashboard/routes/dashboard/settings/integrations/Webhooks/WebhookRow.vue @@ -1,59 +1,58 @@ - diff --git a/app/javascript/dashboard/routes/dashboard/settings/integrations/Webhooks/specs/webhookHelper.spec.js b/app/javascript/dashboard/routes/dashboard/settings/integrations/Webhooks/specs/webhookHelper.spec.js new file mode 100644 index 000000000..9bde34063 --- /dev/null +++ b/app/javascript/dashboard/routes/dashboard/settings/integrations/Webhooks/specs/webhookHelper.spec.js @@ -0,0 +1,9 @@ +import { getEventNamei18n } from '../webhookHelper'; + +describe('#getEventNamei18n', () => { + it('returns correct i18n translation text', () => { + expect(getEventNamei18n('message_created')).toEqual( + `INTEGRATION_SETTINGS.WEBHOOK.FORM.SUBSCRIPTIONS.EVENTS.MESSAGE_CREATED` + ); + }); +}); diff --git a/app/javascript/dashboard/routes/dashboard/settings/integrations/Webhooks/specs/webhookMixin.spec.js b/app/javascript/dashboard/routes/dashboard/settings/integrations/Webhooks/specs/webhookMixin.spec.js deleted file mode 100644 index c617b64b0..000000000 --- a/app/javascript/dashboard/routes/dashboard/settings/integrations/Webhooks/specs/webhookMixin.spec.js +++ /dev/null @@ -1,26 +0,0 @@ -import { createWrapper } from '@vue/test-utils'; -import webhookMixin from '../webhookMixin'; -import Vue from 'vue'; - -describe('webhookMixin', () => { - describe('#getEventLabel', () => { - it('returns correct i18n translation:', () => { - const Component = { - render() {}, - title: 'WebhookComponent', - mixins: [webhookMixin], - methods: { - $t(text) { - return text; - }, - }, - }; - const Constructor = Vue.extend(Component); - const vm = new Constructor().$mount(); - const wrapper = createWrapper(vm); - expect(wrapper.vm.getEventLabel('message_created')).toEqual( - `INTEGRATION_SETTINGS.WEBHOOK.FORM.SUBSCRIPTIONS.EVENTS.MESSAGE_CREATED` - ); - }); - }); -}); diff --git a/app/javascript/dashboard/routes/dashboard/settings/integrations/Webhooks/webhookHelper.js b/app/javascript/dashboard/routes/dashboard/settings/integrations/Webhooks/webhookHelper.js new file mode 100644 index 000000000..699dafdc8 --- /dev/null +++ b/app/javascript/dashboard/routes/dashboard/settings/integrations/Webhooks/webhookHelper.js @@ -0,0 +1,4 @@ +export const getEventNamei18n = event => { + const eventName = event.toUpperCase(); + return `INTEGRATION_SETTINGS.WEBHOOK.FORM.SUBSCRIPTIONS.EVENTS.${eventName}`; +}; diff --git a/app/javascript/dashboard/routes/dashboard/settings/integrations/Webhooks/webhookMixin.js b/app/javascript/dashboard/routes/dashboard/settings/integrations/Webhooks/webhookMixin.js deleted file mode 100644 index 38283fe90..000000000 --- a/app/javascript/dashboard/routes/dashboard/settings/integrations/Webhooks/webhookMixin.js +++ /dev/null @@ -1,10 +0,0 @@ -export default { - methods: { - getEventLabel(event) { - const eventName = event.toUpperCase(); - return this.$t( - `INTEGRATION_SETTINGS.WEBHOOK.FORM.SUBSCRIPTIONS.EVENTS.${eventName}` - ); - }, - }, -}; diff --git a/app/javascript/dashboard/routes/dashboard/settings/integrations/integrations.routes.js b/app/javascript/dashboard/routes/dashboard/settings/integrations/integrations.routes.js index c4d319173..8a4937dd4 100644 --- a/app/javascript/dashboard/routes/dashboard/settings/integrations/integrations.routes.js +++ b/app/javascript/dashboard/routes/dashboard/settings/integrations/integrations.routes.js @@ -30,6 +30,14 @@ export default { permissions: ['administrator'], }, }, + { + path: 'webhook', + component: Webhook, + name: 'settings_integrations_webhook', + meta: { + permissions: ['administrator'], + }, + }, ], }, { @@ -49,14 +57,6 @@ export default { }; }, children: [ - { - path: 'webhook', - component: Webhook, - name: 'settings_integrations_webhook', - meta: { - permissions: ['administrator'], - }, - }, { path: 'slack', name: 'settings_integrations_slack',