Commit a99f075f authored by Kushal Pandya's avatar Kushal Pandya

Merge branch '294120-migrate-deprecated-buttons' into 'master'

Migrate remaining occurrences of GlDeprecatedButton to GlButton

See merge request gitlab-org/gitlab!50210
parents 95cd17e0 92ed71e3
<script> <script>
import { debounce } from 'lodash'; import { debounce } from 'lodash';
import { GlDeprecatedButton, GlSearchBoxByType } from '@gitlab/ui'; import { GlButton, GlSearchBoxByType } from '@gitlab/ui';
import axios from '~/lib/utils/axios_utils'; import axios from '~/lib/utils/axios_utils';
import { __ } from '~/locale'; import { __ } from '~/locale';
import { deprecatedCreateFlash as createFlash } from '~/flash'; import { deprecatedCreateFlash as createFlash } from '~/flash';
...@@ -28,7 +28,7 @@ import { deprecatedCreateFlash as createFlash } from '~/flash'; ...@@ -28,7 +28,7 @@ import { deprecatedCreateFlash as createFlash } from '~/flash';
export default { export default {
name: 'EnvironmentsSearchableInput', name: 'EnvironmentsSearchableInput',
components: { components: {
GlDeprecatedButton, GlButton,
GlSearchBoxByType, GlSearchBoxByType,
}, },
props: { props: {
...@@ -159,19 +159,20 @@ export default { ...@@ -159,19 +159,20 @@ export default {
<div class="dropdown-content"> <div class="dropdown-content">
<ul v-if="results.length"> <ul v-if="results.length">
<li v-for="(result, i) in results" :key="i"> <li v-for="(result, i) in results" :key="i">
<gl-deprecated-button class="btn-transparent" @click="selectEnvironment(result)">{{ <gl-button category="tertiary" @click="selectEnvironment(result)">{{
result result
}}</gl-deprecated-button> }}</gl-button>
</li> </li>
</ul> </ul>
<div v-else-if="!results.length" class="text-secondary gl-p-3"> <div v-else-if="!results.length" class="text-secondary gl-p-3">
{{ __('No matching results') }} {{ __('No matching results') }}
</div> </div>
<div v-if="shouldRenderCreateButton" class="dropdown-footer"> <div v-if="shouldRenderCreateButton" class="dropdown-footer">
<gl-deprecated-button <gl-button
class="js-create-button btn-blank dropdown-item" category="tertiary"
class="js-create-button dropdown-item"
@click="createClicked" @click="createClicked"
>{{ composedCreateButtonLabel }}</gl-deprecated-button >{{ composedCreateButtonLabel }}</gl-button
> >
</div> </div>
</div> </div>
......
<script> <script>
import { mapState, mapGetters, mapActions } from 'vuex'; import { mapState, mapGetters, mapActions } from 'vuex';
import { import {
GlDeprecatedButton, GlButton,
GlDropdown, GlDropdown,
GlDropdownDivider, GlDropdownDivider,
GlDropdownItem, GlDropdownItem,
...@@ -22,7 +22,7 @@ import { getAddMetricTrackingOptions } from '../utils'; ...@@ -22,7 +22,7 @@ import { getAddMetricTrackingOptions } from '../utils';
export default { export default {
components: { components: {
GlDeprecatedButton, GlButton,
GlDropdown, GlDropdown,
GlDropdownDivider, GlDropdownDivider,
GlDropdownItem, GlDropdownItem,
...@@ -178,10 +178,10 @@ export default { ...@@ -178,10 +178,10 @@ export default {
/> />
</form> </form>
<div slot="modal-footer"> <div slot="modal-footer">
<gl-deprecated-button @click="hideAddMetricModal"> <gl-button @click="hideAddMetricModal">
{{ __('Cancel') }} {{ __('Cancel') }}
</gl-deprecated-button> </gl-button>
<gl-deprecated-button <gl-button
v-track-event="getAddMetricTrackingOptions()" v-track-event="getAddMetricTrackingOptions()"
data-testid="add-metric-modal-submit-button" data-testid="add-metric-modal-submit-button"
:disabled="!customMetricsFormIsValid" :disabled="!customMetricsFormIsValid"
...@@ -189,7 +189,7 @@ export default { ...@@ -189,7 +189,7 @@ export default {
@click="submitCustomMetricsForm" @click="submitCustomMetricsForm"
> >
{{ __('Save changes') }} {{ __('Save changes') }}
</gl-deprecated-button> </gl-button>
</div> </div>
</gl-modal> </gl-modal>
</template> </template>
......
<script> <script>
import { mapActions, mapGetters, mapState } from 'vuex'; import { mapActions, mapGetters, mapState } from 'vuex';
import { import { GlEmptyState, GlIcon, GlLoadingIcon, GlSprintf, GlLink, GlButton } from '@gitlab/ui';
GlEmptyState,
GlIcon,
GlLoadingIcon,
GlSprintf,
GlLink,
GlDeprecatedButton,
} from '@gitlab/ui';
import { __ } from '~/locale'; import { __ } from '~/locale';
import DependenciesActions from './dependencies_actions.vue'; import DependenciesActions from './dependencies_actions.vue';
import DependencyListIncompleteAlert from './dependency_list_incomplete_alert.vue'; import DependencyListIncompleteAlert from './dependency_list_incomplete_alert.vue';
...@@ -25,7 +18,7 @@ export default { ...@@ -25,7 +18,7 @@ export default {
GlLoadingIcon, GlLoadingIcon,
GlSprintf, GlSprintf,
GlLink, GlLink,
GlDeprecatedButton, GlButton,
DependencyListIncompleteAlert, DependencyListIncompleteAlert,
DependencyListJobFailedAlert, DependencyListJobFailedAlert,
PaginatedDependenciesTable, PaginatedDependenciesTable,
...@@ -133,9 +126,9 @@ export default { ...@@ -133,9 +126,9 @@ export default {
:svg-path="emptyStateSvgPath" :svg-path="emptyStateSvgPath"
> >
<template #actions> <template #actions>
<gl-deprecated-button variant="info" :href="emptyStateOptions.link"> <gl-button variant="info" :href="emptyStateOptions.link">
{{ emptyStateOptions.buttonLabel }} {{ emptyStateOptions.buttonLabel }}
</gl-deprecated-button> </gl-button>
</template> </template>
</gl-empty-state> </gl-empty-state>
......
<script> <script>
import { import {
GlIcon, GlIcon,
GlDeprecatedButton as GlButton, GlButton,
GlLoadingIcon, GlLoadingIcon,
GlTooltipDirective as GlTooltip, GlTooltipDirective as GlTooltip,
GlDropdownItem, GlDropdownItem,
...@@ -151,7 +151,7 @@ export default { ...@@ -151,7 +151,7 @@ export default {
<gl-button <gl-button
ref="editButton" ref="editButton"
variant="link" variant="link"
class="edit-link btn-link-hover" class="edit-link btn-link-hover gl-text-black-normal!"
:disabled="!isEditable" :disabled="!isEditable"
@click.stop="toggleFormDropdown" @click.stop="toggleFormDropdown"
@keydown.esc="hideDropdown" @keydown.esc="hideDropdown"
...@@ -188,7 +188,7 @@ export default { ...@@ -188,7 +188,7 @@ export default {
<gl-dropdown-item @click="handleDropdownClick(null)"> <gl-dropdown-item @click="handleDropdownClick(null)">
<gl-button <gl-button
variant="link" variant="link"
class="dropdown-item health-dropdown-item" class="dropdown-item health-dropdown-item gl-px-8!"
:class="{ 'is-active': isSelected(null) }" :class="{ 'is-active': isSelected(null) }"
> >
{{ s__('Sidebar|No status') }} {{ s__('Sidebar|No status') }}
...@@ -204,7 +204,7 @@ export default { ...@@ -204,7 +204,7 @@ export default {
> >
<gl-button <gl-button
variant="link" variant="link"
class="dropdown-item health-dropdown-item" class="dropdown-item health-dropdown-item gl-px-8!"
:class="{ 'is-active': isSelected(option.key) }" :class="{ 'is-active': isSelected(option.key) }"
> >
{{ option.value }} {{ option.value }}
......
<script> <script>
import { GlButton, GlDeprecatedButton } from '@gitlab/ui'; import { GlButton } from '@gitlab/ui';
import { __ } from '~/locale'; import { __ } from '~/locale';
import UserAvatarList from '~/vue_shared/components/user_avatar/user_avatar_list.vue'; import UserAvatarList from '~/vue_shared/components/user_avatar/user_avatar_list.vue';
import ApprovalsList from './approvals_list.vue'; import ApprovalsList from './approvals_list.vue';
...@@ -7,7 +7,6 @@ import ApprovalsList from './approvals_list.vue'; ...@@ -7,7 +7,6 @@ import ApprovalsList from './approvals_list.vue';
export default { export default {
components: { components: {
GlButton, GlButton,
GlDeprecatedButton,
UserAvatarList, UserAvatarList,
ApprovalsList, ApprovalsList,
}, },
...@@ -81,14 +80,14 @@ export default { ...@@ -81,14 +80,14 @@ export default {
/> />
<template v-if="isCollapsed"> <template v-if="isCollapsed">
<user-avatar-list :items="suggestedApproversTrimmed" :breakpoint="0" empty-text="" /> <user-avatar-list :items="suggestedApproversTrimmed" :breakpoint="0" empty-text="" />
<gl-deprecated-button variant="link" @click="toggle">{{ <gl-button data-testid="approvers-expand-button" variant="link" @click="toggle">{{
__('View eligible approvers') __('View eligible approvers')
}}</gl-deprecated-button> }}</gl-button>
</template> </template>
<template v-else> <template v-else>
<gl-deprecated-button variant="link" @click="toggle">{{ <gl-button data-testid="approvers-collapse-button" variant="link" @click="toggle">{{
__('Collapse') __('Collapse')
}}</gl-deprecated-button> }}</gl-button>
</template> </template>
</div> </div>
<div v-if="!isCollapsed && approvalRules.length" class="border-top"> <div v-if="!isCollapsed && approvalRules.length" class="border-top">
......
import { GlDeprecatedButton, GlButton, GlLoadingIcon, GlIcon } from '@gitlab/ui'; import { GlButton, GlLoadingIcon, GlIcon } from '@gitlab/ui';
import { mount } from '@vue/test-utils'; import { mount } from '@vue/test-utils';
import ApprovalsFooter from 'ee/vue_merge_request_widget/components/approvals/approvals_footer.vue'; import ApprovalsFooter from 'ee/vue_merge_request_widget/components/approvals/approvals_footer.vue';
import ApprovalsList from 'ee/vue_merge_request_widget/components/approvals/approvals_list.vue'; import ApprovalsList from 'ee/vue_merge_request_widget/components/approvals/approvals_list.vue';
...@@ -28,8 +28,8 @@ describe('EE MRWidget approvals footer', () => { ...@@ -28,8 +28,8 @@ describe('EE MRWidget approvals footer', () => {
const findToggle = () => wrapper.find(GlButton); const findToggle = () => wrapper.find(GlButton);
const findToggleIcon = () => findToggle().find(GlIcon); const findToggleIcon = () => findToggle().find(GlIcon);
const findToggleLoadingIcon = () => findToggle().find(GlLoadingIcon); const findToggleLoadingIcon = () => findToggle().find(GlLoadingIcon);
const findExpandButton = () => wrapper.find(GlDeprecatedButton); const findExpandButton = () => wrapper.find('[data-testid="approvers-expand-button"]');
const findCollapseButton = () => wrapper.find(GlDeprecatedButton); const findCollapseButton = () => wrapper.find('[data-testid="approvers-collapse-button"]');
const findList = () => wrapper.find(ApprovalsList); const findList = () => wrapper.find(ApprovalsList);
const findAvatars = () => wrapper.find(UserAvatarList); const findAvatars = () => wrapper.find(UserAvatarList);
......
...@@ -243,7 +243,6 @@ describe('ErrorTrackingList', () => { ...@@ -243,7 +243,6 @@ describe('ErrorTrackingList', () => {
stubs: { stubs: {
GlTable: false, GlTable: false,
GlLink: false, GlLink: false,
GlDeprecatedButton: false,
}, },
}); });
}); });
...@@ -274,7 +273,6 @@ describe('ErrorTrackingList', () => { ...@@ -274,7 +273,6 @@ describe('ErrorTrackingList', () => {
stubs: { stubs: {
GlTable: false, GlTable: false,
GlLink: false, GlLink: false,
GlDeprecatedButton: false,
}, },
}); });
}); });
...@@ -454,7 +452,6 @@ describe('ErrorTrackingList', () => { ...@@ -454,7 +452,6 @@ describe('ErrorTrackingList', () => {
stubs: { stubs: {
GlTable: false, GlTable: false,
GlLink: false, GlLink: false,
GlDeprecatedButton: false,
}, },
}); });
}); });
......
import MockAdapter from 'axios-mock-adapter'; import MockAdapter from 'axios-mock-adapter';
import { shallowMount } from '@vue/test-utils'; import { shallowMount } from '@vue/test-utils';
import { GlLoadingIcon, GlDeprecatedButton, GlSearchBoxByType } from '@gitlab/ui'; import { GlLoadingIcon, GlButton, GlSearchBoxByType } from '@gitlab/ui';
import { TEST_HOST } from 'spec/test_constants'; import { TEST_HOST } from 'spec/test_constants';
import waitForPromises from 'helpers/wait_for_promises'; import waitForPromises from 'helpers/wait_for_promises';
import EnvironmentsDropdown from '~/feature_flags/components/environments_dropdown.vue'; import EnvironmentsDropdown from '~/feature_flags/components/environments_dropdown.vue';
...@@ -99,7 +99,7 @@ describe('Feature flags > Environments dropdown ', () => { ...@@ -99,7 +99,7 @@ describe('Feature flags > Environments dropdown ', () => {
it('emits event when a suggestion is clicked', async () => { it('emits event when a suggestion is clicked', async () => {
const button = wrapper const button = wrapper
.findAll(GlDeprecatedButton) .findAll(GlButton)
.filter(b => b.text() === 'production') .filter(b => b.text() === 'production')
.at(0); .at(0);
button.vm.$emit('click'); button.vm.$emit('click');
...@@ -110,7 +110,7 @@ describe('Feature flags > Environments dropdown ', () => { ...@@ -110,7 +110,7 @@ describe('Feature flags > Environments dropdown ', () => {
describe('on click clear button', () => { describe('on click clear button', () => {
beforeEach(async () => { beforeEach(async () => {
wrapper.find(GlDeprecatedButton).vm.$emit('click'); wrapper.find(GlButton).vm.$emit('click');
await wrapper.vm.$nextTick(); await wrapper.vm.$nextTick();
}); });
...@@ -137,7 +137,7 @@ describe('Feature flags > Environments dropdown ', () => { ...@@ -137,7 +137,7 @@ describe('Feature flags > Environments dropdown ', () => {
it('emits create event', async () => { it('emits create event', async () => {
wrapper wrapper
.findAll(GlDeprecatedButton) .findAll(GlButton)
.at(0) .at(0)
.vm.$emit('click'); .vm.$emit('click');
await wrapper.vm.$nextTick(); await wrapper.vm.$nextTick();
......
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