Commit 113a6c0e authored by Kushal Pandya's avatar Kushal Pandya

Merge branch...

Merge branch '235471-follow-up-from-improve-productivity-analytics-error-when-query-takes-too-long-to-calculate' into 'master'

Productivity Analytics: Replace bs-callout with GlAlert component

Closes #235471

See merge request gitlab-org/gitlab!39207
parents cf7efbd4 5073e727
<script> <script>
import { isEmpty } from 'lodash'; import { isEmpty } from 'lodash';
import { GlDeprecatedDropdown, GlDeprecatedDropdownItem, GlLoadingIcon } from '@gitlab/ui'; import { GlDeprecatedDropdown, GlDeprecatedDropdownItem, GlLoadingIcon, GlAlert } from '@gitlab/ui';
import { s__ } from '~/locale'; import { s__ } from '~/locale';
import Icon from '~/vue_shared/components/icon.vue'; import Icon from '~/vue_shared/components/icon.vue';
import httpStatusCodes from '~/lib/utils/http_status'; import httpStatusCodes from '~/lib/utils/http_status';
...@@ -11,6 +11,7 @@ export default { ...@@ -11,6 +11,7 @@ export default {
GlDeprecatedDropdown, GlDeprecatedDropdown,
GlDeprecatedDropdownItem, GlDeprecatedDropdownItem,
GlLoadingIcon, GlLoadingIcon,
GlAlert,
Icon, Icon,
}, },
props: { props: {
...@@ -88,9 +89,7 @@ export default { ...@@ -88,9 +89,7 @@ export default {
<h5 v-if="title">{{ title }}</h5> <h5 v-if="title">{{ title }}</h5>
<gl-loading-icon v-if="isLoading" size="md" class="my-4 py-4" /> <gl-loading-icon v-if="isLoading" size="md" class="my-4 py-4" />
<template v-else> <template v-else>
<div v-if="infoMessage" data-testid="infoMessage" class="bs-callout bs-callout-info"> <gl-alert v-if="infoMessage" :dismissible="false">{{ infoMessage }}</gl-alert>
{{ infoMessage }}
</div>
<template v-else> <template v-else>
<gl-deprecated-dropdown <gl-deprecated-dropdown
v-if="hasMetricTypes" v-if="hasMetricTypes"
......
---
title: 'Productivity Analytics: Replace bs-callout with GlAlert component'
merge_request: 39207
author:
type: changed
...@@ -4,14 +4,17 @@ exports[`MetricChart component template when isLoading is false and chart data i ...@@ -4,14 +4,17 @@ exports[`MetricChart component template when isLoading is false and chart data i
<div> <div>
<!----> <!---->
<div <gl-alert-stub
class="bs-callout bs-callout-info" dismisslabel="Dismiss"
data-testid="infoMessage" primarybuttonlink=""
primarybuttontext=""
secondarybuttonlink=""
secondarybuttontext=""
title=""
variant="info"
> >
There is no data available. Please change your selection.
There is no data available. Please change your selection. </gl-alert-stub>
</div>
</div> </div>
`; `;
......
import { shallowMount } from '@vue/test-utils'; import { shallowMount } from '@vue/test-utils';
import MetricChart from 'ee/analytics/productivity_analytics/components/metric_chart.vue'; import MetricChart from 'ee/analytics/productivity_analytics/components/metric_chart.vue';
import { GlLoadingIcon, GlDeprecatedDropdown, GlDeprecatedDropdownItem } from '@gitlab/ui'; import { GlLoadingIcon, GlDeprecatedDropdown, GlDeprecatedDropdownItem, GlAlert } from '@gitlab/ui';
import Icon from '~/vue_shared/components/icon.vue'; import Icon from '~/vue_shared/components/icon.vue';
import httpStatusCodes from '~/lib/utils/http_status'; import httpStatusCodes from '~/lib/utils/http_status';
...@@ -38,7 +38,7 @@ describe('MetricChart component', () => { ...@@ -38,7 +38,7 @@ describe('MetricChart component', () => {
}); });
const findLoadingIndicator = () => wrapper.find(GlLoadingIcon); const findLoadingIndicator = () => wrapper.find(GlLoadingIcon);
const findInfoMessage = () => wrapper.find('[data-testid="infoMessage"]'); const findInfoMessage = () => wrapper.find(GlAlert);
const findMetricDropdown = () => wrapper.find(GlDeprecatedDropdown); const findMetricDropdown = () => wrapper.find(GlDeprecatedDropdown);
const findMetricDropdownItems = () => findMetricDropdown().findAll(GlDeprecatedDropdownItem); const findMetricDropdownItems = () => findMetricDropdown().findAll(GlDeprecatedDropdownItem);
const findChartSlot = () => wrapper.find({ ref: 'chart' }); const findChartSlot = () => wrapper.find({ ref: 'chart' });
...@@ -101,7 +101,7 @@ describe('MetricChart component', () => { ...@@ -101,7 +101,7 @@ describe('MetricChart component', () => {
describe('and there is no error', () => { describe('and there is no error', () => {
it('shows a "no data" info text', () => { it('shows a "no data" info text', () => {
expect(findInfoMessage().text()).toContain( expect(findInfoMessage().text()).toBe(
'There is no data available. Please change your selection.', 'There is no data available. Please change your selection.',
); );
}); });
...@@ -111,7 +111,7 @@ describe('MetricChart component', () => { ...@@ -111,7 +111,7 @@ describe('MetricChart component', () => {
it('shows a "too much data" info text', () => { it('shows a "too much data" info text', () => {
factory({ isLoading, chartData: [], errorCode: httpStatusCodes.INTERNAL_SERVER_ERROR }); factory({ isLoading, chartData: [], errorCode: httpStatusCodes.INTERNAL_SERVER_ERROR });
expect(findInfoMessage().text()).toContain( expect(findInfoMessage().text()).toBe(
'There is too much data to calculate. Please change your selection.', 'There is too much data to calculate. Please change your selection.',
); );
}); });
......
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