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