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
f6753702
Commit
f6753702
authored
Nov 12, 2021
by
David Pisek
Committed by
Savas Vedova
Nov 12, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Resolve "Vulnerability report shows empty state if there are no pipelines"
parent
c3f0b38f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
13 deletions
+27
-13
ee/app/assets/javascripts/security_dashboard/components/shared/vulnerability_report.vue
...rity_dashboard/components/shared/vulnerability_report.vue
+19
-7
ee/spec/frontend/security_dashboard/components/shared/vulnerability_report_spec.js
..._dashboard/components/shared/vulnerability_report_spec.js
+8
-6
No files found.
ee/app/assets/javascripts/security_dashboard/components/shared/vulnerability_report.vue
View file @
f6753702
...
...
@@ -15,7 +15,6 @@ import AutoFixUserCallout from './auto_fix_user_callout.vue';
import
CsvExportButton
from
'
./csv_export_button.vue
'
;
import
ReportNotConfiguredGroup
from
'
./empty_states/report_not_configured_group.vue
'
;
import
ReportNotConfiguredInstance
from
'
./empty_states/report_not_configured_instance.vue
'
;
import
ReportNotConfiguredProject
from
'
./empty_states/report_not_configured_project.vue
'
;
import
ReportNotConfiguredOperational
from
'
./empty_states/report_not_configured_operational.vue
'
;
import
Filters
from
'
./filters/filters_layout.vue
'
;
import
ProjectPipelineStatus
from
'
./project_pipeline_status.vue
'
;
...
...
@@ -36,7 +35,6 @@ export default {
SurveyRequestBanner
,
ReportNotConfiguredGroup
,
ReportNotConfiguredInstance
,
ReportNotConfiguredProject
,
ReportNotConfiguredOperational
,
PortalTarget
,
ProjectPipelineStatus
,
...
...
@@ -107,9 +105,20 @@ export default {
return
!
this
.
isPipeline
;
},
isDashboardConfigured
()
{
return
this
.
isProject
||
this
.
isPipeline
?
Boolean
(
this
.
pipeline
?.
id
)
:
this
.
projects
.
length
>
0
&&
this
.
projectsWereFetched
;
// Projects can have manually created vulnerabilities, so we always show the report
if
(
this
.
isProject
)
{
return
true
;
}
if
(
this
.
isPipeline
)
{
return
Boolean
(
this
.
pipeline
?.
id
);
}
// Group and Instance Dashboards
return
this
.
projects
.
length
>
0
;
},
shouldShowPipelineStatus
()
{
return
this
.
isProject
&&
Boolean
(
this
.
pipeline
);
},
},
methods
:
{
...
...
@@ -139,7 +148,6 @@ export default {
<survey-request-banner
v-if=
"shouldShowSurvey"
class=
"gl-mt-5"
/>
<report-not-configured-group
v-if=
"isGroup"
/>
<report-not-configured-instance
v-else-if=
"isInstance"
/>
<report-not-configured-project
v-else-if=
"isProject"
/>
</
template
>
<
template
v-else
>
<portal-target
:name=
"$options.vulnerabilityReportAlertsPortal"
multiple
/>
...
...
@@ -166,7 +174,11 @@ export default {
</gl-sprintf>
</template>
<
template
#summary
>
<project-pipeline-status
v-if=
"isProject"
class=
"gl-mb-6"
:pipeline=
"pipeline"
/>
<project-pipeline-status
v-if=
"shouldShowPipelineStatus"
class=
"gl-mb-6"
:pipeline=
"pipeline"
/>
<vulnerabilities-count-list
:filters=
"filters"
/>
</
template
>
<
template
#sticky
>
...
...
ee/spec/frontend/security_dashboard/components/shared/vulnerability_report_spec.js
View file @
f6753702
...
...
@@ -11,7 +11,6 @@ import AutoFixUserCallout from 'ee/security_dashboard/components/shared/auto_fix
import
CsvExportButton
from
'
ee/security_dashboard/components/shared/csv_export_button.vue
'
;
import
ReportNotConfiguredGroup
from
'
ee/security_dashboard/components/shared/empty_states/report_not_configured_group.vue
'
;
import
ReportNotConfiguredInstance
from
'
ee/security_dashboard/components/shared/empty_states/report_not_configured_instance.vue
'
;
import
ReportNotConfiguredProject
from
'
ee/security_dashboard/components/shared/empty_states/report_not_configured_project.vue
'
;
import
Filters
from
'
ee/security_dashboard/components/shared/filters/filters_layout.vue
'
;
import
ProjectPipelineStatus
from
'
ee/security_dashboard/components/shared/project_pipeline_status.vue
'
;
import
SurveyRequestBanner
from
'
ee/security_dashboard/components/shared/survey_request_banner.vue
'
;
...
...
@@ -35,7 +34,6 @@ describe('Vulnerability Report', () => {
const
findCsvExportButton
=
()
=>
wrapper
.
findComponent
(
CsvExportButton
);
const
findGroupEmptyState
=
()
=>
wrapper
.
findComponent
(
ReportNotConfiguredGroup
);
const
findInstanceEmptyState
=
()
=>
wrapper
.
findComponent
(
ReportNotConfiguredInstance
);
const
findProjectEmptyState
=
()
=>
wrapper
.
findComponent
(
ReportNotConfiguredProject
);
const
findLoadingIcon
=
()
=>
wrapper
.
findComponent
(
GlLoadingIcon
);
const
findFilters
=
()
=>
wrapper
.
findComponent
(
Filters
);
const
findVulnerabilitiesCountList
=
()
=>
wrapper
.
findComponent
(
VulnerabilitiesCountList
);
...
...
@@ -183,7 +181,6 @@ describe('Vulnerability Report', () => {
expect
(
findAlertsPortalTarget
().
exists
()).
toBe
(
false
);
expect
(
findGroupEmptyState
().
exists
()).
toBe
(
true
);
expect
(
findInstanceEmptyState
().
exists
()).
toBe
(
false
);
expect
(
findProjectEmptyState
().
exists
()).
toBe
(
false
);
expect
(
findCsvExportButton
().
exists
()).
toBe
(
false
);
expect
(
findFilters
().
exists
()).
toBe
(
false
);
expect
(
findVulnerabilitiesCountList
().
exists
()).
toBe
(
false
);
...
...
@@ -265,18 +262,23 @@ describe('Vulnerability Report', () => {
});
});
describe
(
'
when uninitialized
- project level
'
,
()
=>
{
describe
(
'
manually added vulnerabilities without a pipeline
- project level
'
,
()
=>
{
beforeEach
(()
=>
{
wrapper
=
createWrapper
({
provide
:
{
dashboardType
:
DASHBOARD_TYPES
.
PROJECT
,
pipeline
:
null
,
},
apolloProvider
:
createApolloProvider
(),
});
});
it
(
'
renders empty project state
'
,
()
=>
{
expect
(
findProjectEmptyState
().
exists
()).
toBe
(
true
);
it
(
'
renders the vulnerabilities project state
'
,
()
=>
{
expect
(
findProjectVulnerabilities
().
exists
()).
toBe
(
true
);
});
it
(
'
does not render the pipeline status
'
,
()
=>
{
expect
(
findProjectPipelineStatus
().
exists
()).
toBe
(
false
);
});
});
});
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