Commit bc4cabb7 authored by Taurie Davis's avatar Taurie Davis

Migrate analytics bs-callout to gl-alert

parent 5f5c0dae
<script> <script>
import { mapActions, mapState, mapGetters } from 'vuex'; import { mapActions, mapState, mapGetters } from 'vuex';
import { GlAlert } from '@gitlab/ui';
import { __ } from '~/locale'; import { __ } from '~/locale';
import ChartSkeletonLoader from '~/vue_shared/components/resizable_chart/skeleton_loader.vue'; import ChartSkeletonLoader from '~/vue_shared/components/resizable_chart/skeleton_loader.vue';
import { dateFormats } from '../../shared/constants'; import { dateFormats } from '../../shared/constants';
...@@ -9,6 +10,7 @@ import StageDropdownFilter from './stage_dropdown_filter.vue'; ...@@ -9,6 +10,7 @@ import StageDropdownFilter from './stage_dropdown_filter.vue';
export default { export default {
name: 'DurationChart', name: 'DurationChart',
components: { components: {
GlAlert,
Scatterplot, Scatterplot,
StageDropdownFilter, StageDropdownFilter,
ChartSkeletonLoader, ChartSkeletonLoader,
...@@ -58,8 +60,8 @@ export default { ...@@ -58,8 +60,8 @@ export default {
:tooltip-date-format="$options.durationChartTooltipDateFormat" :tooltip-date-format="$options.durationChartTooltipDateFormat"
:scatter-data="durationChartPlottableData" :scatter-data="durationChartPlottableData"
/> />
<div v-else class="bs-callout bs-callout-info"> <gl-alert v-else variant="info" :dismissible="false" class="gl-mt-3">
{{ error }} {{ error }}
</div> </gl-alert>
</div> </div>
</template> </template>
<script> <script>
import { mapActions, mapGetters, mapState } from 'vuex'; import { mapActions, mapGetters, mapState } from 'vuex';
import { GlAlert } from '@gitlab/ui';
import ChartSkeletonLoader from '~/vue_shared/components/resizable_chart/skeleton_loader.vue'; import ChartSkeletonLoader from '~/vue_shared/components/resizable_chart/skeleton_loader.vue';
import TasksByTypeChart from './tasks_by_type/tasks_by_type_chart.vue'; import TasksByTypeChart from './tasks_by_type/tasks_by_type_chart.vue';
import TasksByTypeFilters from './tasks_by_type/tasks_by_type_filters.vue'; import TasksByTypeFilters from './tasks_by_type/tasks_by_type_filters.vue';
...@@ -9,7 +10,7 @@ import { TASKS_BY_TYPE_SUBJECT_ISSUE } from '../constants'; ...@@ -9,7 +10,7 @@ import { TASKS_BY_TYPE_SUBJECT_ISSUE } from '../constants';
export default { export default {
name: 'TypeOfWorkCharts', name: 'TypeOfWorkCharts',
components: { ChartSkeletonLoader, TasksByTypeChart, TasksByTypeFilters }, components: { ChartSkeletonLoader, GlAlert, TasksByTypeChart, TasksByTypeFilters },
computed: { computed: {
...mapState('typeOfWork', [ ...mapState('typeOfWork', [
'isLoadingTasksByTypeChart', 'isLoadingTasksByTypeChart',
...@@ -88,9 +89,9 @@ export default { ...@@ -88,9 +89,9 @@ export default {
:group-by="tasksByTypeChartData.groupBy" :group-by="tasksByTypeChartData.groupBy"
:series-names="tasksByTypeChartData.seriesNames" :series-names="tasksByTypeChartData.seriesNames"
/> />
<div v-else class="bs-callout bs-callout-info"> <gl-alert v-else variant="info" :dismissible="false" class="gl-mt-3">
<p>{{ error }}</p> {{ error }}
</div> </gl-alert>
</div> </div>
</div> </div>
</template> </template>
...@@ -8,6 +8,7 @@ import { ...@@ -8,6 +8,7 @@ import {
GlButton, GlButton,
GlTooltipDirective, GlTooltipDirective,
GlIcon, GlIcon,
GlAlert,
} from '@gitlab/ui'; } from '@gitlab/ui';
import dateFormat from 'dateformat'; import dateFormat from 'dateformat';
import { GlColumnChart } from '@gitlab/ui/dist/charts'; import { GlColumnChart } from '@gitlab/ui/dist/charts';
...@@ -29,6 +30,7 @@ export default { ...@@ -29,6 +30,7 @@ export default {
GlColumnChart, GlColumnChart,
GlButton, GlButton,
GlIcon, GlIcon,
GlAlert,
MetricChart, MetricChart,
Scatterplot, Scatterplot,
MergeRequestTable, MergeRequestTable,
...@@ -344,9 +346,9 @@ export default { ...@@ -344,9 +346,9 @@ export default {
@columnMetricChange="setColumnMetric" @columnMetricChange="setColumnMetric"
@pageChange="setPage" @pageChange="setPage"
/> />
<div v-if="showMergeRequestTableNoData" class="js-no-data bs-callout bs-callout-info"> <gl-alert v-if="showMergeRequestTableNoData" variant="info" :dismissable="false">
{{ __('There is no data available. Please change your selection.') }} {{ __('There is no data available. Please change your selection.') }}
</div> </gl-alert>
</div> </div>
</template> </template>
</template> </template>
......
---
title: Migrate analytics bs-callout to gl-alert
merge_request: 40788
author:
type: deprecated
import Vuex from 'vuex'; import Vuex from 'vuex';
import { shallowMount, mount, createLocalVue } from '@vue/test-utils';
import { GlDropdownItem } from '@gitlab/ui'; import { GlDropdownItem } from '@gitlab/ui';
import { shallowMount, mount, createLocalVue } from '@vue/test-utils';
import Scatterplot from 'ee/analytics/shared/components/scatterplot.vue'; import Scatterplot from 'ee/analytics/shared/components/scatterplot.vue';
import DurationChart from 'ee/analytics/cycle_analytics/components/duration_chart.vue'; import DurationChart from 'ee/analytics/cycle_analytics/components/duration_chart.vue';
import StageDropdownFilter from 'ee/analytics/cycle_analytics/components/stage_dropdown_filter.vue'; import StageDropdownFilter from 'ee/analytics/cycle_analytics/components/stage_dropdown_filter.vue';
......
...@@ -8,7 +8,14 @@ import MergeRequestTable from 'ee/analytics/productivity_analytics/components/mr ...@@ -8,7 +8,14 @@ import MergeRequestTable from 'ee/analytics/productivity_analytics/components/mr
import { getStoreConfig } from 'ee/analytics/productivity_analytics/store'; import { getStoreConfig } from 'ee/analytics/productivity_analytics/store';
import { chartKeys } from 'ee/analytics/productivity_analytics/constants'; import { chartKeys } from 'ee/analytics/productivity_analytics/constants';
import { TEST_HOST } from 'helpers/test_constants'; import { TEST_HOST } from 'helpers/test_constants';
import { GlEmptyState, GlLoadingIcon, GlDropdown, GlDropdownItem, GlButton } from '@gitlab/ui'; import {
GlEmptyState,
GlLoadingIcon,
GlDropdown,
GlDropdownItem,
GlButton,
GlAlert,
} from '@gitlab/ui';
import { GlColumnChart } from '@gitlab/ui/dist/charts'; import { GlColumnChart } from '@gitlab/ui/dist/charts';
import UrlSyncMixin from 'ee/analytics/shared/mixins/url_sync_mixin'; import UrlSyncMixin from 'ee/analytics/shared/mixins/url_sync_mixin';
import MetricChart from 'ee/analytics/productivity_analytics/components/metric_chart.vue'; import MetricChart from 'ee/analytics/productivity_analytics/components/metric_chart.vue';
...@@ -427,7 +434,7 @@ describe('ProductivityApp component', () => { ...@@ -427,7 +434,7 @@ describe('ProductivityApp component', () => {
it('doesn’t render a "no data" message', () => { it('doesn’t render a "no data" message', () => {
expect( expect(
findMrTableSection() findMrTableSection()
.find('.js-no-data') .find(GlAlert)
.exists(), .exists(),
).toBe(false); ).toBe(false);
}); });
...@@ -478,7 +485,7 @@ describe('ProductivityApp component', () => { ...@@ -478,7 +485,7 @@ describe('ProductivityApp component', () => {
it('renders a "no data" message', () => { it('renders a "no data" message', () => {
expect( expect(
findMrTableSection() findMrTableSection()
.find('.js-no-data') .find(GlAlert)
.exists(), .exists(),
).toBe(true); ).toBe(true);
}); });
......
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