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
03cedbc5
Commit
03cedbc5
authored
Apr 13, 2020
by
Savas Vedova
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix csv export file name
- Provide a filename to the download property
parent
ecf51c78
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
2 deletions
+8
-2
ee/app/assets/javascripts/security_dashboard/components/csv_export_button.vue
...ripts/security_dashboard/components/csv_export_button.vue
+2
-1
ee/spec/frontend/security_dashboard/components/csv_export_button_spec.js
...d/security_dashboard/components/csv_export_button_spec.js
+6
-1
No files found.
ee/app/assets/javascripts/security_dashboard/components/csv_export_button.vue
View file @
03cedbc5
...
...
@@ -10,6 +10,7 @@ import {
import
{
s__
}
from
'
~/locale
'
;
import
createFlash
from
'
~/flash
'
;
import
axios
from
'
~/lib/utils/axios_utils
'
;
import
{
formatDate
}
from
'
~/lib/utils/datetime_utility
'
;
import
pollUntilComplete
from
'
~/lib/utils/poll_until_complete
'
;
export
const
STORAGE_KEY
=
'
vulnerability_csv_export_popover_dismissed
'
;
...
...
@@ -54,7 +55,7 @@ export default {
.
then
(({
data
})
=>
pollUntilComplete
(
data
.
_links
.
self
))
.
then
(({
data
})
=>
{
const
anchor
=
document
.
createElement
(
'
a
'
);
anchor
.
download
=
''
;
anchor
.
download
=
`csv-export-
${
formatDate
(
new
Date
(),
'
isoDateTime
'
)}
.csv`
;
anchor
.
href
=
data
.
_links
.
download
;
anchor
.
click
();
})
...
...
ee/spec/frontend/security_dashboard/components/csv_export_button_spec.js
View file @
03cedbc5
...
...
@@ -10,6 +10,9 @@ import CsvExportButton, {
import
axios
from
'
~/lib/utils/axios_utils
'
;
jest
.
mock
(
'
~/flash
'
);
jest
.
mock
(
'
~/lib/utils/datetime_utility
'
,
()
=>
({
formatDate
:
()
=>
'
2020-04-12-10T14_32_35
'
,
}));
const
vulnerabilitiesExportEndpoint
=
`
${
TEST_HOST
}
/vulnerability_findings.csv`
;
...
...
@@ -81,7 +84,9 @@ describe('Csv Button Export', () => {
return
axios
.
waitForAll
().
then
(()
=>
{
expect
(
spy
).
toHaveBeenCalledWith
(
'
a
'
);
expect
(
downloadAnchor
.
href
).
toContain
(
downloadLink
);
expect
(
downloadAnchor
.
hasAttribute
(
'
download
'
)).
toBe
(
true
);
expect
(
downloadAnchor
.
getAttribute
(
'
download
'
)).
toBe
(
`csv-export-2020-04-12-10T14_32_35.csv`
,
);
expect
(
downloadAnchor
.
click
).
toHaveBeenCalled
();
});
});
...
...
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