Commit a5ff3e26 authored by Tim Zallmann's avatar Tim Zallmann

Merge branch '213821-add-project-severity-status' into 'master'

Add vulnerable projects table

See merge request gitlab-org/gitlab!29158
parents 8456a758 8eb5f3e6
<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 GroupSecurityVulnerabilities from './first_class_group_security_dashboard_vulnerabilities.vue'; import GroupSecurityVulnerabilities from './first_class_group_security_dashboard_vulnerabilities.vue';
import VulnerabilitySeverity from './vulnerability_severity.vue';
export default { export default {
components: { components: {
SecurityDashboardLayout, SecurityDashboardLayout,
GroupSecurityVulnerabilities, GroupSecurityVulnerabilities,
VulnerabilitySeverity,
}, },
props: { props: {
dashboardDocumentation: { dashboardDocumentation: {
...@@ -20,6 +22,10 @@ export default { ...@@ -20,6 +22,10 @@ export default {
type: String, type: String,
required: true, required: true,
}, },
vulnerableProjectsEndpoint: {
type: String,
required: true,
},
}, },
}; };
</script> </script>
...@@ -31,5 +37,8 @@ export default { ...@@ -31,5 +37,8 @@ export default {
:empty-state-svg-path="emptyStateSvgPath" :empty-state-svg-path="emptyStateSvgPath"
:group-full-path="groupFullPath" :group-full-path="groupFullPath"
/> />
<template #aside>
<vulnerability-severity :endpoint="vulnerableProjectsEndpoint" />
</template>
</security-dashboard-layout> </security-dashboard-layout>
</template> </template>
...@@ -4,6 +4,10 @@ import createDefaultClient from '~/lib/graphql'; ...@@ -4,6 +4,10 @@ import createDefaultClient from '~/lib/graphql';
import { DASHBOARD_TYPES } from 'ee/security_dashboard/store/constants'; import { DASHBOARD_TYPES } from 'ee/security_dashboard/store/constants';
import FirstClassProjectSecurityDashboard from './components/first_class_project_security_dashboard.vue'; import FirstClassProjectSecurityDashboard from './components/first_class_project_security_dashboard.vue';
import FirstClassGroupSecurityDashboard from './components/first_class_group_security_dashboard.vue'; import FirstClassGroupSecurityDashboard from './components/first_class_group_security_dashboard.vue';
import createStore from './store';
import createRouter from './store/router';
import projectsPlugin from './store/plugins/projects';
import syncWithRouter from './store/plugins/sync_with_router';
const isRequired = message => { const isRequired = message => {
throw new Error(message); throw new Error(message);
...@@ -40,10 +44,16 @@ export default ( ...@@ -40,10 +44,16 @@ export default (
} else if (dashboardType === DASHBOARD_TYPES.GROUP) { } else if (dashboardType === DASHBOARD_TYPES.GROUP) {
component = FirstClassGroupSecurityDashboard; component = FirstClassGroupSecurityDashboard;
props.groupFullPath = el.dataset.groupFullPath; props.groupFullPath = el.dataset.groupFullPath;
props.vulnerableProjectsEndpoint = el.dataset.vulnerableProjectsEndpoint;
} }
const router = createRouter();
const store = createStore({ dashboardType, plugins: [projectsPlugin, syncWithRouter(router)] });
return new Vue({ return new Vue({
el, el,
store,
router,
apolloProvider, apolloProvider,
render(createElement) { render(createElement) {
return createElement(component, { props }); return createElement(component, { props });
......
...@@ -3,7 +3,7 @@ class Groups::Security::DashboardController < Groups::ApplicationController ...@@ -3,7 +3,7 @@ class Groups::Security::DashboardController < Groups::ApplicationController
layout 'group' layout 'group'
before_action only: [:show] do before_action only: [:show] do
push_frontend_feature_flag(:first_class_vulnerabilities, default: false) push_frontend_feature_flag(:first_class_vulnerabilities)
end end
def show def show
......
import { shallowMount } from '@vue/test-utils'; import { shallowMount } from '@vue/test-utils';
import SecurityDashboardLayout from 'ee/security_dashboard/components/security_dashboard_layout.vue';
import FirstClassGroupDashboard from 'ee/security_dashboard/components/first_class_group_security_dashboard.vue'; import FirstClassGroupDashboard from 'ee/security_dashboard/components/first_class_group_security_dashboard.vue';
import FirstClassGroupVulnerabilities from 'ee/security_dashboard/components/first_class_group_security_dashboard_vulnerabilities.vue'; import FirstClassGroupVulnerabilities from 'ee/security_dashboard/components/first_class_group_security_dashboard_vulnerabilities.vue';
import VulnerabilitySeverity from 'ee/security_dashboard/components/vulnerability_severity.vue';
describe('First Class Group Dashboard Component', () => { describe('First Class Group Dashboard Component', () => {
let wrapper; let wrapper;
...@@ -8,8 +10,10 @@ describe('First Class Group Dashboard Component', () => { ...@@ -8,8 +10,10 @@ describe('First Class Group Dashboard Component', () => {
const dashboardDocumentation = 'dashboard-documentation'; const dashboardDocumentation = 'dashboard-documentation';
const emptyStateSvgPath = 'empty-state-path'; const emptyStateSvgPath = 'empty-state-path';
const groupFullPath = 'group-full-path'; const groupFullPath = 'group-full-path';
const vulnerableProjectsEndpoint = '/vulnerable/projects';
const findGroupVulnerabilities = () => wrapper.find(FirstClassGroupVulnerabilities); const findGroupVulnerabilities = () => wrapper.find(FirstClassGroupVulnerabilities);
const findVulnerabilitySeverity = () => wrapper.find(VulnerabilitySeverity);
const createWrapper = () => { const createWrapper = () => {
return shallowMount(FirstClassGroupDashboard, { return shallowMount(FirstClassGroupDashboard, {
...@@ -17,6 +21,10 @@ describe('First Class Group Dashboard Component', () => { ...@@ -17,6 +21,10 @@ describe('First Class Group Dashboard Component', () => {
dashboardDocumentation, dashboardDocumentation,
emptyStateSvgPath, emptyStateSvgPath,
groupFullPath, groupFullPath,
vulnerableProjectsEndpoint,
},
stubs: {
SecurityDashboardLayout,
}, },
}); });
}; };
...@@ -36,4 +44,8 @@ describe('First Class Group Dashboard Component', () => { ...@@ -36,4 +44,8 @@ describe('First Class Group Dashboard Component', () => {
groupFullPath, groupFullPath,
}); });
}); });
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