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
572a21ff
Commit
572a21ff
authored
Mar 07, 2017
by
James Edwards-Jones
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issues CSV exports additional fields
parent
7503d439
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
35 additions
and
8 deletions
+35
-8
app/services/issues/export_csv_service.rb
app/services/issues/export_csv_service.rb
+8
-2
app/views/notify/issues_csv_email.html.haml
app/views/notify/issues_csv_email.html.haml
+2
-3
app/views/projects/issues/export_issues/_csv_download.html.haml
...ews/projects/issues/export_issues/_csv_download.html.haml
+3
-2
spec/services/issues/export_csv_service_spec.rb
spec/services/issues/export_csv_service_spec.rb
+22
-1
No files found.
app/services/issues/export_csv_service.rb
View file @
572a21ff
module
Issues
module
Issues
class
ExportCsvService
class
ExportCsvService
include
Rails
.
application
.
routes
.
url_helpers
include
GitlabRoutingHelper
# Target attachment size before base64 encoding
# Target attachment size before base64 encoding
TARGET_FILESIZE
=
15000000
TARGET_FILESIZE
=
15000000
...
@@ -26,12 +29,15 @@ module Issues
...
@@ -26,12 +29,15 @@ module Issues
def
header_to_value_hash
def
header_to_value_hash
{
{
'Issue ID'
=>
'iid'
,
'Issue ID'
=>
'iid'
,
'URL'
=>
->
(
issue
)
{
issue_url
(
issue
)
},
'Title'
=>
'title'
,
'Title'
=>
'title'
,
'State'
=>
'state'
,
'State'
=>
->
(
issue
)
{
issue
.
closed?
?
'Closed'
:
'Open'
}
,
'Description'
=>
'description'
,
'Description'
=>
'description'
,
'Author'
=>
'author_name'
,
'Author'
=>
'author_name'
,
'Author Username'
=>
->
(
issue
)
{
issue
.
author
&
.
username
},
'Assignee'
=>
'assignee_name'
,
'Assignee'
=>
'assignee_name'
,
'Confidential'
=>
'confidential'
,
'Assignee Username'
=>
->
(
issue
)
{
issue
.
assignee
&
.
username
},
'Confidential'
=>
->
(
issue
)
{
issue
.
confidential?
?
'Yes'
:
'No'
},
'Due Date'
=>
->
(
issue
)
{
issue
.
due_date
&
.
to_s
(
:csv
)
},
'Due Date'
=>
->
(
issue
)
{
issue
.
due_date
&
.
to_s
(
:csv
)
},
'Created At (UTC)'
=>
->
(
issue
)
{
issue
.
created_at
&
.
to_s
(
:csv
)
},
'Created At (UTC)'
=>
->
(
issue
)
{
issue
.
created_at
&
.
to_s
(
:csv
)
},
'Updated At (UTC)'
=>
->
(
issue
)
{
issue
.
updated_at
&
.
to_s
(
:csv
)
},
'Updated At (UTC)'
=>
->
(
issue
)
{
issue
.
updated_at
&
.
to_s
(
:csv
)
},
...
...
app/views/notify/issues_csv_email.html.haml
View file @
572a21ff
...
@@ -60,9 +60,8 @@
...
@@ -60,9 +60,8 @@
=
@project
.
full_name
=
@project
.
full_name
has been added to this email as an attachment.
has been added to this email as an attachment.
-
if
@truncated
-
if
@truncated
%br
%p
%br
This attachment has been truncated due to exceeding the maximum attachment size. Consider re-exporting with a narrower selection of issues.
This attachment has been truncated due to exceeding the maximum attachment size. Consider re-exporting with a narrower selection of issues.
%tr
.footer
%tr
.footer
%td
{
style:
"font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;padding:25px 0;font-size:13px;line-height:1.6;color:#5c5c5c;"
}
%td
{
style:
"font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;padding:25px 0;font-size:13px;line-height:1.6;color:#5c5c5c;"
}
%img
{
alt:
"GitLab"
,
height:
"33"
,
src:
image_url
(
'mailers/ci_pipeline_notif_v1/gitlab-logo-full-horizontal.gif'
),
style:
"display:block;margin:0 auto 1em;"
,
width:
"90"
}
/
%img
{
alt:
"GitLab"
,
height:
"33"
,
src:
image_url
(
'mailers/ci_pipeline_notif_v1/gitlab-logo-full-horizontal.gif'
),
style:
"display:block;margin:0 auto 1em;"
,
width:
"90"
}
/
...
...
app/views/projects/issues/export_issues/_csv_download.html.haml
View file @
572a21ff
...
@@ -13,7 +13,8 @@
...
@@ -13,7 +13,8 @@
#{
@issues_count
}
issues selected
#{
@issues_count
}
issues selected
.modal-body
.modal-body
%div
%div
After we finish preparing your .csv export, we'll email it to
The CSV export will be created in the background. Once it is finished, it will be attached to an email sent to
%strong
=
@current_user
.
email
=
succeed
'.'
do
%strong
=
@current_user
.
notification_email
.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
,
params
.
permit
(
IssuableFinder
::
VALID_PARAMS
)),
method: :post
,
class:
'btn btn-success pull-left'
,
title:
'Export issues'
spec/services/issues/export_csv_service_spec.rb
View file @
572a21ff
...
@@ -35,16 +35,29 @@ describe Issues::ExportCsvService, services: true do
...
@@ -35,16 +35,29 @@ describe Issues::ExportCsvService, services: true do
issue
.
update!
(
milestone:
milestone
,
issue
.
update!
(
milestone:
milestone
,
assignee:
user
,
assignee:
user
,
description:
'Issue with details'
,
description:
'Issue with details'
,
state: :reopened
,
due_date:
DateTime
.
new
(
2014
,
3
,
2
),
due_date:
DateTime
.
new
(
2014
,
3
,
2
),
created_at:
DateTime
.
new
(
2015
,
4
,
3
,
2
,
1
,
0
),
created_at:
DateTime
.
new
(
2015
,
4
,
3
,
2
,
1
,
0
),
updated_at:
DateTime
.
new
(
2016
,
5
,
4
,
3
,
2
,
1
),
updated_at:
DateTime
.
new
(
2016
,
5
,
4
,
3
,
2
,
1
),
labels:
[
feature_label
,
idea_label
])
labels:
[
feature_label
,
idea_label
])
end
end
specify
'iid'
do
expect
(
csv
[
0
][
'Issue ID'
]).
to
eq
issue
.
iid
.
to_s
end
specify
'url'
do
expect
(
csv
[
0
][
'URL'
]).
to
match
(
/http.*
#{
project
.
full_path
}
.*
#{
issue
.
iid
}
/
)
end
specify
'title'
do
specify
'title'
do
expect
(
csv
[
0
][
'Title'
]).
to
eq
issue
.
title
expect
(
csv
[
0
][
'Title'
]).
to
eq
issue
.
title
end
end
specify
'state'
do
expect
(
csv
[
0
][
'State'
]).
to
eq
'Open'
end
specify
'description'
do
specify
'description'
do
expect
(
csv
[
0
][
'Description'
]).
to
eq
issue
.
description
expect
(
csv
[
0
][
'Description'
]).
to
eq
issue
.
description
end
end
...
@@ -53,12 +66,20 @@ describe Issues::ExportCsvService, services: true do
...
@@ -53,12 +66,20 @@ describe Issues::ExportCsvService, services: true do
expect
(
csv
[
0
][
'Author'
]).
to
eq
issue
.
author_name
expect
(
csv
[
0
][
'Author'
]).
to
eq
issue
.
author_name
end
end
specify
'author username'
do
expect
(
csv
[
0
][
'Author Username'
]).
to
eq
issue
.
author
.
username
end
specify
'assignee name'
do
specify
'assignee name'
do
expect
(
csv
[
0
][
'Assignee'
]).
to
eq
issue
.
assignee_name
expect
(
csv
[
0
][
'Assignee'
]).
to
eq
issue
.
assignee_name
end
end
specify
'assignee username'
do
expect
(
csv
[
0
][
'Assignee Username'
]).
to
eq
issue
.
assignee
.
username
end
specify
'confidential'
do
specify
'confidential'
do
expect
(
csv
[
0
][
'Confidential'
]).
to
eq
'
false
'
expect
(
csv
[
0
][
'Confidential'
]).
to
eq
'
No
'
end
end
specify
'milestone'
do
specify
'milestone'
do
...
...
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