diff options
author | Filipa Lacerda <filipa@gitlab.com> | 2019-05-03 14:25:06 +0000 |
---|---|---|
committer | Filipa Lacerda <filipa@gitlab.com> | 2019-05-03 14:25:06 +0000 |
commit | d5c4cb567f970cae7fbafee542480d0a55b0c050 (patch) | |
tree | d6d11fdbf315fbcd9f3e4f8d909f9c60b6343f8e | |
parent | 8f5cf85e0cf4ff1d610f8738ef84ed9a70ebc0ed (diff) | |
parent | 3945e18176db929c758b03510c92b31c6da2bf3b (diff) | |
download | gitlab-ce-d5c4cb567f970cae7fbafee542480d0a55b0c050.tar.gz |
Merge branch '10763-track-uninstall-button-clicks-ce' into 'master'
CE Backport of tracking uninstall button click
See merge request gitlab-org/gitlab-ce!28012
3 files changed, 26 insertions, 4 deletions
diff --git a/app/assets/javascripts/clusters/components/uninstall_application_confirmation_modal.vue b/app/assets/javascripts/clusters/components/uninstall_application_confirmation_modal.vue index 80ba2f22198..65827f1cb6a 100644 --- a/app/assets/javascripts/clusters/components/uninstall_application_confirmation_modal.vue +++ b/app/assets/javascripts/clusters/components/uninstall_application_confirmation_modal.vue @@ -1,6 +1,7 @@ <script> import { GlModal } from '@gitlab/ui'; import { sprintf, s__ } from '~/locale'; +import trackUninstallButtonClickMixin from 'ee_else_ce/clusters/mixins/track_uninstall_button_click'; import { INGRESS, CERT_MANAGER, PROMETHEUS, RUNNER, KNATIVE, JUPYTER } from '../constants'; const CUSTOM_APP_WARNING_TEXT = { @@ -20,6 +21,7 @@ export default { components: { GlModal, }, + mixins: [trackUninstallButtonClickMixin], props: { application: { type: String, @@ -51,6 +53,12 @@ export default { return `uninstall-${this.application}`; }, }, + methods: { + confirmUninstall() { + this.trackUninstallButtonClick(this.application); + this.$emit('confirm'); + }, + }, }; </script> <template> @@ -60,7 +68,7 @@ export default { :ok-title="title" :modal-id="modalId" :title="title" - @ok="$emit('confirm')" + @ok="confirmUninstall()" >{{ warningText }} {{ customAppWarningText }}</gl-modal > </template> diff --git a/app/assets/javascripts/clusters/mixins/track_uninstall_button_click.js b/app/assets/javascripts/clusters/mixins/track_uninstall_button_click.js new file mode 100644 index 00000000000..18f65b234d3 --- /dev/null +++ b/app/assets/javascripts/clusters/mixins/track_uninstall_button_click.js @@ -0,0 +1,5 @@ +export default { + methods: { + trackUninstallButtonClick: () => {}, + }, +}; diff --git a/spec/frontend/clusters/components/uninstall_application_confirmation_modal_spec.js b/spec/frontend/clusters/components/uninstall_application_confirmation_modal_spec.js index 6a7126b45cd..04808864fc0 100644 --- a/spec/frontend/clusters/components/uninstall_application_confirmation_modal_spec.js +++ b/spec/frontend/clusters/components/uninstall_application_confirmation_modal_spec.js @@ -29,10 +29,19 @@ describe('UninstallApplicationConfirmationModal', () => { expect(wrapper.find(GlModal).attributes('ok-title')).toEqual(`Uninstall ${appTitle}`); }); - it('triggers confirm event when ok button is clicked', () => { - wrapper.find(GlModal).vm.$emit('ok'); + describe('when ok button is clicked', () => { + beforeEach(() => { + jest.spyOn(wrapper.vm, 'trackUninstallButtonClick'); + wrapper.find(GlModal).vm.$emit('ok'); + }); + + it('emits confirm event', () => { + expect(wrapper.emitted('confirm')).toBeTruthy(); + }); - expect(wrapper.emitted('confirm')).toBeTruthy(); + it('calls track uninstall button click mixin', () => { + expect(wrapper.vm.trackUninstallButtonClick).toHaveBeenCalledWith(INGRESS); + }); }); it('displays a warning text indicating the app will be uninstalled', () => { |