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
4074cb3b
Commit
4074cb3b
authored
Mar 16, 2017
by
James Edwards-Jones
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed filter by label for issues CSV export
parent
31bde06d
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
15 additions
and
5 deletions
+15
-5
app/controllers/concerns/issuable_collections.rb
app/controllers/concerns/issuable_collections.rb
+1
-1
app/controllers/projects/issues_controller.rb
app/controllers/projects/issues_controller.rb
+1
-2
app/finders/issuable_finder.rb
app/finders/issuable_finder.rb
+4
-1
app/views/projects/issues/export_issues/_csv_download.html.haml
...ews/projects/issues/export_issues/_csv_download.html.haml
+1
-1
spec/features/issues/csv_spec.rb
spec/features/issues/csv_spec.rb
+8
-0
No files found.
app/controllers/concerns/issuable_collections.rb
View file @
4074cb3b
...
@@ -81,7 +81,7 @@ module IssuableCollections
...
@@ -81,7 +81,7 @@ module IssuableCollections
# @filter_params[:authorized_only] = true
# @filter_params[:authorized_only] = true
end
end
@filter_params
@filter_params
.
permit
(
IssuableFinder
::
VALID_PARAMS
)
end
end
def
set_default_scope
def
set_default_scope
...
...
app/controllers/projects/issues_controller.rb
View file @
4074cb3b
...
@@ -146,8 +146,7 @@ class Projects::IssuesController < Projects::ApplicationController
...
@@ -146,8 +146,7 @@ class Projects::IssuesController < Projects::ApplicationController
end
end
def
export_csv
def
export_csv
csv_params
=
filter_params
.
permit
(
IssuableFinder
::
VALID_PARAMS
)
ExportCsvWorker
.
perform_async
(
@current_user
.
id
,
@project
.
id
,
filter_params
)
ExportCsvWorker
.
perform_async
(
@current_user
.
id
,
@project
.
id
,
csv_params
)
index_path
=
namespace_project_issues_path
(
@project
.
namespace
,
@project
)
index_path
=
namespace_project_issues_path
(
@project
.
namespace
,
@project
)
redirect_to
(
index_path
,
notice:
"Your CSV export has started. It will be emailed to
#{
current_user
.
notification_email
}
when complete."
)
redirect_to
(
index_path
,
notice:
"Your CSV export has started. It will be emailed to
#{
current_user
.
notification_email
}
when complete."
)
...
...
app/finders/issuable_finder.rb
View file @
4074cb3b
...
@@ -20,7 +20,10 @@
...
@@ -20,7 +20,10 @@
#
#
class
IssuableFinder
class
IssuableFinder
NONE
=
'0'
.
freeze
NONE
=
'0'
.
freeze
VALID_PARAMS
=
%i(scope state group_id project_id milestone_title assignee_id search label_name sort assignee_username author_id author_username authorized_only due_date iids non_archived weight)
.
freeze
SCALAR_PARAMS
=
%i(scope state group_id project_id milestone_title assignee_id search label_name sort assignee_username author_id author_username authorized_only due_date iids non_archived weight)
.
freeze
ARRAY_PARAMS
=
{
label_name:
[],
iids:
[]
}.
freeze
VALID_PARAMS
=
(
SCALAR_PARAMS
+
[
ARRAY_PARAMS
]).
freeze
attr_accessor
:current_user
,
:params
attr_accessor
:current_user
,
:params
...
...
app/views/projects/issues/export_issues/_csv_download.html.haml
View file @
4074cb3b
...
@@ -17,4 +17,4 @@
...
@@ -17,4 +17,4 @@
%strong
=
@current_user
.
notification_email
%strong
=
@current_user
.
notification_email
in an attachment.
in an attachment.
.modal-footer
.modal-footer
=
link_to
'Export issues'
,
export_csv_namespace_project_issues_path
(
@project
.
namespace
,
@project
,
params
.
permit
(
IssuableFinder
::
VALID_PARAMS
)
),
method: :post
,
class:
'btn btn-success pull-left'
,
title:
'Export issues'
=
link_to
'Export issues'
,
export_csv_namespace_project_issues_path
(
@project
.
namespace
,
@project
,
request
.
query_parameters
),
method: :post
,
class:
'btn btn-success pull-left'
,
title:
'Export issues'
spec/features/issues/csv_spec.rb
View file @
4074cb3b
...
@@ -63,6 +63,14 @@ describe 'Issues csv', feature: true do
...
@@ -63,6 +63,14 @@ describe 'Issues csv', feature: true do
expect
(
csv
.
count
).
to
eq
0
expect
(
csv
.
count
).
to
eq
0
end
end
it
'uses array filters, such as label_name'
do
issue
.
update!
(
labels:
[
idea_label
])
request_csv
(
"label_name[]"
=>
'Bug'
)
expect
(
csv
.
count
).
to
eq
0
end
it
'avoids excessive database calls'
do
it
'avoids excessive database calls'
do
control_count
=
ActiveRecord
::
QueryRecorder
.
new
{
request_csv
}.
count
control_count
=
ActiveRecord
::
QueryRecorder
.
new
{
request_csv
}.
count
create_list
(
:labeled_issue
,
create_list
(
:labeled_issue
,
...
...
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