Commit 82c4d61d authored by Brandon Labuschagne's avatar Brandon Labuschagne

Replace throughput chart loading icon

The laoding icon is being replaced with a skeleton chart
laoding component.
parent 7c351e35
<script> <script>
import { GlAreaChart } from '@gitlab/ui/dist/charts'; import { GlAreaChart } from '@gitlab/ui/dist/charts';
import { GlAlert, GlLoadingIcon } from '@gitlab/ui'; import { GlAlert } from '@gitlab/ui';
import ChartSkeletonLoader from '~/vue_shared/components/resizable_chart/skeleton_loader.vue';
import throughputChartQueryBuilder from '../graphql/throughput_chart_query_builder'; import throughputChartQueryBuilder from '../graphql/throughput_chart_query_builder';
import { THROUGHPUT_CHART_STRINGS } from '../constants'; import { THROUGHPUT_CHART_STRINGS } from '../constants';
...@@ -9,7 +10,7 @@ export default { ...@@ -9,7 +10,7 @@ export default {
components: { components: {
GlAreaChart, GlAreaChart,
GlAlert, GlAlert,
GlLoadingIcon, ChartSkeletonLoader,
}, },
inject: ['fullPath'], inject: ['fullPath'],
props: { props: {
...@@ -101,7 +102,7 @@ export default { ...@@ -101,7 +102,7 @@ export default {
<div class="gl-text-gray-700" data-testid="chartDescription"> <div class="gl-text-gray-700" data-testid="chartDescription">
{{ $options.strings.chartDescription }} {{ $options.strings.chartDescription }}
</div> </div>
<gl-loading-icon v-if="chartDataLoading" size="md" class="gl-mt-4" /> <chart-skeleton-loader v-if="chartDataLoading" />
<gl-area-chart <gl-area-chart
v-else-if="chartDataAvailable" v-else-if="chartDataAvailable"
:data="formattedThroughputChartData" :data="formattedThroughputChartData"
......
import { shallowMount } from '@vue/test-utils'; import { shallowMount } from '@vue/test-utils';
import { GlAlert, GlLoadingIcon } from '@gitlab/ui'; import { GlAlert } from '@gitlab/ui';
import { GlAreaChart } from '@gitlab/ui/dist/charts'; import { GlAreaChart } from '@gitlab/ui/dist/charts';
import ChartSkeletonLoader from '~/vue_shared/components/resizable_chart/skeleton_loader.vue';
import ThroughputChart from 'ee/analytics/merge_request_analytics/components/throughput_chart.vue'; import ThroughputChart from 'ee/analytics/merge_request_analytics/components/throughput_chart.vue';
import { THROUGHPUT_CHART_STRINGS } from 'ee/analytics/merge_request_analytics/constants'; import { THROUGHPUT_CHART_STRINGS } from 'ee/analytics/merge_request_analytics/constants';
import { throughputChartData, startDate, endDate, fullPath } from '../mock_data'; import { throughputChartData, startDate, endDate, fullPath } from '../mock_data';
...@@ -66,8 +67,8 @@ describe('ThroughputChart', () => { ...@@ -66,8 +67,8 @@ describe('ThroughputChart', () => {
expect(alert.text()).toBe(THROUGHPUT_CHART_STRINGS.NO_DATA); expect(alert.text()).toBe(THROUGHPUT_CHART_STRINGS.NO_DATA);
}); });
it('does not display a loading icon', () => { it('does not display a skeleton loader', () => {
displaysComponent(GlLoadingIcon, false); displaysComponent(ChartSkeletonLoader, false);
}); });
it('does not display the chart', () => { it('does not display the chart', () => {
...@@ -80,8 +81,8 @@ describe('ThroughputChart', () => { ...@@ -80,8 +81,8 @@ describe('ThroughputChart', () => {
createComponent({ loading: true }); createComponent({ loading: true });
}); });
it('displays a loading icon', () => { it('displays a skeleton loader', () => {
displaysComponent(GlLoadingIcon, true); displaysComponent(ChartSkeletonLoader, true);
}); });
it('does not display the chart', () => { it('does not display the chart', () => {
...@@ -102,8 +103,8 @@ describe('ThroughputChart', () => { ...@@ -102,8 +103,8 @@ describe('ThroughputChart', () => {
displaysComponent(GlAreaChart, true); displaysComponent(GlAreaChart, true);
}); });
it('does not display a loading icon', () => { it('does not display the skeleton loader', () => {
displaysComponent(GlLoadingIcon, false); displaysComponent(ChartSkeletonLoader, false);
}); });
it('does not display a no data message', () => { it('does not display a no data message', () => {
...@@ -120,8 +121,8 @@ describe('ThroughputChart', () => { ...@@ -120,8 +121,8 @@ describe('ThroughputChart', () => {
displaysComponent(GlAreaChart, false); displaysComponent(GlAreaChart, false);
}); });
it('does not display a loading icon', () => { it('does not display the skeleton loader', () => {
displaysComponent(GlLoadingIcon, false); displaysComponent(ChartSkeletonLoader, false);
}); });
it('displays an error message', () => { it('displays an error message', () => {
......
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