Commit 49d1b5c6 authored by Christie Lenneville's avatar Christie Lenneville Committed by Nicolò Maria Mezzopera

Migrate "Start event label" dropdown

Fix failed pipelines
parent e47b4c2d
<script> <script>
import Api from 'ee/api'; import Api from 'ee/api';
import { debounce } from 'lodash'; import { debounce } from 'lodash';
import { import { GlDropdown, GlDropdownItem, GlIcon, GlLoadingIcon, GlSearchBoxByType } from '@gitlab/ui';
GlDeprecatedDropdown,
GlDeprecatedDropdownItem,
GlIcon,
GlLoadingIcon,
GlSearchBoxByType,
} from '@gitlab/ui';
import { mapGetters } from 'vuex'; import { mapGetters } from 'vuex';
import { deprecatedCreateFlash as createFlash } from '~/flash'; import { deprecatedCreateFlash as createFlash } from '~/flash';
import { __ } from '~/locale'; import { __ } from '~/locale';
...@@ -17,8 +11,8 @@ import { DATA_REFETCH_DELAY } from '../../shared/constants'; ...@@ -17,8 +11,8 @@ import { DATA_REFETCH_DELAY } from '../../shared/constants';
export default { export default {
name: 'LabelsSelector', name: 'LabelsSelector',
components: { components: {
GlDeprecatedDropdown, GlDropdown,
GlDeprecatedDropdownItem, GlDropdownItem,
GlIcon, GlIcon,
GlLoadingIcon, GlLoadingIcon,
GlSearchBoxByType, GlSearchBoxByType,
...@@ -126,10 +120,10 @@ export default { ...@@ -126,10 +120,10 @@ export default {
}; };
</script> </script>
<template> <template>
<gl-deprecated-dropdown class="w-100" toggle-class="overflow-hidden" :right="right"> <gl-dropdown class="gl-w-full" toggle-class="overflow-hidden" :right="right">
<template #button-content> <template #button-content>
<slot name="label-dropdown-button"> <slot name="label-dropdown-button">
<span v-if="selectedLabel"> <span v-if="selectedLabel" class="gl-new-dropdown-button-text">
<span <span
:style="{ backgroundColor: selectedLabel.color }" :style="{ backgroundColor: selectedLabel.color }"
class="d-inline-block dropdown-label-box" class="d-inline-block dropdown-label-box"
...@@ -137,22 +131,21 @@ export default { ...@@ -137,22 +131,21 @@ export default {
</span> </span>
{{ labelTitle(selectedLabel) }} {{ labelTitle(selectedLabel) }}
</span> </span>
<span v-else>{{ __('Select a label') }}</span> <span v-else class="gl-new-dropdown-button-text">{{ __('Select a label') }}</span>
<gl-icon class="dropdown-chevron" name="chevron-down" />
</slot> </slot>
</template> </template>
<template> <template>
<slot name="label-dropdown-list-header"> <slot name="label-dropdown-list-header">
<gl-deprecated-dropdown-item <gl-dropdown-item :active="!selectedLabelId.length" @click.prevent="$emit('clearLabel')"
:active="!selectedLabelId.length"
@click.prevent="$emit('clearLabel')"
>{{ __('Select a label') }} >{{ __('Select a label') }}
</gl-deprecated-dropdown-item> </gl-dropdown-item>
</slot> </slot>
<div class="mb-3 px-3"> <div class="mb-3 px-3">
<gl-search-box-by-type v-model.trim="searchTerm" class="mb-2" /> <gl-search-box-by-type v-model.trim="searchTerm" class="mb-2" />
</div> </div>
<div class="mb-3 px-3"> <div class="mb-3 px-3">
<gl-deprecated-dropdown-item <gl-dropdown-item
v-for="label in labels" v-for="label in labels"
:key="label.id" :key="label.id"
:class="{ :class="{
...@@ -170,7 +163,7 @@ export default { ...@@ -170,7 +163,7 @@ export default {
<span :style="{ backgroundColor: label.color }" class="d-inline-block dropdown-label-box"> <span :style="{ backgroundColor: label.color }" class="d-inline-block dropdown-label-box">
</span> </span>
{{ labelTitle(label) }} {{ labelTitle(label) }}
</gl-deprecated-dropdown-item> </gl-dropdown-item>
<div v-show="loading" class="text-center"> <div v-show="loading" class="text-center">
<gl-loading-icon :inline="true" size="md" /> <gl-loading-icon :inline="true" size="md" />
</div> </div>
...@@ -179,5 +172,5 @@ export default { ...@@ -179,5 +172,5 @@ export default {
</div> </div>
</div> </div>
</template> </template>
</gl-deprecated-dropdown> </gl-dropdown>
</template> </template>
---
title: Migrate Start event label dropdown
merge_request: 43050
author:
type: other
// Jest Snapshot v1, https://goo.gl/fbAQLP // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Value Stream Analytics LabelsSelector with no item selected will render the label selector 1`] = ` exports[`Value Stream Analytics LabelsSelector with no item selected will render the label selector 1`] = `
"<gl-deprecated-dropdown-stub text=\\"\\" toggle-class=\\"overflow-hidden\\" class=\\"w-100\\"> "<gl-dropdown-stub headertext=\\"\\" text=\\"\\" category=\\"tertiary\\" variant=\\"default\\" size=\\"medium\\" toggleclass=\\"overflow-hidden\\" class=\\"gl-w-full\\">
<gl-deprecated-dropdown-item-stub active=\\"true\\">Select a label <gl-dropdown-item-stub avatarurl=\\"\\" iconcolor=\\"\\" iconname=\\"\\" iconrightname=\\"\\" secondarytext=\\"\\" active=\\"true\\">Select a label
</gl-deprecated-dropdown-item-stub> </gl-dropdown-item-stub>
<div class=\\"mb-3 px-3\\"> <div class=\\"mb-3 px-3\\">
<gl-search-box-by-type-stub value=\\"\\" clearbuttontitle=\\"Clear\\" class=\\"mb-2\\"></gl-search-box-by-type-stub> <gl-search-box-by-type-stub value=\\"\\" clearbuttontitle=\\"Clear\\" class=\\"mb-2\\"></gl-search-box-by-type-stub>
</div> </div>
<div class=\\"mb-3 px-3\\"> <div class=\\"mb-3 px-3\\">
<gl-deprecated-dropdown-item-stub class=\\"\\"> <gl-dropdown-item-stub avatarurl=\\"\\" iconcolor=\\"\\" iconname=\\"\\" iconrightname=\\"\\" secondarytext=\\"\\" class=\\"\\">
<!----> <span class=\\"d-inline-block dropdown-label-box\\" style=\\"background-color: rgb(255, 0, 0);\\"></span> <!----> <span class=\\"d-inline-block dropdown-label-box\\" style=\\"background-color: rgb(255, 0, 0);\\"></span>
roses roses
</gl-deprecated-dropdown-item-stub> </gl-dropdown-item-stub>
<gl-deprecated-dropdown-item-stub class=\\"\\"> <gl-dropdown-item-stub avatarurl=\\"\\" iconcolor=\\"\\" iconname=\\"\\" iconrightname=\\"\\" secondarytext=\\"\\" class=\\"\\">
<!----> <span class=\\"d-inline-block dropdown-label-box\\" style=\\"background-color: rgb(255, 255, 255);\\"></span> <!----> <span class=\\"d-inline-block dropdown-label-box\\" style=\\"background-color: rgb(255, 255, 255);\\"></span>
some space some space
</gl-deprecated-dropdown-item-stub> </gl-dropdown-item-stub>
<gl-deprecated-dropdown-item-stub class=\\"\\"> <gl-dropdown-item-stub avatarurl=\\"\\" iconcolor=\\"\\" iconname=\\"\\" iconrightname=\\"\\" secondarytext=\\"\\" class=\\"\\">
<!----> <span class=\\"d-inline-block dropdown-label-box\\" style=\\"background-color: rgb(0, 0, 255);\\"></span> <!----> <span class=\\"d-inline-block dropdown-label-box\\" style=\\"background-color: rgb(0, 0, 255);\\"></span>
violets violets
</gl-deprecated-dropdown-item-stub> </gl-dropdown-item-stub>
<div class=\\"text-center\\" style=\\"display: none;\\"> <div class=\\"text-center\\" style=\\"display: none;\\">
<gl-loading-icon-stub label=\\"Loading\\" size=\\"md\\" color=\\"orange\\" inline=\\"true\\"></gl-loading-icon-stub> <gl-loading-icon-stub label=\\"Loading\\" size=\\"md\\" color=\\"orange\\" inline=\\"true\\"></gl-loading-icon-stub>
</div> </div>
...@@ -27,29 +27,29 @@ exports[`Value Stream Analytics LabelsSelector with no item selected will render ...@@ -27,29 +27,29 @@ exports[`Value Stream Analytics LabelsSelector with no item selected will render
No matching labels No matching labels
</div> </div>
</div> </div>
</gl-deprecated-dropdown-stub>" </gl-dropdown-stub>"
`; `;
exports[`Value Stream Analytics LabelsSelector with selectedLabelId set will render the label selector 1`] = ` exports[`Value Stream Analytics LabelsSelector with selectedLabelId set will render the label selector 1`] = `
"<gl-deprecated-dropdown-stub text=\\"\\" toggle-class=\\"overflow-hidden\\" class=\\"w-100\\"> "<gl-dropdown-stub headertext=\\"\\" text=\\"\\" category=\\"tertiary\\" variant=\\"default\\" size=\\"medium\\" toggleclass=\\"overflow-hidden\\" class=\\"gl-w-full\\">
<gl-deprecated-dropdown-item-stub>Select a label <gl-dropdown-item-stub avatarurl=\\"\\" iconcolor=\\"\\" iconname=\\"\\" iconrightname=\\"\\" secondarytext=\\"\\">Select a label
</gl-deprecated-dropdown-item-stub> </gl-dropdown-item-stub>
<div class=\\"mb-3 px-3\\"> <div class=\\"mb-3 px-3\\">
<gl-search-box-by-type-stub value=\\"\\" clearbuttontitle=\\"Clear\\" class=\\"mb-2\\"></gl-search-box-by-type-stub> <gl-search-box-by-type-stub value=\\"\\" clearbuttontitle=\\"Clear\\" class=\\"mb-2\\"></gl-search-box-by-type-stub>
</div> </div>
<div class=\\"mb-3 px-3\\"> <div class=\\"mb-3 px-3\\">
<gl-deprecated-dropdown-item-stub class=\\"\\"> <gl-dropdown-item-stub avatarurl=\\"\\" iconcolor=\\"\\" iconname=\\"\\" iconrightname=\\"\\" secondarytext=\\"\\" class=\\"\\">
<!----> <span class=\\"d-inline-block dropdown-label-box\\" style=\\"background-color: rgb(255, 0, 0);\\"></span> <!----> <span class=\\"d-inline-block dropdown-label-box\\" style=\\"background-color: rgb(255, 0, 0);\\"></span>
roses roses
</gl-deprecated-dropdown-item-stub> </gl-dropdown-item-stub>
<gl-deprecated-dropdown-item-stub class=\\"\\"> <gl-dropdown-item-stub avatarurl=\\"\\" iconcolor=\\"\\" iconname=\\"\\" iconrightname=\\"\\" secondarytext=\\"\\" class=\\"\\">
<!----> <span class=\\"d-inline-block dropdown-label-box\\" style=\\"background-color: rgb(255, 255, 255);\\"></span> <!----> <span class=\\"d-inline-block dropdown-label-box\\" style=\\"background-color: rgb(255, 255, 255);\\"></span>
some space some space
</gl-deprecated-dropdown-item-stub> </gl-dropdown-item-stub>
<gl-deprecated-dropdown-item-stub active=\\"true\\" class=\\"\\"> <gl-dropdown-item-stub avatarurl=\\"\\" iconcolor=\\"\\" iconname=\\"\\" iconrightname=\\"\\" secondarytext=\\"\\" active=\\"true\\" class=\\"\\">
<!----> <span class=\\"d-inline-block dropdown-label-box\\" style=\\"background-color: rgb(0, 0, 255);\\"></span> <!----> <span class=\\"d-inline-block dropdown-label-box\\" style=\\"background-color: rgb(0, 0, 255);\\"></span>
violets violets
</gl-deprecated-dropdown-item-stub> </gl-dropdown-item-stub>
<div class=\\"text-center\\" style=\\"display: none;\\"> <div class=\\"text-center\\" style=\\"display: none;\\">
<gl-loading-icon-stub label=\\"Loading\\" size=\\"md\\" color=\\"orange\\" inline=\\"true\\"></gl-loading-icon-stub> <gl-loading-icon-stub label=\\"Loading\\" size=\\"md\\" color=\\"orange\\" inline=\\"true\\"></gl-loading-icon-stub>
</div> </div>
...@@ -57,5 +57,5 @@ exports[`Value Stream Analytics LabelsSelector with selectedLabelId set will ren ...@@ -57,5 +57,5 @@ exports[`Value Stream Analytics LabelsSelector with selectedLabelId set will ren
No matching labels No matching labels
</div> </div>
</div> </div>
</gl-deprecated-dropdown-stub>" </gl-dropdown-stub>"
`; `;
...@@ -11,7 +11,7 @@ import { groupLabels } from '../mock_data'; ...@@ -11,7 +11,7 @@ import { groupLabels } from '../mock_data';
const selectedLabel = groupLabels[groupLabels.length - 1]; const selectedLabel = groupLabels[groupLabels.length - 1];
const findActiveItem = wrapper => const findActiveItem = wrapper =>
wrapper wrapper
.findAll('gl-deprecated-dropdown-item-stub') .findAll('gl-dropdown-item-stub')
.filter(d => d.attributes('active')) .filter(d => d.attributes('active'))
.at(0); .at(0);
......
...@@ -2,7 +2,7 @@ import Vuex from 'vuex'; ...@@ -2,7 +2,7 @@ import Vuex from 'vuex';
import axios from 'axios'; import axios from 'axios';
import MockAdapter from 'axios-mock-adapter'; import MockAdapter from 'axios-mock-adapter';
import { shallowMount, mount, createLocalVue } from '@vue/test-utils'; import { shallowMount, mount, createLocalVue } from '@vue/test-utils';
import { GlDeprecatedDropdownItem, GlSegmentedControl } from '@gitlab/ui'; import { GlDropdownItem, GlSegmentedControl } from '@gitlab/ui';
import TasksByTypeFilters from 'ee/analytics/cycle_analytics/components/tasks_by_type/tasks_by_type_filters.vue'; import TasksByTypeFilters from 'ee/analytics/cycle_analytics/components/tasks_by_type/tasks_by_type_filters.vue';
import LabelsSelector from 'ee/analytics/cycle_analytics/components/labels_selector.vue'; import LabelsSelector from 'ee/analytics/cycle_analytics/components/labels_selector.vue';
import { import {
...@@ -20,7 +20,7 @@ const selectedLabelIds = [groupLabels[0].id]; ...@@ -20,7 +20,7 @@ const selectedLabelIds = [groupLabels[0].id];
const findSubjectFilters = ctx => ctx.find(GlSegmentedControl); const findSubjectFilters = ctx => ctx.find(GlSegmentedControl);
const findSelectedSubjectFilters = ctx => findSubjectFilters(ctx).attributes('checked'); const findSelectedSubjectFilters = ctx => findSubjectFilters(ctx).attributes('checked');
const findDropdownLabels = ctx => ctx.find(LabelsSelector).findAll(GlDeprecatedDropdownItem); const findDropdownLabels = ctx => ctx.find(LabelsSelector).findAll(GlDropdownItem);
const selectLabelAtIndex = (ctx, index) => { const selectLabelAtIndex = (ctx, index) => {
findDropdownLabels(ctx) findDropdownLabels(ctx)
......
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