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
e9855d3a
Commit
e9855d3a
authored
Dec 21, 2021
by
Paul Gascou-Vaillancourt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update variable names
parent
f14c286b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
8 deletions
+8
-8
ee/app/helpers/projects/on_demand_scans_helper.rb
ee/app/helpers/projects/on_demand_scans_helper.rb
+8
-8
No files found.
ee/app/helpers/projects/on_demand_scans_helper.rb
View file @
e9855d3a
...
@@ -4,7 +4,7 @@ module Projects::OnDemandScansHelper
...
@@ -4,7 +4,7 @@ module Projects::OnDemandScansHelper
# rubocop: disable CodeReuse/ActiveRecord
# rubocop: disable CodeReuse/ActiveRecord
def
on_demand_scans_data
(
project
)
def
on_demand_scans_data
(
project
)
on_demand_scans
=
project
.
all_pipelines
.
where
(
source:
Enums
::
Ci
::
Pipeline
.
sources
[
:ondemand_dast_scan
])
on_demand_scans
=
project
.
all_pipelines
.
where
(
source:
Enums
::
Ci
::
Pipeline
.
sources
[
:ondemand_dast_scan
])
running_scan
_count
,
finished_scan
_count
=
count_running_and_finished_scans
(
on_demand_scans
)
running_scan
s_count
,
finished_scans
_count
=
count_running_and_finished_scans
(
on_demand_scans
)
saved_scans
=
::
Dast
::
ProfilesFinder
.
new
({
project_id:
project
.
id
}).
execute
saved_scans
=
::
Dast
::
ProfilesFinder
.
new
({
project_id:
project
.
id
}).
execute
scheduled_scans_count
=
saved_scans
.
count
{
|
scan
|
scan
.
dast_profile_schedule
}
scheduled_scans_count
=
saved_scans
.
count
{
|
scan
|
scan
.
dast_profile_schedule
}
...
@@ -12,8 +12,8 @@ module Projects::OnDemandScansHelper
...
@@ -12,8 +12,8 @@ module Projects::OnDemandScansHelper
'project-on-demand-scan-counts-etag'
=>
graphql_etag_project_on_demand_scan_counts_path
(
project
),
'project-on-demand-scan-counts-etag'
=>
graphql_etag_project_on_demand_scan_counts_path
(
project
),
'on-demand-scan-counts'
=>
{
'on-demand-scan-counts'
=>
{
all:
on_demand_scans
.
length
,
all:
on_demand_scans
.
length
,
running:
running_scan_count
,
running:
running_scan
s
_count
,
finished:
finished_scan_count
,
finished:
finished_scan
s
_count
,
scheduled:
scheduled_scans_count
,
scheduled:
scheduled_scans_count
,
saved:
saved_scans
.
count
saved:
saved_scans
.
count
}.
to_json
,
}.
to_json
,
...
@@ -45,17 +45,17 @@ module Projects::OnDemandScansHelper
...
@@ -45,17 +45,17 @@ module Projects::OnDemandScansHelper
end
end
def
count_running_and_finished_scans
(
on_demand_scans
)
def
count_running_and_finished_scans
(
on_demand_scans
)
running_scan_count
=
0
running_scan
s
_count
=
0
finished_scan_count
=
0
finished_scan
s
_count
=
0
on_demand_scans
.
each
do
|
pipeline
|
on_demand_scans
.
each
do
|
pipeline
|
if
%w[success failed canceled]
.
include?
(
pipeline
.
status
)
if
%w[success failed canceled]
.
include?
(
pipeline
.
status
)
finished_scan_count
+=
1
finished_scan
s
_count
+=
1
elsif
pipeline
.
status
==
"running"
elsif
pipeline
.
status
==
"running"
running_scan_count
+=
1
running_scan
s
_count
+=
1
end
end
end
end
[
running_scan
_count
,
finished_scan
_count
]
[
running_scan
s_count
,
finished_scans
_count
]
end
end
end
end
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