Commit 9bb756e8 authored by Scott Hampton's avatar Scott Hampton

Change lodash once to Vue once

Use vue event modifiers to trigger a method
once instead of using lodash's once method.
parent 7d8f3238
<script> <script>
import Vue from 'vue'; import Vue from 'vue';
import { GlCard, GlEmptyState, GlLink, GlSkeletonLoader, GlTable } from '@gitlab/ui'; import { GlCard, GlEmptyState, GlLink, GlSkeletonLoader, GlTable } from '@gitlab/ui';
import { once } from 'lodash';
import api from '~/api'; import api from '~/api';
import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin'; import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';
import { __, s__ } from '~/locale'; import { __, s__ } from '~/locale';
...@@ -70,13 +69,6 @@ export default { ...@@ -70,13 +69,6 @@ export default {
}; };
}, },
computed: { computed: {
handleProjectUsageData() {
return once(() => {
if (this.glFeatures.usageDataITestingGroupCodeCoverageProjectClickTotal) {
api.trackRedisHllUserEvent(this.$options.usagePingProjectEvent);
}
});
},
hasCoverageData() { hasCoverageData() {
return Boolean(this.selectedCoverageData.length); return Boolean(this.selectedCoverageData.length);
}, },
...@@ -109,6 +101,11 @@ export default { ...@@ -109,6 +101,11 @@ export default {
handleError() { handleError() {
this.hasError = true; this.hasError = true;
}, },
onProjectClick() {
if (this.glFeatures.usageDataITestingGroupCodeCoverageProjectClickTotal) {
api.trackRedisHllUserEvent(this.$options.usagePingProjectEvent);
}
},
selectAllProjects(allProjects) { selectAllProjects(allProjects) {
this.projectIds = Object.fromEntries(allProjects.map(({ id }) => [id, true])); this.projectIds = Object.fromEntries(allProjects.map(({ id }) => [id, true]));
this.allProjectsSelected = true; this.allProjectsSelected = true;
...@@ -227,7 +224,7 @@ export default { ...@@ -227,7 +224,7 @@ export default {
target="_blank" target="_blank"
:href="item.codeCoveragePath" :href="item.codeCoveragePath"
:data-testid="`${item.id}-name`" :data-testid="`${item.id}-name`"
@click="handleProjectUsageData" @click.once="onProjectClick"
> >
{{ item.name }} {{ item.name }}
</gl-link> </gl-link>
......
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