Commit b93d6cac authored by Marvin Karegyeya's avatar Marvin Karegyeya Committed by Olena Horal-Koretska

Replace GlDeprecatedDropdown with GlDropdown in error_tracking

parent d91805b8
...@@ -8,9 +8,9 @@ import { ...@@ -8,9 +8,9 @@ import {
GlBadge, GlBadge,
GlAlert, GlAlert,
GlSprintf, GlSprintf,
GlDeprecatedDropdown, GlDropdown,
GlDeprecatedDropdownItem, GlDropdownItem,
GlDeprecatedDropdownDivider, GlDropdownDivider,
GlIcon, GlIcon,
} from '@gitlab/ui'; } from '@gitlab/ui';
import { deprecatedCreateFlash as createFlash } from '~/flash'; import { deprecatedCreateFlash as createFlash } from '~/flash';
...@@ -43,9 +43,9 @@ export default { ...@@ -43,9 +43,9 @@ export default {
GlBadge, GlBadge,
GlAlert, GlAlert,
GlSprintf, GlSprintf,
GlDeprecatedDropdown, GlDropdown,
GlDeprecatedDropdownItem, GlDropdownItem,
GlDeprecatedDropdownDivider, GlDropdownDivider,
TimeAgoTooltip, TimeAgoTooltip,
}, },
directives: { directives: {
...@@ -331,38 +331,38 @@ export default { ...@@ -331,38 +331,38 @@ export default {
</gl-button> </gl-button>
</form> </form>
</div> </div>
<gl-deprecated-dropdown <gl-dropdown
text="Options" text="Options"
class="error-details-options d-md-none" class="error-details-options d-md-none"
right right
:disabled="issueUpdateInProgress" :disabled="issueUpdateInProgress"
> >
<gl-deprecated-dropdown-item <gl-dropdown-item
data-qa-selector="update_ignore_status_button" data-qa-selector="update_ignore_status_button"
@click="onIgnoreStatusUpdate" @click="onIgnoreStatusUpdate"
>{{ ignoreBtnLabel }}</gl-deprecated-dropdown-item >{{ ignoreBtnLabel }}</gl-dropdown-item
> >
<gl-deprecated-dropdown-item <gl-dropdown-item
data-qa-selector="update_resolve_status_button" data-qa-selector="update_resolve_status_button"
@click="onResolveStatusUpdate" @click="onResolveStatusUpdate"
>{{ resolveBtnLabel }}</gl-deprecated-dropdown-item >{{ resolveBtnLabel }}</gl-dropdown-item
> >
<gl-deprecated-dropdown-divider /> <gl-dropdown-divider />
<gl-deprecated-dropdown-item <gl-dropdown-item
v-if="error.gitlabIssuePath" v-if="error.gitlabIssuePath"
data-qa-selector="view_issue_button" data-qa-selector="view_issue_button"
:href="error.gitlabIssuePath" :href="error.gitlabIssuePath"
variant="success" variant="success"
>{{ __('View issue') }}</gl-deprecated-dropdown-item >{{ __('View issue') }}</gl-dropdown-item
> >
<gl-deprecated-dropdown-item <gl-dropdown-item
v-if="!error.gitlabIssuePath" v-if="!error.gitlabIssuePath"
:loading="issueCreationInProgress" :loading="issueCreationInProgress"
data-qa-selector="create_issue_button" data-qa-selector="create_issue_button"
@click="createIssue" @click="createIssue"
>{{ __('Create issue') }}</gl-deprecated-dropdown-item >{{ __('Create issue') }}</gl-dropdown-item
> >
</gl-deprecated-dropdown> </gl-dropdown>
</div> </div>
</div> </div>
<div> <div>
......
...@@ -8,9 +8,9 @@ import { ...@@ -8,9 +8,9 @@ import {
GlLoadingIcon, GlLoadingIcon,
GlTable, GlTable,
GlFormInput, GlFormInput,
GlDeprecatedDropdown, GlDropdown,
GlDeprecatedDropdownItem, GlDropdownItem,
GlDeprecatedDropdownDivider, GlDropdownDivider,
GlTooltipDirective, GlTooltipDirective,
GlPagination, GlPagination,
} from '@gitlab/ui'; } from '@gitlab/ui';
...@@ -72,9 +72,9 @@ export default { ...@@ -72,9 +72,9 @@ export default {
components: { components: {
GlEmptyState, GlEmptyState,
GlButton, GlButton,
GlDeprecatedDropdown, GlDropdown,
GlDeprecatedDropdownItem, GlDropdownItem,
GlDeprecatedDropdownDivider, GlDropdownDivider,
GlIcon, GlIcon,
GlLink, GlLink,
GlLoadingIcon, GlLoadingIcon,
...@@ -233,30 +233,30 @@ export default { ...@@ -233,30 +233,30 @@ export default {
> >
<div class="search-box flex-fill mb-1 mb-md-0"> <div class="search-box flex-fill mb-1 mb-md-0">
<div class="filtered-search-box mb-0"> <div class="filtered-search-box mb-0">
<gl-deprecated-dropdown <gl-dropdown
:text="__('Recent searches')" :text="__('Recent searches')"
class="filtered-search-history-dropdown-wrapper" class="filtered-search-history-dropdown-wrapper"
toggle-class="filtered-search-history-dropdown-toggle-button" toggle-class="filtered-search-history-dropdown-toggle-button gl-shadow-none! gl-border-r-gray-200! gl-border-1! gl-rounded-0!"
:disabled="loading" :disabled="loading"
> >
<div v-if="!$options.hasLocalStorage" class="px-3"> <div v-if="!$options.hasLocalStorage" class="px-3">
{{ __('This feature requires local storage to be enabled') }} {{ __('This feature requires local storage to be enabled') }}
</div> </div>
<template v-else-if="recentSearches.length > 0"> <template v-else-if="recentSearches.length > 0">
<gl-deprecated-dropdown-item <gl-dropdown-item
v-for="searchQuery in recentSearches" v-for="searchQuery in recentSearches"
:key="searchQuery" :key="searchQuery"
@click="setSearchText(searchQuery)" @click="setSearchText(searchQuery)"
>{{ searchQuery }} >{{ searchQuery }}
</gl-deprecated-dropdown-item> </gl-dropdown-item>
<gl-deprecated-dropdown-divider /> <gl-dropdown-divider />
<gl-deprecated-dropdown-item ref="clearRecentSearches" @click="clearRecentSearches" <gl-dropdown-item ref="clearRecentSearches" @click="clearRecentSearches"
>{{ __('Clear recent searches') }} >{{ __('Clear recent searches') }}
</gl-deprecated-dropdown-item> </gl-dropdown-item>
</template> </template>
<div v-else class="px-3">{{ __("You don't have any recent searches") }}</div> <div v-else class="px-3">{{ __("You don't have any recent searches") }}</div>
</gl-deprecated-dropdown> </gl-dropdown>
<div class="filtered-search-input-container flex-fill"> <div class="filtered-search-input-container gl-flex-fill-1">
<gl-form-input <gl-form-input
v-model="errorSearchQuery" v-model="errorSearchQuery"
class="pl-2 filtered-search" class="pl-2 filtered-search"
...@@ -280,49 +280,44 @@ export default { ...@@ -280,49 +280,44 @@ export default {
</div> </div>
</div> </div>
<gl-deprecated-dropdown <gl-dropdown
:text="$options.statusFilters[statusFilter]" :text="$options.statusFilters[statusFilter]"
class="status-dropdown mx-md-1 mb-1 mb-md-0" class="status-dropdown mx-md-1 mb-1 mb-md-0"
menu-class="dropdown"
:disabled="loading" :disabled="loading"
right
> >
<gl-deprecated-dropdown-item <gl-dropdown-item
v-for="(label, status) in $options.statusFilters" v-for="(label, status) in $options.statusFilters"
:key="status" :key="status"
@click="filterErrors(status, label)" @click="filterErrors(status, label)"
> >
<span class="d-flex"> <span class="d-flex">
<gl-icon <gl-icon
class="flex-shrink-0 append-right-4" class="gl-new-dropdown-item-check-icon"
:class="{ invisible: !isCurrentStatusFilter(status) }" :class="{ invisible: !isCurrentStatusFilter(status) }"
name="mobile-issue-close" name="mobile-issue-close"
/> />
{{ label }} {{ label }}
</span> </span>
</gl-deprecated-dropdown-item> </gl-dropdown-item>
</gl-deprecated-dropdown> </gl-dropdown>
<gl-deprecated-dropdown <gl-dropdown :text="$options.sortFields[sortField]" right :disabled="loading">
:text="$options.sortFields[sortField]" <gl-dropdown-item
left
:disabled="loading"
menu-class="dropdown"
>
<gl-deprecated-dropdown-item
v-for="(label, field) in $options.sortFields" v-for="(label, field) in $options.sortFields"
:key="field" :key="field"
@click="sortByField(field)" @click="sortByField(field)"
> >
<span class="d-flex"> <span class="d-flex">
<gl-icon <gl-icon
class="flex-shrink-0 append-right-4" class="gl-new-dropdown-item-check-icon"
:class="{ invisible: !isCurrentSortField(field) }" :class="{ invisible: !isCurrentSortField(field) }"
name="mobile-issue-close" name="mobile-issue-close"
/> />
{{ label }} {{ label }}
</span> </span>
</gl-deprecated-dropdown-item> </gl-dropdown-item>
</gl-deprecated-dropdown> </gl-dropdown>
</div> </div>
<div v-if="loading" class="py-3"> <div v-if="loading" class="py-3">
......
<script> <script>
import { GlDeprecatedDropdown, GlDeprecatedDropdownItem } from '@gitlab/ui'; import { GlDropdown, GlDropdownItem } from '@gitlab/ui';
import { getDisplayName } from '../utils'; import { getDisplayName } from '../utils';
export default { export default {
components: { components: {
GlDeprecatedDropdown, GlDropdown,
GlDeprecatedDropdownItem, GlDropdownItem,
}, },
props: { props: {
dropdownLabel: { dropdownLabel: {
...@@ -52,22 +52,22 @@ export default { ...@@ -52,22 +52,22 @@ export default {
<div :class="{ 'gl-show-field-errors': isProjectInvalid }"> <div :class="{ 'gl-show-field-errors': isProjectInvalid }">
<label class="label-bold" for="project-dropdown">{{ __('Project') }}</label> <label class="label-bold" for="project-dropdown">{{ __('Project') }}</label>
<div class="row"> <div class="row">
<gl-deprecated-dropdown <gl-dropdown
id="project-dropdown" id="project-dropdown"
class="col-8 col-md-9 gl-pr-0" class="col-8 col-md-9 gl-pr-0"
:disabled="!hasProjects" :disabled="!hasProjects"
menu-class="w-100 mw-100" menu-class="w-100 mw-100"
toggle-class="dropdown-menu-toggle w-100 gl-field-error-outline" toggle-class="dropdown-menu-toggle gl-field-error-outline"
:text="dropdownLabel" :text="dropdownLabel"
> >
<gl-deprecated-dropdown-item <gl-dropdown-item
v-for="project in projects" v-for="project in projects"
:key="`${project.organizationSlug}.${project.slug}`" :key="`${project.organizationSlug}.${project.slug}`"
class="w-100" class="w-100"
@click="$emit('select-project', project)" @click="$emit('select-project', project)"
>{{ getDisplayName(project) }}</gl-deprecated-dropdown-item >{{ getDisplayName(project) }}</gl-dropdown-item
> >
</gl-deprecated-dropdown> </gl-dropdown>
</div> </div>
<p v-if="isProjectInvalid" class="js-project-dropdown-error gl-field-error"> <p v-if="isProjectInvalid" class="js-project-dropdown-error gl-field-error">
{{ invalidProjectLabel }} {{ invalidProjectLabel }}
......
---
title: Replace-GlDeprecatedDropdown-with-GlDropdown-in-app/assets/javascripts/error_tracking
merge_request: 41420
author: nuwe1
type: other
import { createLocalVue, mount } from '@vue/test-utils'; import { createLocalVue, mount } from '@vue/test-utils';
import Vuex from 'vuex'; import Vuex from 'vuex';
import { import { GlEmptyState, GlLoadingIcon, GlFormInput, GlPagination, GlDropdown } from '@gitlab/ui';
GlEmptyState,
GlLoadingIcon,
GlFormInput,
GlPagination,
GlDeprecatedDropdown,
} from '@gitlab/ui';
import stubChildren from 'helpers/stub_children'; import stubChildren from 'helpers/stub_children';
import ErrorTrackingList from '~/error_tracking/components/error_tracking_list.vue'; import ErrorTrackingList from '~/error_tracking/components/error_tracking_list.vue';
import ErrorTrackingActions from '~/error_tracking/components/error_tracking_actions.vue'; import ErrorTrackingActions from '~/error_tracking/components/error_tracking_actions.vue';
...@@ -24,19 +18,19 @@ describe('ErrorTrackingList', () => { ...@@ -24,19 +18,19 @@ describe('ErrorTrackingList', () => {
const findErrorListTable = () => wrapper.find('table'); const findErrorListTable = () => wrapper.find('table');
const findErrorListRows = () => wrapper.findAll('tbody tr'); const findErrorListRows = () => wrapper.findAll('tbody tr');
const dropdownsArray = () => wrapper.findAll(GlDeprecatedDropdown); const dropdownsArray = () => wrapper.findAll(GlDropdown);
const findRecentSearchesDropdown = () => const findRecentSearchesDropdown = () =>
dropdownsArray() dropdownsArray()
.at(0) .at(0)
.find(GlDeprecatedDropdown); .find(GlDropdown);
const findStatusFilterDropdown = () => const findStatusFilterDropdown = () =>
dropdownsArray() dropdownsArray()
.at(1) .at(1)
.find(GlDeprecatedDropdown); .find(GlDropdown);
const findSortDropdown = () => const findSortDropdown = () =>
dropdownsArray() dropdownsArray()
.at(2) .at(2)
.find(GlDeprecatedDropdown); .find(GlDropdown);
const findLoadingIcon = () => wrapper.find(GlLoadingIcon); const findLoadingIcon = () => wrapper.find(GlLoadingIcon);
const findPagination = () => wrapper.find(GlPagination); const findPagination = () => wrapper.find(GlPagination);
const findErrorActions = () => wrapper.find(ErrorTrackingActions); const findErrorActions = () => wrapper.find(ErrorTrackingActions);
...@@ -134,8 +128,8 @@ describe('ErrorTrackingList', () => { ...@@ -134,8 +128,8 @@ describe('ErrorTrackingList', () => {
mountComponent({ mountComponent({
stubs: { stubs: {
GlTable: false, GlTable: false,
GlDeprecatedDropdown: false, GlDropdown: false,
GlDeprecatedDropdownItem: false, GlDropdownItem: false,
GlLink: false, GlLink: false,
}, },
}); });
...@@ -205,8 +199,8 @@ describe('ErrorTrackingList', () => { ...@@ -205,8 +199,8 @@ describe('ErrorTrackingList', () => {
mountComponent({ mountComponent({
stubs: { stubs: {
GlTable: false, GlTable: false,
GlDeprecatedDropdown: false, GlDropdown: false,
GlDeprecatedDropdownItem: false, GlDropdownItem: false,
}, },
}); });
}); });
...@@ -325,8 +319,8 @@ describe('ErrorTrackingList', () => { ...@@ -325,8 +319,8 @@ describe('ErrorTrackingList', () => {
beforeEach(() => { beforeEach(() => {
mountComponent({ mountComponent({
stubs: { stubs: {
GlDeprecatedDropdown: false, GlDropdown: false,
GlDeprecatedDropdownItem: false, GlDropdownItem: false,
}, },
}); });
}); });
......
import { pick, clone } from 'lodash'; import { pick, clone } from 'lodash';
import Vuex from 'vuex'; import Vuex from 'vuex';
import { createLocalVue, shallowMount } from '@vue/test-utils'; import { createLocalVue, shallowMount } from '@vue/test-utils';
import { GlDeprecatedDropdown, GlDeprecatedDropdownItem } from '@gitlab/ui'; import { GlDropdown, GlDropdownItem } from '@gitlab/ui';
import ProjectDropdown from '~/error_tracking_settings/components/project_dropdown.vue'; import ProjectDropdown from '~/error_tracking_settings/components/project_dropdown.vue';
import { defaultProps, projectList, staleProject } from '../mock'; import { defaultProps, projectList, staleProject } from '../mock';
...@@ -43,7 +43,7 @@ describe('error tracking settings project dropdown', () => { ...@@ -43,7 +43,7 @@ describe('error tracking settings project dropdown', () => {
describe('empty project list', () => { describe('empty project list', () => {
it('renders the dropdown', () => { it('renders the dropdown', () => {
expect(wrapper.find('#project-dropdown').exists()).toBeTruthy(); expect(wrapper.find('#project-dropdown').exists()).toBeTruthy();
expect(wrapper.find(GlDeprecatedDropdown).exists()).toBeTruthy(); expect(wrapper.find(GlDropdown).exists()).toBeTruthy();
}); });
it('shows helper text', () => { it('shows helper text', () => {
...@@ -58,8 +58,8 @@ describe('error tracking settings project dropdown', () => { ...@@ -58,8 +58,8 @@ describe('error tracking settings project dropdown', () => {
}); });
it('does not contain any dropdown items', () => { it('does not contain any dropdown items', () => {
expect(wrapper.find(GlDeprecatedDropdownItem).exists()).toBeFalsy(); expect(wrapper.find(GlDropdownItem).exists()).toBeFalsy();
expect(wrapper.find(GlDeprecatedDropdown).props('text')).toBe('No projects available'); expect(wrapper.find(GlDropdown).props('text')).toBe('No projects available');
}); });
}); });
...@@ -72,12 +72,12 @@ describe('error tracking settings project dropdown', () => { ...@@ -72,12 +72,12 @@ describe('error tracking settings project dropdown', () => {
it('renders the dropdown', () => { it('renders the dropdown', () => {
expect(wrapper.find('#project-dropdown').exists()).toBeTruthy(); expect(wrapper.find('#project-dropdown').exists()).toBeTruthy();
expect(wrapper.find(GlDeprecatedDropdown).exists()).toBeTruthy(); expect(wrapper.find(GlDropdown).exists()).toBeTruthy();
}); });
it('contains a number of dropdown items', () => { it('contains a number of dropdown items', () => {
expect(wrapper.find(GlDeprecatedDropdownItem).exists()).toBeTruthy(); expect(wrapper.find(GlDropdownItem).exists()).toBeTruthy();
expect(wrapper.findAll(GlDeprecatedDropdownItem).length).toBe(2); expect(wrapper.findAll(GlDropdownItem).length).toBe(2);
}); });
}); });
......
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