Commit 3785ca00 authored by Paul Slaughter's avatar Paul Slaughter

Merge branch '35257-frontend-remove-roadmap_graphql-feature-flag' into 'master'

Remove frontend :roadmap_graphql feature flag

See merge request gitlab-org/gitlab!28125
parents b86eb545 2a362771
...@@ -30,18 +30,6 @@ export default { ...@@ -30,18 +30,6 @@ export default {
required: true, required: true,
}, },
}, },
data() {
const roadmapGraphQL = gon.features && gon.features.roadmapGraphql;
return {
// TODO
// Remove these method alias and call actual
// method once feature flag is removed.
fetchEpicsFn: roadmapGraphQL ? this.fetchEpicsGQL : this.fetchEpics,
fetchEpicsForTimeframeFn: roadmapGraphQL
? this.fetchEpicsForTimeframeGQL
: this.fetchEpicsForTimeframe,
};
},
computed: { computed: {
...mapState([ ...mapState([
'currentGroupId', 'currentGroupId',
...@@ -74,16 +62,14 @@ export default { ...@@ -74,16 +62,14 @@ export default {
}, },
}, },
mounted() { mounted() {
this.fetchEpicsFn(); this.fetchEpics();
this.fetchMilestones(); this.fetchMilestones();
}, },
methods: { methods: {
...mapActions([ ...mapActions([
'setWindowResizeInProgress', 'setWindowResizeInProgress',
'fetchEpics', 'fetchEpics',
'fetchEpicsGQL',
'fetchEpicsForTimeframe', 'fetchEpicsForTimeframe',
'fetchEpicsForTimeframeGQL',
'extendTimeframe', 'extendTimeframe',
'refreshEpicDates', 'refreshEpicDates',
'fetchMilestones', 'fetchMilestones',
...@@ -121,7 +107,7 @@ export default { ...@@ -121,7 +107,7 @@ export default {
this.refreshMilestoneDates(); this.refreshMilestoneDates();
this.$nextTick(() => { this.$nextTick(() => {
this.fetchEpicsForTimeframeFn({ this.fetchEpicsForTimeframe({
timeframe: this.extendedTimeframe, timeframe: this.extendedTimeframe,
}) })
.then(() => { .then(() => {
......
import flash from '~/flash'; import flash from '~/flash';
import { s__ } from '~/locale'; import { s__ } from '~/locale';
import axios from '~/lib/utils/axios_utils';
import * as epicUtils from '../utils/epic_utils'; import * as epicUtils from '../utils/epic_utils';
import * as roadmapItemUtils from '../utils/roadmap_item_utils'; import * as roadmapItemUtils from '../utils/roadmap_item_utils';
import { import {
getEpicsPathForPreset,
getEpicsTimeframeRange, getEpicsTimeframeRange,
sortEpics, sortEpics,
extendTimeframeForPreset, extendTimeframeForPreset,
...@@ -111,18 +109,8 @@ export const receiveEpicsFailure = ({ commit }) => { ...@@ -111,18 +109,8 @@ export const receiveEpicsFailure = ({ commit }) => {
commit(types.RECEIVE_EPICS_FAILURE); commit(types.RECEIVE_EPICS_FAILURE);
flash(s__('GroupRoadmap|Something went wrong while fetching epics')); flash(s__('GroupRoadmap|Something went wrong while fetching epics'));
}; };
export const fetchEpics = ({ state, dispatch }) => {
dispatch('requestEpics');
return axios export const fetchEpics = ({ state, dispatch }) => {
.get(state.initialEpicsPath)
.then(({ data }) => {
dispatch('receiveEpicsSuccess', { rawEpics: data });
})
.catch(() => dispatch('receiveEpicsFailure'));
};
export const fetchEpicsGQL = ({ state, dispatch }) => {
dispatch('requestEpics'); dispatch('requestEpics');
fetchGroupEpics(state) fetchGroupEpics(state)
...@@ -135,31 +123,6 @@ export const fetchEpicsGQL = ({ state, dispatch }) => { ...@@ -135,31 +123,6 @@ export const fetchEpicsGQL = ({ state, dispatch }) => {
export const fetchEpicsForTimeframe = ({ state, dispatch }, { timeframe }) => { export const fetchEpicsForTimeframe = ({ state, dispatch }, { timeframe }) => {
dispatch('requestEpicsForTimeframe'); dispatch('requestEpicsForTimeframe');
const epicsPath = getEpicsPathForPreset({
basePath: state.basePath,
epicsState: state.epicsState,
filterQueryString: state.filterQueryString,
presetType: state.presetType,
timeframe,
});
return axios
.get(epicsPath)
.then(({ data }) => {
dispatch('receiveEpicsSuccess', {
rawEpics: data,
newEpic: true,
timeframeExtended: true,
});
})
.catch(() => {
dispatch('receiveEpicsFailure');
});
};
export const fetchEpicsForTimeframeGQL = ({ state, dispatch }, { timeframe }) => {
dispatch('requestEpicsForTimeframe');
return fetchGroupEpics(state, timeframe) return fetchGroupEpics(state, timeframe)
.then(rawEpics => { .then(rawEpics => {
dispatch('receiveEpicsSuccess', { dispatch('receiveEpicsSuccess', {
......
...@@ -17,7 +17,6 @@ class Groups::EpicsController < Groups::ApplicationController ...@@ -17,7 +17,6 @@ class Groups::EpicsController < Groups::ApplicationController
before_action :verify_group_bulk_edit_enabled!, only: [:bulk_update] before_action :verify_group_bulk_edit_enabled!, only: [:bulk_update]
before_action do before_action do
push_frontend_feature_flag(:roadmap_graphql, @group, default_enabled: true)
push_frontend_feature_flag(:vue_issuable_epic_sidebar, @group) push_frontend_feature_flag(:vue_issuable_epic_sidebar, @group)
end end
......
...@@ -10,7 +10,6 @@ module Groups ...@@ -10,7 +10,6 @@ module Groups
before_action :check_epics_available! before_action :check_epics_available!
before_action :persist_roadmap_layout, only: [:show] before_action :persist_roadmap_layout, only: [:show]
before_action do before_action do
push_frontend_feature_flag(:roadmap_graphql, @group, default_enabled: true)
push_frontend_feature_flag(:roadmap_buffered_rendering, @group) push_frontend_feature_flag(:roadmap_buffered_rendering, @group)
push_frontend_feature_flag(:milestones_in_roadmap, @group) push_frontend_feature_flag(:milestones_in_roadmap, @group)
end end
......
...@@ -58,48 +58,6 @@ describe('Roadmap AppComponent', () => { ...@@ -58,48 +58,6 @@ describe('Roadmap AppComponent', () => {
vm.$destroy(); vm.$destroy();
}); });
describe('data', () => {
describe('when `gon.feature.roadmapGraphql` is true', () => {
const originalGonFeatures = Object.assign({}, gon.features);
beforeAll(() => {
gon.features = { roadmapGraphql: true };
});
afterAll(() => {
gon.features = originalGonFeatures;
});
it('returns data prop containing `fetchEpicsFn` mapped to `fetchEpicsGQL`', () => {
expect(vm.fetchEpicsFn).toBe(vm.fetchEpicsGQL);
});
it('returns data prop containing `fetchEpicsForTimeframeFn` mapped to `fetchEpicsForTimeframeGQL`', () => {
expect(vm.fetchEpicsForTimeframeFn).toBe(vm.fetchEpicsForTimeframeGQL);
});
});
describe('when `gon.feature.roadmapGraphql` is false', () => {
const originalGonFeatures = Object.assign({}, gon.features);
beforeAll(() => {
gon.features = { roadmapGraphql: false };
});
afterAll(() => {
gon.features = originalGonFeatures;
});
it('returns data prop containing `fetchEpicsFn` mapped to `fetchEpics`', () => {
expect(vm.fetchEpicsFn).toBe(vm.fetchEpics);
});
it('returns data prop containing `fetchEpicsForTimeframeFn` mapped to `fetchEpicsForTimeframe`', () => {
expect(vm.fetchEpicsForTimeframeFn).toBe(vm.fetchEpicsForTimeframe);
});
});
});
describe('computed', () => { describe('computed', () => {
describe('timeframeStart', () => { describe('timeframeStart', () => {
it('returns first item of timeframe array', () => { it('returns first item of timeframe array', () => {
...@@ -217,6 +175,7 @@ describe('Roadmap AppComponent', () => { ...@@ -217,6 +175,7 @@ describe('Roadmap AppComponent', () => {
spyOn(vm, 'extendTimeframe'); spyOn(vm, 'extendTimeframe');
spyOn(vm, 'refreshEpicDates'); spyOn(vm, 'refreshEpicDates');
spyOn(vm, 'refreshMilestoneDates'); spyOn(vm, 'refreshMilestoneDates');
spyOn(vm, 'fetchEpicsForTimeframe').and.callFake(() => new Promise(() => {}));
const extendType = EXTEND_AS.PREPEND; const extendType = EXTEND_AS.PREPEND;
...@@ -231,7 +190,7 @@ describe('Roadmap AppComponent', () => { ...@@ -231,7 +190,7 @@ describe('Roadmap AppComponent', () => {
spyOn(vm, 'extendTimeframe').and.stub(); spyOn(vm, 'extendTimeframe').and.stub();
spyOn(vm, 'refreshEpicDates').and.stub(); spyOn(vm, 'refreshEpicDates').and.stub();
spyOn(vm, 'refreshMilestoneDates').and.stub(); spyOn(vm, 'refreshMilestoneDates').and.stub();
spyOn(vm, 'fetchEpicsForTimeframeFn').and.callFake(() => new Promise(() => {})); spyOn(vm, 'fetchEpicsForTimeframe').and.callFake(() => new Promise(() => {}));
const extendType = EXTEND_AS.PREPEND; const extendType = EXTEND_AS.PREPEND;
...@@ -239,7 +198,7 @@ describe('Roadmap AppComponent', () => { ...@@ -239,7 +198,7 @@ describe('Roadmap AppComponent', () => {
vm.$nextTick() vm.$nextTick()
.then(() => { .then(() => {
expect(vm.fetchEpicsForTimeframeFn).toHaveBeenCalledWith( expect(vm.fetchEpicsForTimeframe).toHaveBeenCalledWith(
jasmine.objectContaining({ jasmine.objectContaining({
timeframe: vm.extendedTimeframe, timeframe: vm.extendedTimeframe,
}), }),
......
...@@ -350,6 +350,35 @@ export const mockGroupEpicsQueryResponse = { ...@@ -350,6 +350,35 @@ export const mockGroupEpicsQueryResponse = {
}, },
}; };
export const mockGroupEpicsQueryResponseFormatted = [
{
id: 'gid://gitlab/Epic/40',
title: 'Marketing epic',
startDate: '2017-12-25',
dueDate: '2018-03-09',
webUrl: '/groups/gitlab-org/marketing/-/epics/1',
group: {
name: 'Gitlab Org',
fullName: 'Gitlab Org',
},
groupName: 'Gitlab Org',
groupFullName: 'Gitlab Org',
},
{
id: 'gid://gitlab/Epic/41',
title: 'Another marketing',
startDate: '2017-12-26',
dueDate: '2018-03-10',
webUrl: '/groups/gitlab-org/marketing/-/epics/2',
group: {
name: 'Gitlab Org',
fullName: 'Gitlab Org',
},
groupName: 'Gitlab Org',
groupFullName: 'Gitlab Org',
},
];
export const mockEpicChildEpicsQueryResponse = { export const mockEpicChildEpicsQueryResponse = {
data: { data: {
group: { group: {
......
...@@ -27,6 +27,7 @@ import { ...@@ -27,6 +27,7 @@ import {
mockFormattedEpic, mockFormattedEpic,
mockSortedBy, mockSortedBy,
mockGroupEpicsQueryResponse, mockGroupEpicsQueryResponse,
mockGroupEpicsQueryResponseFormatted,
mockEpicChildEpicsQueryResponse, mockEpicChildEpicsQueryResponse,
mockGroupMilestonesQueryResponse, mockGroupMilestonesQueryResponse,
rawMilestones, rawMilestones,
...@@ -262,7 +263,11 @@ describe('Roadmap Vuex Actions', () => { ...@@ -262,7 +263,11 @@ describe('Roadmap Vuex Actions', () => {
describe('success', () => { describe('success', () => {
it('should dispatch requestEpics and receiveEpicsSuccess when request is successful', done => { it('should dispatch requestEpics and receiveEpicsSuccess when request is successful', done => {
mock.onGet(epicsPath).replyOnce(200, rawEpics); spyOn(epicUtils.gqClient, 'query').and.returnValue(
Promise.resolve({
data: mockGroupEpicsQueryResponse.data,
}),
);
testAction( testAction(
actions.fetchEpics, actions.fetchEpics,
...@@ -275,7 +280,7 @@ describe('Roadmap Vuex Actions', () => { ...@@ -275,7 +280,7 @@ describe('Roadmap Vuex Actions', () => {
}, },
{ {
type: 'receiveEpicsSuccess', type: 'receiveEpicsSuccess',
payload: { rawEpics }, payload: { rawEpics: mockGroupEpicsQueryResponseFormatted },
}, },
], ],
done, done,
...@@ -285,7 +290,9 @@ describe('Roadmap Vuex Actions', () => { ...@@ -285,7 +290,9 @@ describe('Roadmap Vuex Actions', () => {
describe('failure', () => { describe('failure', () => {
it('should dispatch requestEpics and receiveEpicsFailure when request fails', done => { it('should dispatch requestEpics and receiveEpicsFailure when request fails', done => {
mock.onGet(epicsPath).replyOnce(500, {}); spyOn(epicUtils.gqClient, 'query').and.returnValue(
Promise.reject(new Error('error message')),
);
testAction( testAction(
actions.fetchEpics, actions.fetchEpics,
...@@ -321,7 +328,11 @@ describe('Roadmap Vuex Actions', () => { ...@@ -321,7 +328,11 @@ describe('Roadmap Vuex Actions', () => {
describe('success', () => { describe('success', () => {
it('should dispatch requestEpicsForTimeframe and receiveEpicsSuccess when request is successful', done => { it('should dispatch requestEpicsForTimeframe and receiveEpicsSuccess when request is successful', done => {
mock.onGet(mockEpicsPath).replyOnce(200, rawEpics); spyOn(epicUtils.gqClient, 'query').and.returnValue(
Promise.resolve({
data: mockGroupEpicsQueryResponse.data,
}),
);
testAction( testAction(
actions.fetchEpicsForTimeframe, actions.fetchEpicsForTimeframe,
...@@ -334,7 +345,11 @@ describe('Roadmap Vuex Actions', () => { ...@@ -334,7 +345,11 @@ describe('Roadmap Vuex Actions', () => {
}, },
{ {
type: 'receiveEpicsSuccess', type: 'receiveEpicsSuccess',
payload: { rawEpics, newEpic: true, timeframeExtended: true }, payload: {
rawEpics: mockGroupEpicsQueryResponseFormatted,
newEpic: true,
timeframeExtended: true,
},
}, },
], ],
done, done,
......
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