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
85fbea43
Commit
85fbea43
authored
Mar 10, 2022
by
Samantha Ming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add polling to security training url
Issue:
https://gitlab.com/gitlab-org/gitlab/-/issues/355132
parent
b6008e3f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
1 deletion
+24
-1
ee/app/assets/javascripts/vulnerabilities/components/vulnerability_training.vue
...pts/vulnerabilities/components/vulnerability_training.vue
+2
-1
ee/spec/frontend/vulnerabilities/vulnerability_training_spec.js
...c/frontend/vulnerabilities/vulnerability_training_spec.js
+22
-0
No files found.
ee/app/assets/javascripts/vulnerabilities/components/vulnerability_training.vue
View file @
85fbea43
...
@@ -52,13 +52,14 @@ export default {
...
@@ -52,13 +52,14 @@ export default {
},
},
vulnerability
:
{
vulnerability
:
{
query
:
securityTrainingVulnerabilityQuery
,
query
:
securityTrainingVulnerabilityQuery
,
pollInterval
:
5000
,
update
({
vulnerability
})
{
update
({
vulnerability
})
{
const
allUrlsAreReady
=
vulnerability
?.
securityTrainingUrls
?.
every
(
const
allUrlsAreReady
=
vulnerability
?.
securityTrainingUrls
?.
every
(
({
status
})
=>
status
===
SECURITY_TRAINING_URL_STATUS_COMPLETED
,
({
status
})
=>
status
===
SECURITY_TRAINING_URL_STATUS_COMPLETED
,
);
);
if
(
allUrlsAreReady
)
{
if
(
allUrlsAreReady
)
{
// note: once we add polling, we can call `.stopPolling` here
this
.
$apollo
.
queries
.
vulnerability
.
stopPolling
();
this
.
isUrlsLoading
=
false
;
this
.
isUrlsLoading
=
false
;
}
}
...
...
ee/spec/frontend/vulnerabilities/vulnerability_training_spec.js
View file @
85fbea43
...
@@ -195,6 +195,28 @@ describe('VulnerabilityTraining component', () => {
...
@@ -195,6 +195,28 @@ describe('VulnerabilityTraining component', () => {
});
});
});
});
describe
(
'
polling
'
,
()
=>
{
beforeEach
(()
=>
{
createApolloProvider
();
createComponent
();
});
it
(
'
sets polling at 5000 ms
'
,
()
=>
{
expect
(
wrapper
.
vm
.
$apollo
.
queries
.
vulnerability
.
options
.
pollInterval
).
toBe
(
5000
);
});
it
(
'
stops polling when every training url status is completed
'
,
async
()
=>
{
jest
.
spyOn
(
wrapper
.
vm
.
$apollo
.
queries
.
vulnerability
,
'
stopPolling
'
)
.
mockImplementation
(
jest
.
fn
());
await
waitForQueryToBeLoaded
();
await
nextTick
();
expect
(
wrapper
.
vm
.
$apollo
.
queries
.
vulnerability
.
stopPolling
).
toHaveBeenCalled
();
});
});
describe
(
'
training item
'
,
()
=>
{
describe
(
'
training item
'
,
()
=>
{
it
(
'
displays correct number of training items
'
,
async
()
=>
{
it
(
'
displays correct number of training items
'
,
async
()
=>
{
createApolloProvider
();
createApolloProvider
();
...
...
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