Commit 9e3dcbd8 authored by Samantha Ming's avatar Samantha Ming Committed by Phil Hughes

Update vulnerability metric to use constant

Issue: https://gitlab.com/gitlab-org/gitlab/-/issues/352915
parent bed6867b
export const TRACK_TOGGLE_TRAINING_PROVIDER_ACTION = 'toggle_security_training_provider'; export const TRACK_TOGGLE_TRAINING_PROVIDER_ACTION = 'toggle_security_training_provider';
export const TRACK_TOGGLE_TRAINING_PROVIDER_LABEL = 'update_security_training_provider'; export const TRACK_TOGGLE_TRAINING_PROVIDER_LABEL = 'update_security_training_provider';
export const TRACK_CLICK_TRAINING_LINK = 'click_security_training_link';
export const TRACK_PROVIDER_LEARN_MORE_CLICK_ACTION = 'click_link'; export const TRACK_PROVIDER_LEARN_MORE_CLICK_ACTION = 'click_link';
export const TRACK_PROVIDER_LEARN_MORE_CLICK_LABEL = 'security_training_provider'; export const TRACK_PROVIDER_LEARN_MORE_CLICK_LABEL = 'security_training_provider';
...@@ -6,6 +6,7 @@ import securityTrainingProvidersQuery from '~/security_configuration/graphql/sec ...@@ -6,6 +6,7 @@ import securityTrainingProvidersQuery from '~/security_configuration/graphql/sec
import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin'; import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';
import axios from '~/lib/utils/axios_utils'; import axios from '~/lib/utils/axios_utils';
import Tracking from '~/tracking'; import Tracking from '~/tracking';
import { TRACK_CLICK_TRAINING_LINK } from '~/security_configuration/constants';
import { SUPPORTED_IDENTIFIER_TYPES } from '../constants'; import { SUPPORTED_IDENTIFIER_TYPES } from '../constants';
export const i18n = { export const i18n = {
...@@ -116,9 +117,7 @@ export default { ...@@ -116,9 +117,7 @@ export default {
const { name } = this.supportedIdentifier; const { name } = this.supportedIdentifier;
const { id } = mockProvider; const { id } = mockProvider;
// Follow-up: switch to utilize constants once another MR is merged this.track(TRACK_CLICK_TRAINING_LINK, {
// https://gitlab.com/gitlab-org/gitlab/-/issues/352915
this.track('click_security_training_link', {
label: `vendor_${id}`, label: `vendor_${id}`,
property: name, property: name,
}); });
......
...@@ -14,6 +14,7 @@ import VulnerabilityTraining, { ...@@ -14,6 +14,7 @@ import VulnerabilityTraining, {
import securityTrainingProvidersQuery from '~/security_configuration/graphql/security_training_providers.query.graphql'; import securityTrainingProvidersQuery from '~/security_configuration/graphql/security_training_providers.query.graphql';
import { shallowMountExtended } from 'helpers/vue_test_utils_helper'; import { shallowMountExtended } from 'helpers/vue_test_utils_helper';
import { SUPPORTED_IDENTIFIER_TYPES } from 'ee/vulnerabilities/constants'; import { SUPPORTED_IDENTIFIER_TYPES } from 'ee/vulnerabilities/constants';
import { TRACK_CLICK_TRAINING_LINK } from '~/security_configuration/constants';
import createMockApollo from 'helpers/mock_apollo_helper'; import createMockApollo from 'helpers/mock_apollo_helper';
import waitForPromises from 'helpers/wait_for_promises'; import waitForPromises from 'helpers/wait_for_promises';
import { securityTrainingProvidersResponse } from 'jest/security_configuration/mock_data'; import { securityTrainingProvidersResponse } from 'jest/security_configuration/mock_data';
...@@ -197,9 +198,7 @@ describe('VulnerabilityTraining component', () => { ...@@ -197,9 +198,7 @@ describe('VulnerabilityTraining component', () => {
await waitForQueryToBeLoaded(); await waitForQueryToBeLoaded();
await findTrainingItemLink().vm.$emit('click'); await findTrainingItemLink().vm.$emit('click');
// Follow-up: switch to utilize constants once another MR is merged expect(trackingSpy).toHaveBeenCalledWith(undefined, TRACK_CLICK_TRAINING_LINK, {
// https://gitlab.com/gitlab-org/gitlab/-/issues/352915
expect(trackingSpy).toHaveBeenCalledWith(undefined, 'click_security_training_link', {
property: defaultProps.identifiers[0].name, property: defaultProps.identifiers[0].name,
label: `vendor_${mockProvider.id}`, label: `vendor_${mockProvider.id}`,
}); });
......
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