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
fad10ed9
Commit
fad10ed9
authored
Dec 02, 2018
by
Heinrich Lee Yu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Save epics state filter in user preference
parent
f6289d49
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
67 additions
and
5 deletions
+67
-5
db/schema.rb
db/schema.rb
+1
-0
ee/app/assets/javascripts/roadmap/index.js
ee/app/assets/javascripts/roadmap/index.js
+1
-1
ee/app/controllers/groups/roadmap_controller.rb
ee/app/controllers/groups/roadmap_controller.rb
+14
-2
ee/app/views/shared/epic/_state_dropdown.html.haml
ee/app/views/shared/epic/_state_dropdown.html.haml
+1
-1
ee/db/migrate/20181201151856_add_epics_state_to_user_preferences.rb
...ate/20181201151856_add_epics_state_to_user_preferences.rb
+14
-0
ee/spec/features/groups/group_roadmap_spec.rb
ee/spec/features/groups/group_roadmap_spec.rb
+36
-1
No files found.
db/schema.rb
View file @
fad10ed9
...
...
@@ -2835,6 +2835,7 @@ ActiveRecord::Schema.define(version: 20181204135932) do
t
.
datetime_with_timezone
"created_at"
,
null:
false
t
.
datetime_with_timezone
"updated_at"
,
null:
false
t
.
string
"epics_sort"
t
.
integer
"roadmap_epics_state"
t
.
index
[
"user_id"
],
name:
"index_user_preferences_on_user_id"
,
unique:
true
,
using: :btree
end
...
...
ee/app/assets/javascripts/roadmap/index.js
View file @
fad10ed9
...
...
@@ -54,7 +54,7 @@ export default () => {
filterQueryString
,
presetType
,
timeframe
,
state
:
dataset
.
epicsState
state
:
dataset
.
epicsState
,
});
const
store
=
new
RoadmapStore
(
parseInt
(
dataset
.
groupId
,
0
),
timeframe
,
presetType
);
...
...
ee/app/controllers/groups/roadmap_controller.rb
View file @
fad10ed9
...
...
@@ -13,9 +13,8 @@ module Groups
def
show
# Used to persist the order and show the correct sorting dropdown on UI.
@sort
=
set_sort_order
@epics_state
=
epics_state_in_user_preference
||
'all'
@epics_count
=
EpicsFinder
.
new
(
current_user
,
group_id:
@group
.
id
).
execute
.
count
@epics_state
=
params
[
:state
]
||
'all'
end
private
...
...
@@ -34,5 +33,18 @@ module Groups
Users
::
UpdateService
.
new
(
current_user
,
user:
current_user
,
roadmap_layout:
roadmap_layout
).
execute
end
def
epics_state_in_user_preference
return
unless
current_user
preference
=
current_user
.
user_preference
state_id
=
Epic
.
states
[
params
[
:state
]]
if
params
[
:state
].
present?
&&
state_id
!=
preference
.
roadmap_epics_state
preference
.
update
(
roadmap_epics_state:
state_id
)
end
Epic
.
states
.
key
(
preference
.
roadmap_epics_state
)
end
end
end
ee/app/views/shared/epic/_state_dropdown.html.haml
View file @
fad10ed9
.dropdown.inline
.dropdown.inline
.dropdown-epics-state
%button
.dropdown-toggle
{
type:
'button'
,
data:
{
toggle:
'dropdown'
}
}
=
epic_state_title
(
@epics_state
)
=
icon
(
'chevron-down'
)
...
...
ee/db/migrate/20181201151856_add_epics_state_to_user_preferences.rb
0 → 100644
View file @
fad10ed9
# frozen_string_literal: true
# See http://doc.gitlab.com/ce/development/migration_style_guide.html
# for more information on how to write migrations for GitLab.
class
AddEpicsStateToUserPreferences
<
ActiveRecord
::
Migration
[
5.0
]
include
Gitlab
::
Database
::
MigrationHelpers
DOWNTIME
=
false
def
change
add_column
:user_preferences
,
:roadmap_epics_state
,
:integer
end
end
ee/spec/features/groups/group_roadmap_spec.rb
View file @
fad10ed9
...
...
@@ -8,6 +8,7 @@ describe 'group epic roadmap', :js do
let
(
:filtered_search
)
{
find
(
'.filtered-search'
)
}
let
(
:js_dropdown_label
)
{
'#js-dropdown-label'
}
let
(
:filter_dropdown
)
{
find
(
"
#{
js_dropdown_label
}
.filter-dropdown"
)
}
let
(
:state_dropdown
)
{
find
(
'.dropdown-epics-state'
)
}
let
(
:bug_label
)
{
create
(
:group_label
,
group:
group
,
title:
'Bug'
)
}
let
(
:critical_label
)
{
create
(
:group_label
,
group:
group
,
title:
'Critical'
)
}
...
...
@@ -50,7 +51,7 @@ describe 'group epic roadmap', :js do
end
it
'renders the sort dropdown correctly'
do
page
.
within
(
'.content-wrapper .content .epics-filters'
)
do
page
.
within
(
'.content-wrapper .content .epics-
other-
filters'
)
do
expect
(
page
).
to
have_css
(
'.filter-dropdown-container'
)
find
(
'.dropdown-toggle'
).
click
page
.
within
(
'.dropdown-menu'
)
do
...
...
@@ -76,6 +77,40 @@ describe 'group epic roadmap', :js do
end
end
describe
'roadmap page with epics state filter'
do
before
do
state_dropdown
.
find
(
'.dropdown-toggle'
).
click
end
it
'renders open epics only'
do
state_dropdown
.
find
(
'a'
,
text:
'Open epics'
).
click
page
.
within
(
'.roadmap-container .epics-list-section'
)
do
expect
(
page
).
to
have_selector
(
'.epics-list-item .epic-title'
,
count:
2
)
end
end
it
'renders closed epics only'
do
state_dropdown
.
find
(
'a'
,
text:
'Closed epics'
).
click
page
.
within
(
'.roadmap-container .epics-list-section'
)
do
expect
(
page
).
to
have_selector
(
'.epics-list-item .epic-title'
,
count:
1
)
end
end
it
'saves last selected epic state'
do
state_dropdown
.
find
(
'a'
,
text:
'Open epics'
).
click
visit
group_roadmap_path
(
group
)
wait_for_requests
expect
(
state_dropdown
.
find
(
'.dropdown-toggle'
)).
to
have_text
(
"Open epics"
)
page
.
within
(
'.roadmap-container .epics-list-section'
)
do
expect
(
page
).
to
have_selector
(
'.epics-list-item .epic-title'
,
count:
2
)
end
end
end
describe
'roadmap page with filter applied'
do
before
do
search_for_label
(
bug_label
)
...
...
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