Commit fc4091a5 authored by Phil Hughes's avatar Phil Hughes

Merge branch '207373-add-vulnerable-projects-to-instance-level' into 'master'

Add Project Security Status Table to Instance Level

See merge request gitlab-org/gitlab!29324
parents 43bd9335 a767966d
<script> <script>
import SecurityDashboardLayout from 'ee/security_dashboard/components/security_dashboard_layout.vue'; import SecurityDashboardLayout from 'ee/security_dashboard/components/security_dashboard_layout.vue';
import InstanceSecurityVulnerabilities from './first_class_instance_security_dashboard_vulnerabilities.vue'; import InstanceSecurityVulnerabilities from './first_class_instance_security_dashboard_vulnerabilities.vue';
import VulnerabilitySeverity from 'ee/security_dashboard/components/vulnerability_severity.vue';
export default { export default {
components: { components: {
SecurityDashboardLayout, SecurityDashboardLayout,
InstanceSecurityVulnerabilities, InstanceSecurityVulnerabilities,
VulnerabilitySeverity,
}, },
props: { props: {
dashboardDocumentation: { dashboardDocumentation: {
...@@ -16,6 +18,10 @@ export default { ...@@ -16,6 +18,10 @@ export default {
type: String, type: String,
required: true, required: true,
}, },
vulnerableProjectsEndpoint: {
type: String,
required: true,
},
}, },
}; };
</script> </script>
...@@ -26,5 +32,8 @@ export default { ...@@ -26,5 +32,8 @@ export default {
:dashboard-documentation="dashboardDocumentation" :dashboard-documentation="dashboardDocumentation"
:empty-state-svg-path="emptyStateSvgPath" :empty-state-svg-path="emptyStateSvgPath"
/> />
<template #aside>
<vulnerability-severity :endpoint="vulnerableProjectsEndpoint" />
</template>
</security-dashboard-layout> </security-dashboard-layout>
</template> </template>
...@@ -49,6 +49,7 @@ export default ( ...@@ -49,6 +49,7 @@ export default (
props.vulnerableProjectsEndpoint = el.dataset.vulnerableProjectsEndpoint; props.vulnerableProjectsEndpoint = el.dataset.vulnerableProjectsEndpoint;
} else if (dashboardType === DASHBOARD_TYPES.INSTANCE) { } else if (dashboardType === DASHBOARD_TYPES.INSTANCE) {
component = FirstClassInstanceSecurityDashboard; component = FirstClassInstanceSecurityDashboard;
props.vulnerableProjectsEndpoint = el.dataset.vulnerableProjectsEndpoint;
} }
const router = createRouter(); const router = createRouter();
......
import { shallowMount } from '@vue/test-utils'; import { shallowMount } from '@vue/test-utils';
import SecurityDashboardLayout from 'ee/security_dashboard/components/security_dashboard_layout.vue';
import FirstClassInstanceDashboard from 'ee/security_dashboard/components/first_class_instance_security_dashboard.vue'; import FirstClassInstanceDashboard from 'ee/security_dashboard/components/first_class_instance_security_dashboard.vue';
import FirstClassInstanceVulnerabilities from 'ee/security_dashboard/components/first_class_instance_security_dashboard_vulnerabilities.vue'; import FirstClassInstanceVulnerabilities from 'ee/security_dashboard/components/first_class_instance_security_dashboard_vulnerabilities.vue';
import VulnerabilitySeverity from 'ee/security_dashboard/components/vulnerability_severity.vue';
describe('First Class Group Dashboard Component', () => { describe('First Class Instance Dashboard Component', () => {
let wrapper; let wrapper;
const dashboardDocumentation = 'dashboard-documentation'; const dashboardDocumentation = 'dashboard-documentation';
const emptyStateSvgPath = 'empty-state-path'; const emptyStateSvgPath = 'empty-state-path';
const vulnerableProjectsEndpoint = '/vulnerable/projects';
const findGroupVulnerabilities = () => wrapper.find(FirstClassInstanceVulnerabilities); const findInstanceVulnerabilities = () => wrapper.find(FirstClassInstanceVulnerabilities);
const findVulnerabilitySeverity = () => wrapper.find(VulnerabilitySeverity);
const createWrapper = () => { const createWrapper = () => {
return shallowMount(FirstClassInstanceDashboard, { return shallowMount(FirstClassInstanceDashboard, {
propsData: { propsData: {
dashboardDocumentation, dashboardDocumentation,
emptyStateSvgPath, emptyStateSvgPath,
vulnerableProjectsEndpoint,
},
stubs: {
SecurityDashboardLayout,
}, },
}); });
}; };
...@@ -28,9 +36,13 @@ describe('First Class Group Dashboard Component', () => { ...@@ -28,9 +36,13 @@ describe('First Class Group Dashboard Component', () => {
}); });
it('should render correctly', () => { it('should render correctly', () => {
expect(findGroupVulnerabilities().props()).toEqual({ expect(findInstanceVulnerabilities().props()).toEqual({
dashboardDocumentation, dashboardDocumentation,
emptyStateSvgPath, emptyStateSvgPath,
}); });
}); });
it('displays the vulnerability severity in an aside', () => {
expect(findVulnerabilitySeverity().exists()).toBe(true);
});
}); });
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment