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
bcc94af1
Commit
bcc94af1
authored
Aug 06, 2020
by
Kyle Mann
Committed by
Mark Florian
Aug 06, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add text import button
parent
a0adf4a2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
13 deletions
+16
-13
ee/app/assets/javascripts/security_dashboard/components/csv_export_button.vue
...ripts/security_dashboard/components/csv_export_button.vue
+14
-10
ee/spec/frontend/security_dashboard/components/csv_export_button_spec.js
...d/security_dashboard/components/csv_export_button_spec.js
+2
-3
No files found.
ee/app/assets/javascripts/security_dashboard/components/csv_export_button.vue
View file @
bcc94af1
<
script
>
<
script
>
import
{
GlPopover
,
GlIcon
,
GlLink
,
GlButton
,
GlTooltipDirective
}
from
'
@gitlab/ui
'
;
import
{
GlPopover
,
GlIcon
,
GlLink
,
GlButton
,
GlTooltipDirective
}
from
'
@gitlab/ui
'
;
import
{
s__
}
from
'
~/locale
'
;
import
{
__
,
s__
}
from
'
~/locale
'
;
import
createFlash
from
'
~/flash
'
;
import
createFlash
from
'
~/flash
'
;
import
axios
from
'
~/lib/utils/axios_utils
'
;
import
axios
from
'
~/lib/utils/axios_utils
'
;
import
{
formatDate
}
from
'
~/lib/utils/datetime_utility
'
;
import
{
formatDate
}
from
'
~/lib/utils/datetime_utility
'
;
...
@@ -29,6 +29,16 @@ export default {
...
@@ -29,6 +29,16 @@ export default {
isPreparingCsvExport
:
false
,
isPreparingCsvExport
:
false
,
showPopover
:
localStorage
.
getItem
(
STORAGE_KEY
)
!==
'
true
'
,
showPopover
:
localStorage
.
getItem
(
STORAGE_KEY
)
!==
'
true
'
,
}),
}),
computed
:
{
buttonProps
()
{
const
{
isPreparingCsvExport
}
=
this
;
return
{
title
:
__
(
'
Export as CSV
'
),
loading
:
isPreparingCsvExport
,
...(
!
isPreparingCsvExport
?
{
icon
:
'
export
'
}
:
{}),
};
},
},
methods
:
{
methods
:
{
closePopover
()
{
closePopover
()
{
this
.
showPopover
=
false
;
this
.
showPopover
=
false
;
...
@@ -66,17 +76,11 @@ export default {
...
@@ -66,17 +76,11 @@ export default {
<gl-button
<gl-button
ref=
"csvExportButton"
ref=
"csvExportButton"
v-gl-tooltip
.
hover
v-gl-tooltip
.
hover
class=
"align-self-center"
class=
"gl-align-self-center"
:title=
"__('Export as CSV')"
v-bind=
"buttonProps"
:loading=
"isPreparingCsvExport"
@
click=
"initiateCsvExport"
@
click=
"initiateCsvExport"
>
>
<gl-icon
{{
__
(
'
Export
'
)
}}
v-if=
"!isPreparingCsvExport"
ref=
"exportIcon"
name=
"export"
class=
"mr-0 gl-display-block"
/>
<gl-popover
<gl-popover
ref=
"popover"
ref=
"popover"
:target=
"() => $refs.csvExportButton.$el"
:target=
"() => $refs.csvExportButton.$el"
...
...
ee/spec/frontend/security_dashboard/components/csv_export_button_spec.js
View file @
bcc94af1
...
@@ -25,7 +25,6 @@ describe('Csv Button Export', () => {
...
@@ -25,7 +25,6 @@ describe('Csv Button Export', () => {
const
findPopoverButton
=
()
=>
wrapper
.
find
({
ref
:
'
popoverButton
'
});
const
findPopoverButton
=
()
=>
wrapper
.
find
({
ref
:
'
popoverButton
'
});
const
findPopover
=
()
=>
wrapper
.
find
({
ref
:
'
popover
'
});
const
findPopover
=
()
=>
wrapper
.
find
({
ref
:
'
popover
'
});
const
findCsvExportButton
=
()
=>
wrapper
.
find
({
ref
:
'
csvExportButton
'
});
const
findCsvExportButton
=
()
=>
wrapper
.
find
({
ref
:
'
csvExportButton
'
});
const
findExportIcon
=
()
=>
wrapper
.
find
({
ref
:
'
exportIcon
'
});
const
createComponent
=
()
=>
{
const
createComponent
=
()
=>
{
return
shallowMount
(
CsvExportButton
,
{
return
shallowMount
(
CsvExportButton
,
{
...
@@ -101,7 +100,7 @@ describe('Csv Button Export', () => {
...
@@ -101,7 +100,7 @@ describe('Csv Button Export', () => {
});
});
it
(
'
displays the export icon when not loading and the loading icon when loading
'
,
()
=>
{
it
(
'
displays the export icon when not loading and the loading icon when loading
'
,
()
=>
{
expect
(
find
ExportIcon
().
props
(
'
name
'
)).
toBe
(
'
export
'
);
expect
(
find
CsvExportButton
().
props
(
'
icon
'
)).
toBe
(
'
export
'
);
expect
(
findCsvExportButton
().
props
(
'
loading
'
)).
toBe
(
false
);
expect
(
findCsvExportButton
().
props
(
'
loading
'
)).
toBe
(
false
);
wrapper
.
setData
({
wrapper
.
setData
({
...
@@ -109,7 +108,7 @@ describe('Csv Button Export', () => {
...
@@ -109,7 +108,7 @@ describe('Csv Button Export', () => {
});
});
return
wrapper
.
vm
.
$nextTick
(()
=>
{
return
wrapper
.
vm
.
$nextTick
(()
=>
{
expect
(
find
ExportIcon
().
exists
()).
toBe
(
false
);
expect
(
find
CsvExportButton
().
props
(
'
icon
'
)).
toBeFalsy
(
);
expect
(
findCsvExportButton
().
props
(
'
loading
'
)).
toBe
(
true
);
expect
(
findCsvExportButton
().
props
(
'
loading
'
)).
toBe
(
true
);
});
});
});
});
...
...
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