Commit fe55d8b1 authored by anna_vovchenko's avatar anna_vovchenko Committed by Ezekiel Kigbo

Implemented suggestions after the FE review

parent eb01d7be
...@@ -7,7 +7,7 @@ import { ...@@ -7,7 +7,7 @@ import {
MAX_LIST_COUNT, MAX_LIST_COUNT,
AGENT, AGENT,
EVENT_LABEL_TABS, EVENT_LABEL_TABS,
EVENT_ACTIONS, EVENT_ACTIONS_CHANGE,
} from '../constants'; } from '../constants';
import Agents from './agents.vue'; import Agents from './agents.vue';
import InstallAgentModal from './install_agent_modal.vue'; import InstallAgentModal from './install_agent_modal.vue';
...@@ -49,7 +49,7 @@ export default { ...@@ -49,7 +49,7 @@ export default {
}, },
trackTabChange(tab) { trackTabChange(tab) {
const tabName = CLUSTERS_TABS[tab].queryParamValue; const tabName = CLUSTERS_TABS[tab].queryParamValue;
this.track(EVENT_ACTIONS.change_tab, { property: tabName }); this.track(EVENT_ACTIONS_CHANGE, { property: tabName });
}, },
}, },
}; };
......
...@@ -18,7 +18,9 @@ import { ...@@ -18,7 +18,9 @@ import {
I18N_AGENT_MODAL, I18N_AGENT_MODAL,
KAS_DISABLED_ERROR, KAS_DISABLED_ERROR,
EVENT_LABEL_MODAL, EVENT_LABEL_MODAL,
EVENT_ACTIONS, EVENT_ACTIONS_OPEN,
EVENT_ACTIONS_SELECT,
EVENT_ACTIONS_CLICK,
} from '../constants'; } from '../constants';
import { addAgentToStore, addAgentConfigToStore } from '../graphql/cache_update'; import { addAgentToStore, addAgentConfigToStore } from '../graphql/cache_update';
import createAgent from '../graphql/mutations/create_agent.mutation.graphql'; import createAgent from '../graphql/mutations/create_agent.mutation.graphql';
...@@ -31,7 +33,8 @@ const trackingMixin = Tracking.mixin({ label: EVENT_LABEL_MODAL }); ...@@ -31,7 +33,8 @@ const trackingMixin = Tracking.mixin({ label: EVENT_LABEL_MODAL });
export default { export default {
modalId: INSTALL_AGENT_MODAL_ID, modalId: INSTALL_AGENT_MODAL_ID,
EVENT_ACTIONS, EVENT_ACTIONS_OPEN,
EVENT_ACTIONS_CLICK,
EVENT_LABEL_MODAL, EVENT_LABEL_MODAL,
components: { components: {
AvailableAgentsDropdown, AvailableAgentsDropdown,
...@@ -146,7 +149,7 @@ export default { ...@@ -146,7 +149,7 @@ export default {
methods: { methods: {
setAgentName(name) { setAgentName(name) {
this.agentName = name; this.agentName = name;
this.track(EVENT_ACTIONS.select); this.track(EVENT_ACTIONS_SELECT);
}, },
closeModal() { closeModal() {
this.$refs.modal.hide(); this.$refs.modal.hide();
...@@ -257,7 +260,7 @@ export default { ...@@ -257,7 +260,7 @@ export default {
static static
lazy lazy
@hidden="resetModal" @hidden="resetModal"
@show="track($options.EVENT_ACTIONS.open, { property: modalType })" @show="track($options.EVENT_ACTIONS_OPEN, { property: modalType })"
> >
<template v-if="isAgentRegistrationModal"> <template v-if="isAgentRegistrationModal">
<template v-if="!registered"> <template v-if="!registered">
...@@ -365,7 +368,7 @@ export default { ...@@ -365,7 +368,7 @@ export default {
<template #modal-footer> <template #modal-footer>
<gl-button <gl-button
v-if="canCancel" v-if="canCancel"
:data-track-action="$options.EVENT_ACTIONS.click" :data-track-action="$options.EVENT_ACTIONS_CLICK"
:data-track-label="$options.EVENT_LABEL_MODAL" :data-track-label="$options.EVENT_LABEL_MODAL"
data-track-property="cancel" data-track-property="cancel"
@click="closeModal" @click="closeModal"
...@@ -376,7 +379,7 @@ export default { ...@@ -376,7 +379,7 @@ export default {
v-if="registered" v-if="registered"
variant="confirm" variant="confirm"
category="primary" category="primary"
:data-track-action="$options.EVENT_ACTIONS.click" :data-track-action="$options.EVENT_ACTIONS_CLICK"
:data-track-label="$options.EVENT_LABEL_MODAL" :data-track-label="$options.EVENT_LABEL_MODAL"
data-track-property="close" data-track-property="close"
@click="closeModal" @click="closeModal"
...@@ -388,7 +391,7 @@ export default { ...@@ -388,7 +391,7 @@ export default {
:disabled="!nextButtonDisabled" :disabled="!nextButtonDisabled"
variant="confirm" variant="confirm"
category="primary" category="primary"
:data-track-action="$options.EVENT_ACTIONS.click" :data-track-action="$options.EVENT_ACTIONS_CLICK"
:data-track-label="$options.EVENT_LABEL_MODAL" :data-track-label="$options.EVENT_LABEL_MODAL"
data-track-property="register" data-track-property="register"
@click="registerAgent" @click="registerAgent"
...@@ -408,7 +411,7 @@ export default { ...@@ -408,7 +411,7 @@ export default {
v-if="isEmptyStateModal" v-if="isEmptyStateModal"
variant="confirm" variant="confirm"
category="primary" category="primary"
:data-track-action="$options.EVENT_ACTIONS.click" :data-track-action="$options.EVENT_ACTIONS_CLICK"
:data-track-label="$options.EVENT_LABEL_MODAL" :data-track-label="$options.EVENT_LABEL_MODAL"
data-track-property="done" data-track-property="done"
@click="closeModal" @click="closeModal"
......
...@@ -239,9 +239,7 @@ export const CERTIFICATE_BASED = 'certificate_based'; ...@@ -239,9 +239,7 @@ export const CERTIFICATE_BASED = 'certificate_based';
export const EVENT_LABEL_MODAL = 'agent_registration_modal'; export const EVENT_LABEL_MODAL = 'agent_registration_modal';
export const EVENT_LABEL_TABS = 'kubernetes_section_tabs'; export const EVENT_LABEL_TABS = 'kubernetes_section_tabs';
export const EVENT_ACTIONS = { export const EVENT_ACTIONS_OPEN = 'open_modal';
open: 'open_modal', export const EVENT_ACTIONS_SELECT = 'select_agent';
select: 'select_agent', export const EVENT_ACTIONS_CLICK = 'click_button';
click: 'click_button', export const EVENT_ACTIONS_CHANGE = 'change_tab';
change_tab: 'change_tab',
};
...@@ -10,7 +10,7 @@ import { ...@@ -10,7 +10,7 @@ import {
MAX_CLUSTERS_LIST, MAX_CLUSTERS_LIST,
MAX_LIST_COUNT, MAX_LIST_COUNT,
EVENT_LABEL_TABS, EVENT_LABEL_TABS,
EVENT_ACTIONS, EVENT_ACTIONS_CHANGE,
} from '~/clusters_list/constants'; } from '~/clusters_list/constants';
const defaultBranchName = 'default-branch'; const defaultBranchName = 'default-branch';
...@@ -87,7 +87,7 @@ describe('ClustersMainViewComponent', () => { ...@@ -87,7 +87,7 @@ describe('ClustersMainViewComponent', () => {
it('sends the correct tracking event', () => { it('sends the correct tracking event', () => {
findTabs().vm.$emit('input', 1); findTabs().vm.$emit('input', 1);
expect(trackingSpy).toHaveBeenCalledWith(undefined, EVENT_ACTIONS.change_tab, { expect(trackingSpy).toHaveBeenCalledWith(undefined, EVENT_ACTIONS_CHANGE, {
label: EVENT_LABEL_TABS, label: EVENT_LABEL_TABS,
property: AGENT, property: AGENT,
}); });
......
...@@ -9,7 +9,8 @@ import { ...@@ -9,7 +9,8 @@ import {
I18N_AGENT_MODAL, I18N_AGENT_MODAL,
MAX_LIST_COUNT, MAX_LIST_COUNT,
EVENT_LABEL_MODAL, EVENT_LABEL_MODAL,
EVENT_ACTIONS, EVENT_ACTIONS_OPEN,
EVENT_ACTIONS_SELECT,
} from '~/clusters_list/constants'; } from '~/clusters_list/constants';
import getAgentsQuery from '~/clusters_list/graphql/queries/get_agents.query.graphql'; import getAgentsQuery from '~/clusters_list/graphql/queries/get_agents.query.graphql';
import getAgentConfigurations from '~/clusters_list/graphql/queries/agent_configurations.query.graphql'; import getAgentConfigurations from '~/clusters_list/graphql/queries/agent_configurations.query.graphql';
...@@ -161,7 +162,7 @@ describe('InstallAgentModal', () => { ...@@ -161,7 +162,7 @@ describe('InstallAgentModal', () => {
it('sends the event with the modalType', () => { it('sends the event with the modalType', () => {
findModal().vm.$emit('show'); findModal().vm.$emit('show');
expect(trackingSpy).toHaveBeenCalledWith(undefined, EVENT_ACTIONS.open, { expect(trackingSpy).toHaveBeenCalledWith(undefined, EVENT_ACTIONS_OPEN, {
label: EVENT_LABEL_MODAL, label: EVENT_LABEL_MODAL,
property: 'agent_registration', property: 'agent_registration',
}); });
...@@ -179,7 +180,7 @@ describe('InstallAgentModal', () => { ...@@ -179,7 +180,7 @@ describe('InstallAgentModal', () => {
}); });
it('sends the correct tracking event', () => { it('sends the correct tracking event', () => {
expect(trackingSpy).toHaveBeenCalledWith(undefined, EVENT_ACTIONS.select, { expect(trackingSpy).toHaveBeenCalledWith(undefined, EVENT_ACTIONS_SELECT, {
label: EVENT_LABEL_MODAL, label: EVENT_LABEL_MODAL,
}); });
}); });
...@@ -297,7 +298,7 @@ describe('InstallAgentModal', () => { ...@@ -297,7 +298,7 @@ describe('InstallAgentModal', () => {
it('sends the event with the modalType', () => { it('sends the event with the modalType', () => {
findModal().vm.$emit('show'); findModal().vm.$emit('show');
expect(trackingSpy).toHaveBeenCalledWith(undefined, EVENT_ACTIONS.open, { expect(trackingSpy).toHaveBeenCalledWith(undefined, EVENT_ACTIONS_OPEN, {
label: EVENT_LABEL_MODAL, label: EVENT_LABEL_MODAL,
property: 'empty_state', property: 'empty_state',
}); });
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment