Commit 496819de authored by Phil Hughes's avatar Phil Hughes

Merge branch '216792-cleanup-roadmap-rails-api-frontend' into 'master'

Roadmap: Remove Rails API related code

See merge request gitlab-org/gitlab!39801
parents 39db2b06 b5bc6b10
...@@ -141,7 +141,7 @@ export default { ...@@ -141,7 +141,7 @@ export default {
}, },
getEpicItemProps(index) { getEpicItemProps(index) {
return { return {
key: index, key: generateKey(this.displayedEpics[index]),
props: { props: {
epic: this.displayedEpics[index], epic: this.displayedEpics[index],
presetType: this.presetType, presetType: this.presetType,
......
...@@ -15,7 +15,7 @@ import { visitUrl, mergeUrlParams } from '~/lib/utils/url_utility'; ...@@ -15,7 +15,7 @@ import { visitUrl, mergeUrlParams } from '~/lib/utils/url_utility';
import { PRESET_TYPES, EPIC_DETAILS_CELL_WIDTH } from './constants'; import { PRESET_TYPES, EPIC_DETAILS_CELL_WIDTH } from './constants';
import { getEpicsPathForPreset, getTimeframeForPreset } from './utils/roadmap_utils'; import { getTimeframeForPreset } from './utils/roadmap_utils';
import createStore from './store'; import createStore from './store';
...@@ -57,9 +57,8 @@ export default () => { ...@@ -57,9 +57,8 @@ export default () => {
supportedPresetTypes.indexOf(dataset.presetType) > -1 supportedPresetTypes.indexOf(dataset.presetType) > -1
? dataset.presetType ? dataset.presetType
: PRESET_TYPES.MONTHS; : PRESET_TYPES.MONTHS;
const filterQueryString = window.location.search.substring(1);
const filterParams = Object.assign( const filterParams = Object.assign(
convertObjectPropsToCamelCase(urlParamsToObject(filterQueryString), { convertObjectPropsToCamelCase(urlParamsToObject(window.location.search.substring(1)), {
dropKeys: ['scope', 'utf8', 'state', 'sort', 'layout'], // These keys are unsupported/unnecessary dropKeys: ['scope', 'utf8', 'state', 'sort', 'layout'], // These keys are unsupported/unnecessary
}), }),
); );
...@@ -67,13 +66,6 @@ export default () => { ...@@ -67,13 +66,6 @@ export default () => {
presetType, presetType,
window.innerWidth - el.offsetLeft - EPIC_DETAILS_CELL_WIDTH, window.innerWidth - el.offsetLeft - EPIC_DETAILS_CELL_WIDTH,
); );
const initialEpicsPath = getEpicsPathForPreset({
basePath: dataset.epicsPath,
epicsState: dataset.epicsState,
filterQueryString,
presetType,
timeframe,
});
return { return {
emptyStateIllustrationPath: dataset.emptyStateIllustration, emptyStateIllustrationPath: dataset.emptyStateIllustration,
...@@ -90,8 +82,6 @@ export default () => { ...@@ -90,8 +82,6 @@ export default () => {
groupMilestonesEndpoint: dataset.groupMilestonesEndpoint, groupMilestonesEndpoint: dataset.groupMilestonesEndpoint,
epicsState: dataset.epicsState, epicsState: dataset.epicsState,
sortedBy: dataset.sortedBy, sortedBy: dataset.sortedBy,
filterQueryString,
initialEpicsPath,
filterParams, filterParams,
presetType, presetType,
timeframe, timeframe,
...@@ -107,9 +97,7 @@ export default () => { ...@@ -107,9 +97,7 @@ export default () => {
epicsState: this.epicsState, epicsState: this.epicsState,
timeframe: this.timeframe, timeframe: this.timeframe,
basePath: this.basePath, basePath: this.basePath,
filterQueryString: this.filterQueryString,
filterParams: this.filterParams, filterParams: this.filterParams,
initialEpicsPath: this.initialEpicsPath,
groupLabelsEndpoint: this.groupLabelsEndpoint, groupLabelsEndpoint: this.groupLabelsEndpoint,
groupMilestonesEndpoint: this.groupMilestonesEndpoint, groupMilestonesEndpoint: this.groupMilestonesEndpoint,
defaultInnerHeight: this.defaultInnerHeight, defaultInnerHeight: this.defaultInnerHeight,
......
...@@ -2,8 +2,6 @@ export default () => ({ ...@@ -2,8 +2,6 @@ export default () => ({
// API Calls // API Calls
basePath: '', basePath: '',
epicsState: '', epicsState: '',
filterQueryString: '',
initialEpicsPath: '',
filterParams: null, filterParams: null,
groupLabelsEndpoint: '', groupLabelsEndpoint: '',
groupMilestonesEndpoint: '', groupMilestonesEndpoint: '',
......
...@@ -406,34 +406,6 @@ export const getEpicsTimeframeRange = ({ presetType = '', timeframe = [] }) => { ...@@ -406,34 +406,6 @@ export const getEpicsTimeframeRange = ({ presetType = '', timeframe = [] }) => {
}; };
}; };
export const getEpicsPathForPreset = ({
basePath = '',
filterQueryString = '',
presetType = '',
timeframe = [],
epicsState = 'all',
}) => {
let epicsPath = basePath;
if (!basePath || !timeframe.length) {
return null;
}
const range = getEpicsTimeframeRange({
presetType,
timeframe,
});
epicsPath += epicsPath.indexOf('?') === -1 ? '?' : '&';
epicsPath += `state=${epicsState}&start_date=${range.startDate}&end_date=${range.dueDate}`;
if (filterQueryString) {
epicsPath += `&${filterQueryString}`;
}
return epicsPath;
};
/** /**
* This function takes two epics and return sortable dates depending on the ' * This function takes two epics and return sortable dates depending on the '
* type of sorting order -- startDate or endDate. * type of sorting order -- startDate or endDate.
......
...@@ -245,7 +245,7 @@ describe('EpicsListSectionComponent', () => { ...@@ -245,7 +245,7 @@ describe('EpicsListSectionComponent', () => {
it('returns an object containing props for EpicItem component', () => { it('returns an object containing props for EpicItem component', () => {
expect(wrapper.vm.getEpicItemProps(1)).toEqual( expect(wrapper.vm.getEpicItemProps(1)).toEqual(
expect.objectContaining({ expect.objectContaining({
key: 1, key: `epic-${wrapper.vm.epics[1].id}`,
props: { props: {
epic: wrapper.vm.epics[1], epic: wrapper.vm.epics[1],
presetType: wrapper.vm.presetType, presetType: wrapper.vm.presetType,
......
...@@ -7,7 +7,6 @@ import { ...@@ -7,7 +7,6 @@ import {
extendTimeframeForWeeksView, extendTimeframeForWeeksView,
extendTimeframeForAvailableWidth, extendTimeframeForAvailableWidth,
getEpicsTimeframeRange, getEpicsTimeframeRange,
getEpicsPathForPreset,
assignDates, assignDates,
sortEpics, sortEpics,
} from 'ee/roadmap/utils/roadmap_utils'; } from 'ee/roadmap/utils/roadmap_utils';
...@@ -345,71 +344,6 @@ describe('getEpicsTimeframeRange', () => { ...@@ -345,71 +344,6 @@ describe('getEpicsTimeframeRange', () => {
}); });
}); });
describe('getEpicsPathForPreset', () => {
const basePath = '/groups/gitlab-org/-/epics.json';
const filterQueryString = 'scope=all&utf8=✓&state=opened&label_name[]=Bug';
it('returns epics path string based on provided basePath and timeframe for Quarters', () => {
const timeframeQuarters = getTimeframeForQuartersView(new Date(2018, 0, 1));
const epicsPath = getEpicsPathForPreset({
basePath,
timeframe: timeframeQuarters,
presetType: PRESET_TYPES.QUARTERS,
});
expect(epicsPath).toBe(`${basePath}?state=all&start_date=2017-7-1&end_date=2019-3-31`);
});
it('returns epics path string based on provided basePath and timeframe for Months', () => {
const timeframeMonths = getTimeframeForMonthsView(new Date(2018, 0, 1));
const epicsPath = getEpicsPathForPreset({
basePath,
timeframe: timeframeMonths,
presetType: PRESET_TYPES.MONTHS,
});
expect(epicsPath).toBe(`${basePath}?state=all&start_date=2017-11-1&end_date=2018-6-30`);
});
it('returns epics path string based on provided basePath and timeframe for Weeks', () => {
const timeframeWeeks = getTimeframeForWeeksView(new Date(2018, 0, 1));
const epicsPath = getEpicsPathForPreset({
basePath,
timeframe: timeframeWeeks,
presetType: PRESET_TYPES.WEEKS,
});
expect(epicsPath).toBe(`${basePath}?state=all&start_date=2017-12-17&end_date=2018-2-3`);
});
it('returns epics path string while preserving filterQueryString', () => {
const timeframeMonths = getTimeframeForMonthsView(new Date(2018, 0, 1));
const epicsPath = getEpicsPathForPreset({
basePath,
filterQueryString,
timeframe: timeframeMonths,
presetType: PRESET_TYPES.MONTHS,
});
expect(epicsPath).toBe(
`${basePath}?state=all&start_date=2017-11-1&end_date=2018-6-30&scope=all&utf8=✓&state=opened&label_name[]=Bug`,
);
});
it('returns epics path string containing epicsState', () => {
const epicsState = 'opened';
const timeframe = getTimeframeForMonthsView(new Date(2018, 0, 1));
const epicsPath = getEpicsPathForPreset({
presetType: PRESET_TYPES.MONTHS,
basePath,
timeframe,
epicsState,
});
expect(epicsPath).toContain(`state=${epicsState}`);
});
});
describe('sortEpics', () => { describe('sortEpics', () => {
it('sorts epics list by startDate in ascending order when `sortedBy` param is `start_date_asc`', () => { it('sorts epics list by startDate in ascending order when `sortedBy` param is `start_date_asc`', () => {
const epics = mockUnsortedEpics.slice(); const epics = mockUnsortedEpics.slice();
......
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