Commit bcc75a46 authored by Alexandru Croitor's avatar Alexandru Croitor

Change FE grapqhl queries to use timeframe argument

start and end date arguments in epic, milestone and iteration
resolvers are deprecated, so we alight FE calls to use timeframe
argument instead.
parent 85e509c2
......@@ -5,8 +5,7 @@ query epicChildEpics(
$iid: ID!
$state: EpicState
$sort: EpicSort
$startDate: Time
$dueDate: Time
$timeframe: Timeframe
$labelName: [String!] = []
$authorUsername: String = ""
$confidential: Boolean
......@@ -22,12 +21,11 @@ query epicChildEpics(
children(
state: $state
sort: $sort
startDate: $startDate
endDate: $dueDate
labelName: $labelName
authorUsername: $authorUsername
confidential: $confidential
search: $search
timeframe: $timeframe
) {
edges {
node {
......
......@@ -5,8 +5,7 @@ query groupEpics(
$state: EpicState
$sort: EpicSort
$iid: ID
$startDate: Time
$dueDate: Time
$timeframe: Timeframe
$labelName: [String!] = []
$authorUsername: String = ""
$milestoneTitle: String = ""
......@@ -22,8 +21,6 @@ query groupEpics(
iid: $iid
state: $state
sort: $sort
startDate: $startDate
endDate: $dueDate
labelName: $labelName
authorUsername: $authorUsername
milestoneTitle: $milestoneTitle
......@@ -31,6 +28,7 @@ query groupEpics(
confidential: $confidential
search: $search
first: $first
timeframe: $timeframe
) {
edges {
node {
......
query groupMilestones(
$fullPath: ID!
$state: MilestoneStateEnum
$startDate: Time
$dueDate: Time
$timeframe: Timeframe
$includeDescendants: Boolean
) {
group(fullPath: $fullPath) {
id
name
milestones(
state: $state
startDate: $startDate
endDate: $dueDate
includeDescendants: $includeDescendants
) {
milestones(state: $state, includeDescendants: $includeDescendants, timeframe: $timeframe) {
edges {
node {
id
......
import { newDate, getTimeframeWindowFrom, totalDaysInMonth } from '~/lib/utils/datetime_utility';
import { getTimeframeWindowFrom, newDate, totalDaysInMonth } from '~/lib/utils/datetime_utility';
import {
PRESET_TYPES,
PRESET_DEFAULTS,
DAYS_IN_WEEK,
EXTEND_AS,
PRESET_DEFAULTS,
PRESET_TYPES,
TIMELINE_CELL_MIN_WIDTH,
DAYS_IN_WEEK,
} from '../constants';
const monthsForQuarters = {
......@@ -380,7 +380,6 @@ export const getEpicsTimeframeRange = ({ presetType = '', timeframe = [] }) => {
const firstTimeframe = timeframe[0];
const lastTimeframe = timeframe[timeframe.length - 1];
// Compute start and end dates from timeframe
// based on provided presetType.
if (presetType === PRESET_TYPES.QUARTERS) {
......@@ -395,12 +394,11 @@ export const getEpicsTimeframeRange = ({ presetType = '', timeframe = [] }) => {
due.setDate(due.getDate() + 6);
}
const startDate = `${start.getFullYear()}-${start.getMonth() + 1}-${start.getDate()}`;
const dueDate = `${due.getFullYear()}-${due.getMonth() + 1}-${due.getDate()}`;
return {
startDate,
dueDate,
timeframe: {
start: start.toISOString().split('T')[0],
end: due.toISOString().split('T')[0],
},
};
};
......
......@@ -551,8 +551,10 @@ describe('Roadmap Vuex Actions', () => {
expectedVariables = {
fullPath: 'gitlab-org',
state: mockState.milestonessState,
startDate: '2017-11-1',
dueDate: '2018-6-30',
timeframe: {
start: '2017-11-01',
end: '2018-06-30',
},
includeDescendants: true,
};
});
......
......@@ -305,8 +305,10 @@ describe('getEpicsTimeframeRange', () => {
expect(range).toEqual(
expect.objectContaining({
startDate: '2017-7-1',
dueDate: '2019-3-31',
timeframe: {
start: '2017-07-01',
end: '2019-03-31',
},
}),
);
});
......@@ -320,8 +322,10 @@ describe('getEpicsTimeframeRange', () => {
expect(range).toEqual(
expect.objectContaining({
startDate: '2017-11-1',
dueDate: '2018-6-30',
timeframe: {
start: '2017-11-01',
end: '2018-06-30',
},
}),
);
});
......@@ -335,8 +339,10 @@ describe('getEpicsTimeframeRange', () => {
expect(range).toEqual(
expect.objectContaining({
startDate: '2017-12-17',
dueDate: '2018-2-3',
timeframe: {
start: '2017-12-17',
end: '2018-02-03',
},
}),
);
});
......
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