Commit 08516c10 authored by Paul Slaughter's avatar Paul Slaughter

Merge branch '215077-add-spinner-to-roadmap' into 'master'

Add spinner to Roadmap

See merge request gitlab-org/gitlab!31080
parents a0f2c5ba 8a1ae09e
<script> <script>
import { GlLoadingIcon } from '@gitlab/ui';
import { mapState, mapActions } from 'vuex'; import { mapState, mapActions } from 'vuex';
import EpicsListEmpty from './epics_list_empty.vue';
import epicsListEmpty from './epics_list_empty.vue'; import RoadmapShell from './roadmap_shell.vue';
import roadmapShell from './roadmap_shell.vue';
import eventHub from '../event_hub'; import eventHub from '../event_hub';
import { EXTEND_AS } from '../constants'; import { EXTEND_AS } from '../constants';
export default { export default {
components: { components: {
epicsListEmpty, EpicsListEmpty,
roadmapShell, GlLoadingIcon,
RoadmapShell,
}, },
props: { props: {
presetType: { presetType: {
...@@ -51,9 +51,6 @@ export default { ...@@ -51,9 +51,6 @@ export default {
const last = this.timeframe.length - 1; const last = this.timeframe.length - 1;
return this.timeframe[last]; return this.timeframe[last];
}, },
showRoadmap() {
return !this.epicsFetchFailure && !this.epicsFetchInProgress && !this.epicsFetchResultEmpty;
},
}, },
mounted() { mounted() {
this.fetchEpics(); this.fetchEpics();
...@@ -122,8 +119,19 @@ export default { ...@@ -122,8 +119,19 @@ export default {
<template> <template>
<div :class="{ 'overflow-reset': epicsFetchResultEmpty }" class="roadmap-container"> <div :class="{ 'overflow-reset': epicsFetchResultEmpty }" class="roadmap-container">
<gl-loading-icon v-if="epicsFetchInProgress" class="mt-4" size="md" />
<epics-list-empty
v-else-if="epicsFetchResultEmpty"
:preset-type="presetType"
:timeframe-start="timeframeStart"
:timeframe-end="timeframeEnd"
:has-filters-applied="hasFiltersApplied"
:new-epic-endpoint="newEpicEndpoint"
:empty-state-illustration-path="emptyStateIllustrationPath"
:is-child-epics="isChildEpics"
/>
<roadmap-shell <roadmap-shell
v-if="showRoadmap" v-else-if="!epicsFetchFailure"
:preset-type="presetType" :preset-type="presetType"
:epics="epics" :epics="epics"
:milestones="milestones" :milestones="milestones"
...@@ -133,15 +141,5 @@ export default { ...@@ -133,15 +141,5 @@ export default {
@onScrollToStart="handleScrollToExtend" @onScrollToStart="handleScrollToExtend"
@onScrollToEnd="handleScrollToExtend" @onScrollToEnd="handleScrollToExtend"
/> />
<epics-list-empty
v-if="epicsFetchResultEmpty"
:preset-type="presetType"
:timeframe-start="timeframeStart"
:timeframe-end="timeframeEnd"
:has-filters-applied="hasFiltersApplied"
:new-epic-endpoint="newEpicEndpoint"
:empty-state-illustration-path="emptyStateIllustrationPath"
:is-child-epics="isChildEpics"
/>
</div> </div>
</template> </template>
---
title: Add spinner to roadmap
merge_request: 31080
author:
type: added
import { GlLoadingIcon } from '@gitlab/ui';
import { mount, shallowMount, createLocalVue } from '@vue/test-utils'; import { mount, shallowMount, createLocalVue } from '@vue/test-utils';
import Vue from 'vue'; import Vue from 'vue';
import Vuex from 'vuex'; import Vuex from 'vuex';
...@@ -67,35 +68,34 @@ describe('RoadmapApp', () => { ...@@ -67,35 +68,34 @@ describe('RoadmapApp', () => {
wrapper = null; wrapper = null;
}); });
describe('when the app contains epics', () => { describe.each`
testLabel | epicList | showLoading | showRoadmapShell | showEpicsListEmpty
${'is loading'} | ${null} | ${true} | ${false} | ${false}
${'has epics'} | ${epics} | ${false} | ${true} | ${false}
${'has no epics'} | ${[]} | ${false} | ${false} | ${true}
`(
`when epic list $testLabel`,
({ epicList, showLoading, showRoadmapShell, showEpicsListEmpty }) => {
beforeEach(() => { beforeEach(() => {
wrapper = createComponent(); wrapper = createComponent();
store.commit(types.RECEIVE_EPICS_SUCCESS, epics); if (epicList) {
}); store.commit(types.RECEIVE_EPICS_SUCCESS, epicList);
}
it('the roadmap is shown', () => {
expect(wrapper.contains(RoadmapShell)).toBe(true);
});
it('the empty state view is not shown', () => {
expect(wrapper.contains(EpicsListEmpty)).toBe(false);
});
}); });
describe('when the app does not contain any epics', () => { it(`loading icon is${showLoading ? '' : ' not'} shown`, () => {
beforeEach(() => { expect(wrapper.contains(GlLoadingIcon)).toBe(showLoading);
wrapper = createComponent();
store.commit(types.RECEIVE_EPICS_SUCCESS, []);
}); });
it('the roadmap is not shown', () => { it(`roadmap is${showRoadmapShell ? '' : ' not'} shown`, () => {
expect(wrapper.contains(RoadmapShell)).toBe(false); expect(wrapper.contains(RoadmapShell)).toBe(showRoadmapShell);
}); });
it('the empty state view is shown', () => { it(`empty state view is${showEpicsListEmpty ? '' : ' not'} shown`, () => {
expect(wrapper.contains(EpicsListEmpty)).toBe(true); expect(wrapper.contains(EpicsListEmpty)).toBe(showEpicsListEmpty);
});
}); });
},
);
describe('empty state view', () => { describe('empty state view', () => {
beforeEach(() => { beforeEach(() => {
......
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