diff options
Diffstat (limited to 'app/assets/javascripts/vue_merge_request_widget/components/extensions')
5 files changed, 33 insertions, 118 deletions
diff --git a/app/assets/javascripts/vue_merge_request_widget/components/extensions/README.md b/app/assets/javascripts/vue_merge_request_widget/components/extensions/README.md new file mode 100644 index 00000000000..45ebafec8bf --- /dev/null +++ b/app/assets/javascripts/vue_merge_request_widget/components/extensions/README.md @@ -0,0 +1 @@ +Please see [the Widget Extensions documentation](development/merge_request_concepts/widget_extensions.md) for necessary information regarding development of new MR Widgets. diff --git a/app/assets/javascripts/vue_merge_request_widget/components/extensions/actions.vue b/app/assets/javascripts/vue_merge_request_widget/components/extensions/actions.vue deleted file mode 100644 index b76d5d90ead..00000000000 --- a/app/assets/javascripts/vue_merge_request_widget/components/extensions/actions.vue +++ /dev/null @@ -1,116 +0,0 @@ -<script> -import { GlButton, GlDropdown, GlDropdownItem, GlTooltipDirective } from '@gitlab/ui'; -import { sprintf, __ } from '~/locale'; - -export default { - components: { - GlButton, - GlDropdown, - GlDropdownItem, - }, - directives: { - GlTooltip: GlTooltipDirective, - }, - props: { - widget: { - type: String, - required: true, - }, - tertiaryButtons: { - type: Array, - required: false, - default: () => [], - }, - }, - data: () => { - return { - timeout: null, - updatingTooltip: false, - }; - }, - computed: { - dropdownLabel() { - return sprintf(__('%{widget} options'), { widget: this.widget }); - }, - }, - methods: { - onClickAction(action) { - this.$emit('clickedAction', action); - - if (action.onClick) { - action.onClick(); - } - - if (action.tooltipOnClick) { - this.updatingTooltip = true; - this.$root.$emit('bv::show::tooltip', action.id); - - clearTimeout(this.timeout); - - this.timeout = setTimeout(() => { - this.updatingTooltip = false; - this.$root.$emit('bv::hide::tooltip', action.id); - }, 1000); - } - }, - setTooltip(btn) { - if (this.updatingTooltip && btn.tooltipOnClick) { - return btn.tooltipOnClick; - } - - return btn.tooltipText; - }, - }, -}; -</script> - -<template> - <div> - <gl-dropdown - v-if="tertiaryButtons.length" - :text="dropdownLabel" - icon="ellipsis_v" - no-caret - category="tertiary" - right - lazy - text-sr-only - size="small" - toggle-class="gl-p-2!" - class="gl-display-block gl-md-display-none!" - > - <gl-dropdown-item - v-for="(btn, index) in tertiaryButtons" - :key="index" - :href="btn.href" - :target="btn.target" - :data-clipboard-text="btn.dataClipboardText" - @click="onClickAction(btn)" - > - {{ btn.text }} - </gl-dropdown-item> - </gl-dropdown> - <template v-if="tertiaryButtons.length"> - <gl-button - v-for="(btn, index) in tertiaryButtons" - :id="btn.id" - :key="index" - v-gl-tooltip.hover - :title="setTooltip(btn)" - :href="btn.href" - :target="btn.target" - :class="{ 'gl-mr-3': index !== tertiaryButtons.length - 1 }" - :data-clipboard-text="btn.dataClipboardText" - :icon="btn.icon" - :data-testid="btn.testId || 'extension-actions-button'" - :variant="btn.variant || 'confirm'" - category="tertiary" - size="small" - class="gl-display-none gl-md-display-block gl-float-left" - @click="onClickAction(btn)" - > - {{ btn.text }} - </gl-button> - </template> - </div> -</template> diff --git a/app/assets/javascripts/vue_merge_request_widget/components/extensions/base.vue b/app/assets/javascripts/vue_merge_request_widget/components/extensions/base.vue index 410331004e4..414c5bf9691 100644 --- a/app/assets/javascripts/vue_merge_request_widget/components/extensions/base.vue +++ b/app/assets/javascripts/vue_merge_request_widget/components/extensions/base.vue @@ -12,8 +12,8 @@ import { sprintf, s__, __ } from '~/locale'; import Poll from '~/lib/utils/poll'; import { normalizeHeaders } from '~/lib/utils/common_utils'; import { EXTENSION_ICON_CLASS, EXTENSION_ICONS } from '../../constants'; +import Actions from '../action_buttons.vue'; import StatusIcon from './status_icon.vue'; -import Actions from './actions.vue'; import ChildContent from './child_content.vue'; import { createTelemetryHub } from './telemetry'; import { generateText } from './utils'; diff --git a/app/assets/javascripts/vue_merge_request_widget/components/extensions/child_content.vue b/app/assets/javascripts/vue_merge_request_widget/components/extensions/child_content.vue index 38f83a61b30..1eccc7de660 100644 --- a/app/assets/javascripts/vue_merge_request_widget/components/extensions/child_content.vue +++ b/app/assets/javascripts/vue_merge_request_widget/components/extensions/child_content.vue @@ -1,7 +1,7 @@ <script> import { GlBadge, GlLink, GlSafeHtmlDirective, GlModalDirective } from '@gitlab/ui'; +import Actions from '../action_buttons.vue'; import StatusIcon from './status_icon.vue'; -import Actions from './actions.vue'; import { generateText } from './utils'; export default { diff --git a/app/assets/javascripts/vue_merge_request_widget/components/extensions/telemetry.js b/app/assets/javascripts/vue_merge_request_widget/components/extensions/telemetry.js index b551cd2fd60..bc84459e298 100644 --- a/app/assets/javascripts/vue_merge_request_widget/components/extensions/telemetry.js +++ b/app/assets/javascripts/vue_merge_request_widget/components/extensions/telemetry.js @@ -34,6 +34,36 @@ const nonStandardEvents = { }, counter: {}, }, + metrics: { + uniqueUser: { + expand: ['i_testing_metrics_report_widget_total'], + }, + counter: {}, + }, + browserPerformance: { + uniqueUser: { + expand: ['i_testing_web_performance_widget_total'], + }, + counter: {}, + }, + licenseCompliance: { + uniqueUser: { + expand: ['i_testing_license_compliance_widget_total'], + }, + counter: {}, + }, + loadPerformance: { + uniqueUser: { + expand: ['i_testing_load_performance_widget_total'], + }, + counter: {}, + }, + statusChecks: { + uniqueUser: { + expand: ['i_testing_status_checks_widget'], + }, + counter: {}, + }, }; function combineDeepArray(path, ...objects) { |