Commit f7549fc3 authored by Jose Ivan Vargas's avatar Jose Ivan Vargas

Merge branch 'dashboard-button-swap' into 'master'

Replace deprecated buttons in dashboard header

See merge request gitlab-org/gitlab!38830
parents c94eab1b 4c6d860e
...@@ -3,8 +3,6 @@ import { debounce } from 'lodash'; ...@@ -3,8 +3,6 @@ import { debounce } from 'lodash';
import { mapActions, mapState, mapGetters } from 'vuex'; import { mapActions, mapState, mapGetters } from 'vuex';
import { import {
GlButton, GlButton,
GlIcon,
GlDeprecatedButton,
GlDeprecatedDropdown, GlDeprecatedDropdown,
GlDeprecatedDropdownItem, GlDeprecatedDropdownItem,
GlDeprecatedDropdownHeader, GlDeprecatedDropdownHeader,
...@@ -39,8 +37,6 @@ export default { ...@@ -39,8 +37,6 @@ export default {
components: { components: {
Icon, Icon,
GlButton, GlButton,
GlIcon,
GlDeprecatedButton,
GlDeprecatedDropdown, GlDeprecatedDropdown,
GlLoadingIcon, GlLoadingIcon,
GlDeprecatedDropdownItem, GlDeprecatedDropdownItem,
...@@ -305,38 +301,37 @@ export default { ...@@ -305,38 +301,37 @@ export default {
selectedDashboard.starred ? $options.i18n.unstarDashboard : $options.i18n.starDashboard selectedDashboard.starred ? $options.i18n.unstarDashboard : $options.i18n.starDashboard
" "
> >
<gl-deprecated-button <gl-button
ref="toggleStarBtn" ref="toggleStarBtn"
class="w-100" class="w-100"
:disabled="isUpdatingStarredValue" :disabled="isUpdatingStarredValue"
variant="default" variant="default"
:icon="selectedDashboard.starred ? 'star' : 'star-o'"
@click="toggleStarredValue()" @click="toggleStarredValue()"
> />
<gl-icon :name="selectedDashboard.starred ? 'star' : 'star-o'" />
</gl-deprecated-button>
</div> </div>
</div> </div>
<div v-if="showRearrangePanelsBtn" class="mb-2 mr-2 d-flex"> <div v-if="showRearrangePanelsBtn" class="mb-2 mr-2 d-flex">
<gl-deprecated-button <gl-button
:pressed="isRearrangingPanels" :pressed="isRearrangingPanels"
variant="default" variant="default"
class="flex-grow-1 js-rearrange-button" class="flex-grow-1 js-rearrange-button"
@click="toggleRearrangingPanels" @click="toggleRearrangingPanels"
> >
{{ __('Arrange charts') }} {{ __('Arrange charts') }}
</gl-deprecated-button> </gl-button>
</div> </div>
<div v-if="addingMetricsAvailable" class="mb-2 mr-2 d-flex d-sm-block"> <div v-if="addingMetricsAvailable" class="mb-2 mr-2 d-flex d-sm-block">
<gl-deprecated-button <gl-button
ref="addMetricBtn" ref="addMetricBtn"
v-gl-modal="$options.modalIds.addMetric" v-gl-modal="$options.modalIds.addMetric"
variant="outline-success" variant="default"
data-qa-selector="add_metric_button" data-qa-selector="add_metric_button"
class="flex-grow-1" class="flex-grow-1"
> >
{{ $options.i18n.addMetric }} {{ $options.i18n.addMetric }}
</gl-deprecated-button> </gl-button>
<gl-modal <gl-modal
ref="addMetricModal" ref="addMetricModal"
:modal-id="$options.modalIds.addMetric" :modal-id="$options.modalIds.addMetric"
...@@ -350,18 +345,19 @@ export default { ...@@ -350,18 +345,19 @@ 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
ref="submitCustomMetricsFormBtn" ref="submitCustomMetricsFormBtn"
v-track-event="getAddMetricTrackingOptions()" v-track-event="getAddMetricTrackingOptions()"
:disabled="!formIsValid" :disabled="!formIsValid"
variant="success" variant="success"
category="primary"
@click="submitCustomMetricsForm" @click="submitCustomMetricsForm"
> >
{{ __('Save changes') }} {{ __('Save changes') }}
</gl-deprecated-button> </gl-button>
</div> </div>
</gl-modal> </gl-modal>
</div> </div>
...@@ -370,28 +366,29 @@ export default { ...@@ -370,28 +366,29 @@ export default {
v-if="selectedDashboard && selectedDashboard.can_edit" v-if="selectedDashboard && selectedDashboard.can_edit"
class="mb-2 mr-2 d-flex d-sm-block" class="mb-2 mr-2 d-flex d-sm-block"
> >
<gl-deprecated-button <gl-button
class="flex-grow-1 js-edit-link" class="flex-grow-1 js-edit-link"
:href="selectedDashboard.project_blob_path" :href="selectedDashboard.project_blob_path"
data-qa-selector="edit_dashboard_button" data-qa-selector="edit_dashboard_button"
> >
{{ __('Edit dashboard') }} {{ __('Edit dashboard') }}
</gl-deprecated-button> </gl-button>
</div> </div>
<div <div
v-if="externalDashboardUrl && externalDashboardUrl.length" v-if="externalDashboardUrl && externalDashboardUrl.length"
class="mb-2 mr-2 d-flex d-sm-block" class="mb-2 mr-2 d-flex d-sm-block"
> >
<gl-deprecated-button <gl-button
class="flex-grow-1 js-external-dashboard-link" class="flex-grow-1 js-external-dashboard-link"
variant="primary" variant="info"
category="primary"
:href="externalDashboardUrl" :href="externalDashboardUrl"
target="_blank" target="_blank"
rel="noopener noreferrer" rel="noopener noreferrer"
> >
{{ __('View full dashboard') }} <icon name="external-link" /> {{ __('View full dashboard') }} <icon name="external-link" />
</gl-deprecated-button> </gl-button>
</div> </div>
<!-- This separator should be displayed only if at least one of the action menu or settings button are displayed --> <!-- This separator should be displayed only if at least one of the action menu or settings button are displayed -->
......
---
title: Replace deprecated buttons in dashboard header
merge_request: 38830
author:
type: other
...@@ -106,16 +106,13 @@ exports[`Dashboard template matches the default snapshot 1`] = ` ...@@ -106,16 +106,13 @@ exports[`Dashboard template matches the default snapshot 1`] = `
class="flex-grow-1" class="flex-grow-1"
title="Star dashboard" title="Star dashboard"
> >
<gl-deprecated-button-stub <gl-button-stub
category="tertiary"
class="w-100" class="w-100"
size="md" icon="star-o"
size="medium"
variant="default" variant="default"
>
<gl-icon-stub
name="star-o"
size="16"
/> />
</gl-deprecated-button-stub>
</div> </div>
</div> </div>
......
import { shallowMount, mount } from '@vue/test-utils'; import { shallowMount, mount } from '@vue/test-utils';
import Tracking from '~/tracking'; import Tracking from '~/tracking';
import { ESC_KEY, ESC_KEY_IE11 } from '~/lib/utils/keys'; import { ESC_KEY, ESC_KEY_IE11 } from '~/lib/utils/keys';
import { GlModal, GlDeprecatedButton, GlIcon } from '@gitlab/ui'; import { GlModal, GlButton } from '@gitlab/ui';
import { objectToQuery } from '~/lib/utils/url_utility'; import { objectToQuery } from '~/lib/utils/url_utility';
import VueDraggable from 'vuedraggable'; import VueDraggable from 'vuedraggable';
import MockAdapter from 'axios-mock-adapter'; import MockAdapter from 'axios-mock-adapter';
...@@ -448,7 +448,6 @@ describe('Dashboard', () => { ...@@ -448,7 +448,6 @@ describe('Dashboard', () => {
describe('star dashboards', () => { describe('star dashboards', () => {
const findToggleStar = () => findDashboardHeader().find({ ref: 'toggleStarBtn' }); const findToggleStar = () => findDashboardHeader().find({ ref: 'toggleStarBtn' });
const findToggleStarIcon = () => findToggleStar().find(GlIcon);
beforeEach(() => { beforeEach(() => {
createShallowWrapper(); createShallowWrapper();
...@@ -502,7 +501,7 @@ describe('Dashboard', () => { ...@@ -502,7 +501,7 @@ describe('Dashboard', () => {
}); });
it('toggle star button shows an unstarred state', () => { it('toggle star button shows an unstarred state', () => {
expect(findToggleStarIcon().attributes('name')).toBe('star-o'); expect(findToggleStar().attributes('icon')).toBe('star-o');
}); });
}); });
...@@ -519,7 +518,7 @@ describe('Dashboard', () => { ...@@ -519,7 +518,7 @@ describe('Dashboard', () => {
}); });
it('toggle star button shows a starred state', () => { it('toggle star button shows a starred state', () => {
expect(findToggleStarIcon().attributes('name')).toBe('star'); expect(findToggleStar().attributes('icon')).toBe('star');
}); });
}); });
}); });
...@@ -900,7 +899,7 @@ describe('Dashboard', () => { ...@@ -900,7 +899,7 @@ describe('Dashboard', () => {
const externalDashboardButton = wrapper.find('.js-external-dashboard-link'); const externalDashboardButton = wrapper.find('.js-external-dashboard-link');
expect(externalDashboardButton.exists()).toBe(true); expect(externalDashboardButton.exists()).toBe(true);
expect(externalDashboardButton.is(GlDeprecatedButton)).toBe(true); expect(externalDashboardButton.is(GlButton)).toBe(true);
expect(externalDashboardButton.text()).toContain('View full dashboard'); expect(externalDashboardButton.text()).toContain('View full dashboard');
}); });
}); });
......
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