Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
01fa6af4
Commit
01fa6af4
authored
Feb 02, 2022
by
Florie Guibert
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Roadmap - Prevent page reload when changing daterange in settings
Behind roadmap_settings feature flag
parent
f81a0b0c
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
75 additions
and
34 deletions
+75
-34
ee/app/assets/javascripts/roadmap/components/roadmap_app.vue
ee/app/assets/javascripts/roadmap/components/roadmap_app.vue
+2
-10
ee/app/assets/javascripts/roadmap/components/roadmap_daterange.vue
...sets/javascripts/roadmap/components/roadmap_daterange.vue
+12
-17
ee/app/assets/javascripts/roadmap/roadmap_bundle.js
ee/app/assets/javascripts/roadmap/roadmap_bundle.js
+0
-2
ee/app/assets/javascripts/roadmap/store/actions.js
ee/app/assets/javascripts/roadmap/store/actions.js
+3
-0
ee/app/assets/javascripts/roadmap/store/mutation_types.js
ee/app/assets/javascripts/roadmap/store/mutation_types.js
+1
-0
ee/app/assets/javascripts/roadmap/store/mutations.js
ee/app/assets/javascripts/roadmap/store/mutations.js
+13
-0
ee/spec/features/groups/group_roadmap_spec.rb
ee/spec/features/groups/group_roadmap_spec.rb
+0
-2
ee/spec/frontend/roadmap/components/roadmap_app_spec.js
ee/spec/frontend/roadmap/components/roadmap_app_spec.js
+2
-1
ee/spec/frontend/roadmap/store/actions_spec.js
ee/spec/frontend/roadmap/store/actions_spec.js
+19
-2
ee/spec/frontend/roadmap/store/mutations_spec.js
ee/spec/frontend/roadmap/store/mutations_spec.js
+23
-0
No files found.
ee/app/assets/javascripts/roadmap/components/roadmap_app.vue
View file @
01fa6af4
...
...
@@ -4,7 +4,6 @@ import { mapState, mapActions } from 'vuex';
import
glFeatureFlagMixin
from
'
~/vue_shared/mixins/gl_feature_flags_mixin
'
;
import
{
DATE_RANGES
}
from
'
../constants
'
;
import
EpicsListEmpty
from
'
./epics_list_empty.vue
'
;
import
RoadmapFilters
from
'
./roadmap_filters.vue
'
;
import
RoadmapSettings
from
'
./roadmap_settings.vue
'
;
...
...
@@ -20,15 +19,6 @@ export default {
},
mixins
:
[
glFeatureFlagMixin
()],
props
:
{
timeframeRangeType
:
{
type
:
String
,
required
:
false
,
default
:
DATE_RANGES
.
CURRENT_QUARTER
,
},
presetType
:
{
type
:
String
,
required
:
true
,
},
emptyStateIllustrationPath
:
{
type
:
String
,
required
:
true
,
...
...
@@ -52,6 +42,8 @@ export default {
'
isChildEpics
'
,
'
hasFiltersApplied
'
,
'
filterParams
'
,
'
presetType
'
,
'
timeframeRangeType
'
,
]),
showFilteredSearchbar
()
{
if
(
this
.
epicsFetchResultEmpty
)
{
...
...
ee/app/assets/javascripts/roadmap/components/roadmap_daterange.vue
View file @
01fa6af4
<
script
>
import
{
GlFormGroup
,
GlFormRadioGroup
,
GlDropdown
,
GlDropdownItem
}
from
'
@gitlab/ui
'
;
import
{
mapState
}
from
'
vuex
'
;
import
{
map
Actions
,
map
State
}
from
'
vuex
'
;
import
{
visitUrl
,
mergeUrlParams
}
from
'
~/lib/utils/url_utility
'
;
import
{
__
,
s__
}
from
'
~/locale
'
;
import
{
PRESET_TYPES
,
DATE_RANGES
}
from
'
../constants
'
;
...
...
@@ -59,6 +58,7 @@ export default {
},
},
methods
:
{
...
mapActions
([
'
setDaterange
'
,
'
fetchEpics
'
,
'
fetchMilestones
'
]),
handleDaterangeSelect
(
value
)
{
this
.
selectedDaterange
=
value
;
},
...
...
@@ -67,24 +67,19 @@ export default {
},
handleDaterangeDropdownClose
()
{
if
(
this
.
initialSelectedDaterange
!==
this
.
selectedDaterange
)
{
visitUrl
(
mergeUrlParams
(
{
timeframe_range_type
:
this
.
selectedDaterange
,
layout
:
getPresetTypeForTimeframeRangeType
(
this
.
selectedDaterange
),
},
window
.
location
.
href
,
),
);
this
.
setDaterange
({
timeframeRangeType
:
this
.
selectedDaterange
,
presetType
:
getPresetTypeForTimeframeRangeType
(
this
.
selectedDaterange
),
});
this
.
fetchEpics
();
this
.
fetchMilestones
();
}
},
handleRoadmapLayoutChange
(
presetType
)
{
visitUrl
(
mergeUrlParams
(
{
timeframe_range_type
:
this
.
selectedDaterange
,
layout
:
presetType
},
window
.
location
.
href
,
),
);
if
(
presetType
!==
this
.
presetType
)
{
this
.
setDaterange
({
timeframeRangeType
:
this
.
selectedDaterange
,
presetType
});
this
.
fetchEpics
();
}
},
},
i18n
:
{
...
...
ee/app/assets/javascripts/roadmap/roadmap_bundle.js
View file @
01fa6af4
...
...
@@ -129,8 +129,6 @@ export default () => {
render
(
createElement
)
{
return
createElement
(
'
roadmap-app
'
,
{
props
:
{
timeframeRangeType
:
this
.
timeframeRangeType
,
presetType
:
this
.
presetType
,
emptyStateIllustrationPath
:
this
.
emptyStateIllustrationPath
,
},
});
...
...
ee/app/assets/javascripts/roadmap/store/actions.js
View file @
01fa6af4
...
...
@@ -319,6 +319,9 @@ export const setBufferSize = ({ commit }, bufferSize) => commit(types.SET_BUFFER
export
const
setEpicsState
=
({
commit
},
epicsState
)
=>
commit
(
types
.
SET_EPICS_STATE
,
epicsState
);
export
const
setDaterange
=
({
commit
},
{
timeframeRangeType
,
presetType
})
=>
commit
(
types
.
SET_DATERANGE
,
{
timeframeRangeType
,
presetType
});
export
const
setFilterParams
=
({
commit
},
filterParams
)
=>
commit
(
types
.
SET_FILTER_PARAMS
,
filterParams
);
...
...
ee/app/assets/javascripts/roadmap/store/mutation_types.js
View file @
01fa6af4
...
...
@@ -29,5 +29,6 @@ export const RECEIVE_MILESTONES_FAILURE = 'RECEIVE_MILESTONES_FAILURE';
export
const
SET_BUFFER_SIZE
=
'
SET_BUFFER_SIZE
'
;
export
const
SET_EPICS_STATE
=
'
SET_EPICS_STATE
'
;
export
const
SET_DATERANGE
=
'
SET_DATERANGE
'
;
export
const
SET_FILTER_PARAMS
=
'
SET_FILTER_PARAMS
'
;
export
const
SET_SORTED_BY
=
'
SET_SORTED_BY
'
;
ee/app/assets/javascripts/roadmap/store/mutations.js
View file @
01fa6af4
import
Vue
from
'
vue
'
;
import
{
getTimeframeForRangeType
}
from
'
../utils/roadmap_utils
'
;
import
*
as
types
from
'
./mutation_types
'
;
const
resetEpics
=
(
state
)
=>
{
...
...
@@ -93,6 +94,8 @@ export default {
},
[
types
.
REQUEST_MILESTONES
](
state
)
{
state
.
milestonesFetchInProgress
=
true
;
state
.
milestones
=
[];
state
.
milestoneIds
=
[];
},
[
types
.
RECEIVE_MILESTONES_SUCCESS
](
state
,
milestones
)
{
state
.
milestonesFetchInProgress
=
false
;
...
...
@@ -122,6 +125,16 @@ export default {
resetEpics
(
state
);
},
[
types
.
SET_DATERANGE
](
state
,
{
timeframeRangeType
,
presetType
})
{
state
.
timeframeRangeType
=
timeframeRangeType
;
state
.
presetType
=
presetType
;
state
.
timeframe
=
getTimeframeForRangeType
({
timeframeRangeType
,
presetType
,
});
resetEpics
(
state
);
},
[
types
.
SET_SORTED_BY
](
state
,
sortedBy
)
{
state
.
childrenEpics
=
{};
state
.
sortedBy
=
sortedBy
;
...
...
ee/spec/features/groups/group_roadmap_spec.rb
View file @
01fa6af4
...
...
@@ -167,8 +167,6 @@ RSpec.describe 'group epic roadmap', :js do
page
.
find
(
'[data-testid="daterange-dropdown"] button.dropdown-toggle'
).
click
click_button
(
range_type
)
end
open_settings_sidebar
end
it
'renders daterange filtering dropdown with "This quarter" selected by default no layout presets available'
,
:aggregate_failures
do
...
...
ee/spec/frontend/roadmap/components/roadmap_app_spec.js
View file @
01fa6af4
...
...
@@ -30,6 +30,7 @@ describe('RoadmapApp', () => {
const
epics
=
[
mockFormattedEpic
];
const
hasFiltersApplied
=
true
;
const
presetType
=
PRESET_TYPES
.
MONTHS
;
const
timeframeRangeType
=
DATE_RANGES
.
CURRENT_YEAR
;
const
timeframe
=
getTimeframeForRangeType
({
timeframeRangeType
:
DATE_RANGES
.
CURRENT_YEAR
,
presetType
:
PRESET_TYPES
.
MONTHS
,
...
...
@@ -40,7 +41,6 @@ describe('RoadmapApp', () => {
return
shallowMountExtended
(
RoadmapApp
,
{
propsData
:
{
emptyStateIllustrationPath
,
presetType
,
},
provide
:
{
groupFullPath
:
'
gitlab-org
'
,
...
...
@@ -64,6 +64,7 @@ describe('RoadmapApp', () => {
hasFiltersApplied
,
filterQueryString
:
''
,
basePath
,
timeframeRangeType
,
});
});
...
...
ee/spec/frontend/roadmap/store/actions_spec.js
View file @
01fa6af4
...
...
@@ -487,14 +487,14 @@ describe('Roadmap Vuex Actions', () => {
beforeEach
(()
=>
{
mockState
=
{
fullPath
:
'
gitlab-org
'
,
milestones
s
State
:
'
active
'
,
milestonesState
:
'
active
'
,
presetType
:
PRESET_TYPES
.
MONTHS
,
timeframe
:
mockTimeframeMonths
,
};
expectedVariables
=
{
fullPath
:
'
gitlab-org
'
,
state
:
mockState
.
milestones
s
State
,
state
:
mockState
.
milestonesState
,
timeframe
:
{
start
:
'
2018-01-01
'
,
end
:
'
2018-12-31
'
,
...
...
@@ -644,4 +644,21 @@ describe('Roadmap Vuex Actions', () => {
);
});
});
describe
(
'
setDaterange
'
,
()
=>
{
it
(
'
should set epicsState in store state
'
,
()
=>
{
return
testAction
(
actions
.
setDaterange
,
{
timeframeRangeType
:
'
CURRENT_YEAR
'
,
presetType
:
'
MONTHS
'
},
state
,
[
{
type
:
types
.
SET_DATERANGE
,
payload
:
{
timeframeRangeType
:
'
CURRENT_YEAR
'
,
presetType
:
'
MONTHS
'
},
},
],
[],
);
});
});
});
ee/spec/frontend/roadmap/store/mutations_spec.js
View file @
01fa6af4
...
...
@@ -2,6 +2,7 @@ import * as types from 'ee/roadmap/store/mutation_types';
import
mutations
from
'
ee/roadmap/store/mutations
'
;
import
defaultState
from
'
ee/roadmap/store/state
'
;
import
{
getTimeframeForRangeType
}
from
'
ee/roadmap/utils/roadmap_utils
'
;
import
{
mockGroupId
,
...
...
@@ -303,6 +304,28 @@ describe('Roadmap Store Mutations', () => {
});
});
describe
(
'
SET_DATERANGE
'
,
()
=>
{
it
(
'
Should set `timeframeRangeType`, `presetType` and `timeframe` to the state and reset existing epics
'
,
()
=>
{
const
timeframeRangeType
=
'
CURRENT_YEAR
'
;
const
presetType
=
'
MONTHS
'
;
setEpicMockData
(
state
);
mutations
[
types
.
SET_DATERANGE
](
state
,
{
timeframeRangeType
,
presetType
});
expect
(
state
).
toMatchObject
({
timeframeRangeType
,
presetType
,
timeframe
:
getTimeframeForRangeType
({
timeframeRangeType
,
presetType
,
}),
epics
:
[],
childrenFlags
:
{},
epicIds
:
[],
});
});
});
describe
(
'
SET_SORTED_BY
'
,
()
=>
{
it
(
'
Should set `sortedBy` to the state and reset existing parent epics and children epics
'
,
()
=>
{
const
sortedBy
=
'
start_date_asc
'
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment