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
2255b995
Commit
2255b995
authored
Dec 04, 2020
by
Paul Gascou-Vaillancourt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplify pending URLs computation
parent
09ed16d8
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
29 deletions
+19
-29
ee/app/assets/javascripts/security_configuration/dast_profiles/components/dast_site_profiles_list.vue
...tion/dast_profiles/components/dast_site_profiles_list.vue
+19
-29
No files found.
ee/app/assets/javascripts/security_configuration/dast_profiles/components/dast_site_profiles_list.vue
View file @
2255b995
...
...
@@ -12,7 +12,7 @@ import ProfilesList from './dast_profiles_list.vue';
import
glFeatureFlagsMixin
from
'
~/vue_shared/mixins/gl_feature_flags_mixin
'
;
import
{
fetchPolicies
}
from
'
~/lib/graphql
'
;
const
{
PENDING
,
INPROGRESS
,
FAILED
,
PASSED
}
=
DAST_SITE_VALIDATION_STATUS
;
const
{
PENDING
,
INPROGRESS
,
FAILED
}
=
DAST_SITE_VALIDATION_STATUS
;
export
default
{
components
:
{
...
...
@@ -34,14 +34,15 @@ export default {
},
pollInterval
:
DAST_SITE_VALIDATION_POLLING_INTERVAL
,
skip
()
{
return
!
this
.
urlsPendingValidation
.
length
;
return
(
!
this
.
glFeatures
.
securityOnDemandScansSiteValidation
||
!
this
.
urlsPendingValidation
.
length
);
},
result
(
response
)
{
const
{
result
({
data
:
{
validations
:
{
nodes
=
[]
},
},
}
=
response
;
})
{
const
store
=
this
.
$apolloProvider
.
defaultClient
;
nodes
.
forEach
(({
normalizedTargetUrl
,
status
})
=>
{
updateSiteProfilesStatuses
({
...
...
@@ -50,11 +51,6 @@ export default {
status
,
store
,
});
if
([
PASSED
,
FAILED
].
includes
(
status
))
{
this
.
urlsPendingValidation
=
this
.
urlsPendingValidation
.
filter
(
url
=>
url
!==
normalizedTargetUrl
,
);
}
});
},
},
...
...
@@ -76,26 +72,20 @@ export default {
data
()
{
return
{
validatingProfile
:
null
,
urlsPendingValidation
:
[],
};
},
statuses
:
DAST_SITE_VALIDATION_STATUS_PROPS
,
watch
:
{
profiles
:
{
immediate
:
true
,
handler
(
profiles
=
[])
{
if
(
!
this
.
glFeatures
.
securityOnDemandScansSiteValidation
)
{
return
;
}
profiles
.
forEach
(({
validationStatus
,
normalizedTargetUrl
})
=>
{
computed
:
{
urlsPendingValidation
()
{
return
this
.
profiles
.
reduce
((
acc
,
{
validationStatus
,
normalizedTargetUrl
})
=>
{
if
(
[
PENDING
,
INPROGRESS
].
includes
(
validationStatus
)
&&
!
this
.
urlsPendingValidation
.
includes
(
normalizedTargetUrl
)
!
acc
.
includes
(
normalizedTargetUrl
)
)
{
this
.
urlsPendingValidation
.
push
(
normalizedTargetUrl
)
;
return
[...
acc
,
normalizedTargetUrl
]
;
}
})
;
},
return
acc
;
},
[]);
},
},
methods
:
{
...
...
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