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
1b0e7896
Commit
1b0e7896
authored
Mar 17, 2021
by
Savas Vedova
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Do not close modal when there are error messages
- Add changelog - Update tests
parent
9e60cb39
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
3 deletions
+28
-3
ee/app/assets/javascripts/vue_shared/security_reports/mixins/vulnerability_modal_mixin.js
...ared/security_reports/mixins/vulnerability_modal_mixin.js
+3
-1
ee/changelogs/unreleased/321766-do-not-close-modal-in-case-of-error.yml
...unreleased/321766-do-not-close-modal-in-case-of-error.yml
+5
-0
ee/spec/frontend/security_dashboard/components/security_dashboard_vuex_spec.js
...rity_dashboard/components/security_dashboard_vuex_spec.js
+20
-2
No files found.
ee/app/assets/javascripts/vue_shared/security_reports/mixins/vulnerability_modal_mixin.js
View file @
1b0e7896
...
...
@@ -26,7 +26,9 @@ export const vulnerabilityModalMixin = (storeModule) => {
return
this
.
revertDismissVulnerability
(
payload
).
then
(
this
.
hideModal
);
},
hideModal
()
{
if
(
!
this
.
modal
.
error
)
{
this
.
$root
.
$emit
(
BV_HIDE_MODAL
,
VULNERABILITY_MODAL_ID
);
}
},
},
};
...
...
ee/changelogs/unreleased/321766-do-not-close-modal-in-case-of-error.yml
0 → 100644
View file @
1b0e7896
---
title
:
Do not close modal when there are error messages
merge_request
:
56893
author
:
type
:
fixed
ee/spec/frontend/security_dashboard/components/security_dashboard_vuex_spec.js
View file @
1b0e7896
...
...
@@ -8,11 +8,12 @@ import LoadingError from 'ee/security_dashboard/components/loading_error.vue';
import
SecurityDashboardLayout
from
'
ee/security_dashboard/components/security_dashboard_layout.vue
'
;
import
SecurityDashboardTable
from
'
ee/security_dashboard/components/security_dashboard_table.vue
'
;
import
SecurityDashboard
from
'
ee/security_dashboard/components/security_dashboard_vuex.vue
'
;
import
{
getStoreConfig
}
from
'
ee/security_dashboard/store
'
;
import
{
VULNERABILITY_MODAL_ID
}
from
'
ee/vue_shared/security_reports/components/constants
'
;
import
IssueModal
from
'
ee/vue_shared/security_reports/components/modal.vue
'
;
import
{
TEST_HOST
}
from
'
helpers/test_constants
'
;
import
axios
from
'
~/lib/utils/axios_utils
'
;
import
{
BV_HIDE_MODAL
}
from
'
~/lib/utils/constants
'
;
const
pipelineId
=
123
;
const
vulnerabilitiesEndpoint
=
`
${
TEST_HOST
}
/vulnerabilities`
;
...
...
@@ -21,6 +22,8 @@ jest.mock('~/lib/utils/url_utility', () => ({
getParameterValues
:
jest
.
fn
().
mockReturnValue
([]),
}));
jest
.
mock
(
'
~/flash
'
);
describe
(
'
Security Dashboard component
'
,
()
=>
{
let
wrapper
;
let
mock
;
...
...
@@ -28,7 +31,7 @@ describe('Security Dashboard component', () => {
let
fetchPipelineJobsSpy
;
let
store
;
const
createComponent
=
(
props
)
=>
{
const
createComponent
=
(
{
props
}
=
{}
)
=>
{
setPipelineIdSpy
=
jest
.
fn
();
fetchPipelineJobsSpy
=
jest
.
fn
();
...
...
@@ -119,6 +122,12 @@ describe('Security Dashboard component', () => {
);
},
);
it
(
'
emits a hide modal event when modal does not have an error and hideModal is called
'
,
async
()
=>
{
const
rootEmit
=
jest
.
spyOn
(
wrapper
.
vm
.
$root
,
'
$emit
'
);
wrapper
.
vm
.
hideModal
();
expect
(
rootEmit
).
toHaveBeenCalledWith
(
BV_HIDE_MODAL
,
VULNERABILITY_MODAL_ID
);
});
});
describe
(
'
issue modal
'
,
()
=>
{
...
...
@@ -146,6 +155,15 @@ describe('Security Dashboard component', () => {
describe
(
'
on error
'
,
()
=>
{
beforeEach
(()
=>
{
createComponent
();
store
.
dispatch
(
'
vulnerabilities/receiveDismissVulnerabilityError
'
,
{
flashError
:
'
Something went wrong
'
,
});
});
it
(
'
does not emit a hide modal event when modal has error
'
,
()
=>
{
const
rootEmit
=
jest
.
spyOn
(
wrapper
.
vm
.
$root
,
'
$emit
'
);
wrapper
.
vm
.
hideModal
();
expect
(
rootEmit
).
not
.
toHaveBeenCalled
();
});
it
.
each
([
401
,
403
])(
'
displays an error on error %s
'
,
async
(
errorCode
)
=>
{
...
...
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