Commit 2a362771 authored by Coung Ngo's avatar Coung Ngo

Remove :roadmap_graphql in frontend

Removed :roadmap_graphql feature flag in the frontend
which has been defaulted to on for a while now with
no issues
parent 4629e944
......@@ -30,18 +30,6 @@ export default {
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: {
...mapState([
'currentGroupId',
......@@ -74,16 +62,14 @@ export default {
},
},
mounted() {
this.fetchEpicsFn();
this.fetchEpics();
this.fetchMilestones();
},
methods: {
...mapActions([
'setWindowResizeInProgress',
'fetchEpics',
'fetchEpicsGQL',
'fetchEpicsForTimeframe',
'fetchEpicsForTimeframeGQL',
'extendTimeframe',
'refreshEpicDates',
'fetchMilestones',
......@@ -121,7 +107,7 @@ export default {
this.refreshMilestoneDates();
this.$nextTick(() => {
this.fetchEpicsForTimeframeFn({
this.fetchEpicsForTimeframe({
timeframe: this.extendedTimeframe,
})
.then(() => {
......
import flash from '~/flash';
import { s__ } from '~/locale';
import axios from '~/lib/utils/axios_utils';
import * as epicUtils from '../utils/epic_utils';
import * as roadmapItemUtils from '../utils/roadmap_item_utils';
import {
getEpicsPathForPreset,
getEpicsTimeframeRange,
sortEpics,
extendTimeframeForPreset,
......@@ -111,18 +109,8 @@ export const receiveEpicsFailure = ({ commit }) => {
commit(types.RECEIVE_EPICS_FAILURE);
flash(s__('GroupRoadmap|Something went wrong while fetching epics'));
};
export const fetchEpics = ({ state, dispatch }) => {
dispatch('requestEpics');
return axios
.get(state.initialEpicsPath)
.then(({ data }) => {
dispatch('receiveEpicsSuccess', { rawEpics: data });
})
.catch(() => dispatch('receiveEpicsFailure'));
};
export const fetchEpicsGQL = ({ state, dispatch }) => {
export const fetchEpics = ({ state, dispatch }) => {
dispatch('requestEpics');
fetchGroupEpics(state)
......@@ -135,31 +123,6 @@ export const fetchEpicsGQL = ({ state, dispatch }) => {
export const fetchEpicsForTimeframe = ({ state, dispatch }, { timeframe }) => {
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)
.then(rawEpics => {
dispatch('receiveEpicsSuccess', {
......
......@@ -17,7 +17,6 @@ class Groups::EpicsController < Groups::ApplicationController
before_action :verify_group_bulk_edit_enabled!, only: [:bulk_update]
before_action do
push_frontend_feature_flag(:roadmap_graphql, @group, default_enabled: true)
push_frontend_feature_flag(:vue_issuable_epic_sidebar, @group)
end
......
......@@ -10,7 +10,6 @@ module Groups
before_action :check_epics_available!
before_action :persist_roadmap_layout, only: [:show]
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(:milestones_in_roadmap, @group)
end
......
......@@ -58,48 +58,6 @@ describe('Roadmap AppComponent', () => {
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('timeframeStart', () => {
it('returns first item of timeframe array', () => {
......@@ -217,6 +175,7 @@ describe('Roadmap AppComponent', () => {
spyOn(vm, 'extendTimeframe');
spyOn(vm, 'refreshEpicDates');
spyOn(vm, 'refreshMilestoneDates');
spyOn(vm, 'fetchEpicsForTimeframe').and.callFake(() => new Promise(() => {}));
const extendType = EXTEND_AS.PREPEND;
......@@ -231,7 +190,7 @@ describe('Roadmap AppComponent', () => {
spyOn(vm, 'extendTimeframe').and.stub();
spyOn(vm, 'refreshEpicDates').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;
......@@ -239,7 +198,7 @@ describe('Roadmap AppComponent', () => {
vm.$nextTick()
.then(() => {
expect(vm.fetchEpicsForTimeframeFn).toHaveBeenCalledWith(
expect(vm.fetchEpicsForTimeframe).toHaveBeenCalledWith(
jasmine.objectContaining({
timeframe: vm.extendedTimeframe,
}),
......
......@@ -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 = {
data: {
group: {
......
......@@ -27,6 +27,7 @@ import {
mockFormattedEpic,
mockSortedBy,
mockGroupEpicsQueryResponse,
mockGroupEpicsQueryResponseFormatted,
mockEpicChildEpicsQueryResponse,
mockGroupMilestonesQueryResponse,
rawMilestones,
......@@ -262,7 +263,11 @@ describe('Roadmap Vuex Actions', () => {
describe('success', () => {
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(
actions.fetchEpics,
......@@ -275,7 +280,7 @@ describe('Roadmap Vuex Actions', () => {
},
{
type: 'receiveEpicsSuccess',
payload: { rawEpics },
payload: { rawEpics: mockGroupEpicsQueryResponseFormatted },
},
],
done,
......@@ -285,7 +290,9 @@ describe('Roadmap Vuex Actions', () => {
describe('failure', () => {
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(
actions.fetchEpics,
......@@ -321,7 +328,11 @@ describe('Roadmap Vuex Actions', () => {
describe('success', () => {
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(
actions.fetchEpicsForTimeframe,
......@@ -334,7 +345,11 @@ describe('Roadmap Vuex Actions', () => {
},
{
type: 'receiveEpicsSuccess',
payload: { rawEpics, newEpic: true, timeframeExtended: true },
payload: {
rawEpics: mockGroupEpicsQueryResponseFormatted,
newEpic: true,
timeframeExtended: true,
},
},
],
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