summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEnrique Alcantara <ealcantara@gitlab.com>2019-05-01 08:56:23 -0400
committerEnrique Alcantara <ealcantara@gitlab.com>2019-05-02 15:31:16 -0400
commit3945e18176db929c758b03510c92b31c6da2bf3b (patch)
tree50974847aeb956991505461673942db599c6b4f9
parentf98758753a73841d2374aad986ae795da828ddca (diff)
downloadgitlab-ce-10763-track-uninstall-button-clicks-ce.tar.gz
CE-backport track uninstall button clicks10763-track-uninstall-button-clicks-ce
-rw-r--r--app/assets/javascripts/clusters/components/uninstall_application_confirmation_modal.vue10
-rw-r--r--app/assets/javascripts/clusters/mixins/track_uninstall_button_click.js5
-rw-r--r--spec/frontend/clusters/components/uninstall_application_confirmation_modal_spec.js15
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', () => {