Skip to content

Commit 48a26f3

Browse files
authored
Vulnerability dashboard: Add new homepage (#35253)
Related to: #33661 Changes: - Updated the homepage of the vulnerability dashboard to be a new dashboard page. - Updated the `Vulnerability` model to make cveID a unique value.
1 parent 3772ccf commit 48a26f3

File tree

9 files changed

+2113
-3
lines changed

9 files changed

+2113
-3
lines changed

ee/vulnerability-dashboard/api/controllers/view-dashboard.js

Lines changed: 1476 additions & 0 deletions
Large diffs are not rendered by default.

ee/vulnerability-dashboard/api/models/VulnerabilityInstall.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ module.exports = {
1515
installedAt: {
1616
example: 1670152500000,
1717
description: 'JS timestamp representing when this installation began on the host.',
18+
extendedDescription: 'This JS timestamp represents when the vulnerabiltiy dashboard first saw this vulnerable software on a host',
1819
type: 'number',
1920
isInteger: true,
2021
required: true,
Lines changed: 156 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
parasails.registerPage('dashboard', {
2+
// ╦╔╗╔╦╔╦╗╦╔═╗╦ ╔═╗╔╦╗╔═╗╔╦╗╔═╗
3+
// ║║║║║ ║ ║╠═╣║ ╚═╗ ║ ╠═╣ ║ ║╣
4+
// ╩╝╚╝╩ ╩ ╩╩ ╩╩═╝ ╚═╝ ╩ ╩ ╩ ╩ ╚═╝
5+
data: {
6+
//…
7+
},
8+
9+
// ╦ ╦╔═╗╔═╗╔═╗╦ ╦╔═╗╦ ╔═╗
10+
// ║ ║╠╣ ║╣ ║ ╚╦╝║ ║ ║╣
11+
// ╩═╝╩╚ ╚═╝╚═╝ ╩ ╚═╝╩═╝╚═╝
12+
beforeMount: function() {
13+
//…
14+
},
15+
mounted: async function() {
16+
Chart.defaults.color = '#d4d4d8';
17+
Chart.defaults.borderColor = '#21262d';
18+
new Chart(document.getElementById('severityChart'), {
19+
type: 'doughnut',
20+
data: {
21+
labels: ['Critical', 'High', 'Medium', 'Low'],
22+
datasets: [{
23+
data: [this.totalUniqueCounts.critical, this.totalUniqueCounts.high, this.totalUniqueCounts.medium, this.totalUniqueCounts.low],
24+
backgroundColor: ['#dc2626', '#ea580c', '#ca8a04', '#16a34a'],
25+
borderWidth: 2,
26+
borderColor: '#010409'
27+
}]
28+
},
29+
options: {
30+
responsive: true,
31+
maintainAspectRatio: false,
32+
plugins: {
33+
legend: {
34+
position: 'bottom',
35+
labels: {
36+
padding: 20,
37+
usePointStyle: true,
38+
color: '#d4d4d8'
39+
}
40+
}
41+
}
42+
}
43+
});
44+
new Chart(document.getElementById('trendsChart'), {
45+
type: 'line',
46+
data: {
47+
// labels: ['Week 1', 'Week 2', 'Week 3', 'Week 4'],
48+
labels: _.pluck(this.activityTrendsTimeline, 'timelineLabel'),
49+
datasets: [{
50+
label: 'New CVEs',
51+
data: _.pluck(this.activityTrendsTimeline, 'newCves'),
52+
borderColor: '#dc2626',
53+
backgroundColor: 'rgba(220, 38, 38, 0.1)',
54+
tension: 0.4,
55+
borderWidth: 2,
56+
pointBackgroundColor: '#dc2626',
57+
pointBorderColor: '#ffffff',
58+
pointBorderWidth: 2,
59+
pointRadius: 5
60+
}, {
61+
label: 'Remediated CVEs',
62+
data: _.pluck(this.activityTrendsTimeline, 'remediatedCves'),
63+
borderColor: '#16a34a',
64+
backgroundColor: 'rgba(22, 163, 74, 0.1)',
65+
tension: 0.4,
66+
borderWidth: 2,
67+
pointBackgroundColor: '#16a34a',
68+
pointBorderColor: '#ffffff',
69+
pointBorderWidth: 2,
70+
pointRadius: 5
71+
}]
72+
},
73+
options: {
74+
responsive: true,
75+
maintainAspectRatio: false,
76+
scales: {
77+
y: {
78+
beginAtZero: true,
79+
grid: { color: '#21262d' },
80+
ticks: { color: '#7d8590' }
81+
},
82+
x: {
83+
grid: { color: '#21262d' },
84+
ticks: { color: '#7d8590' }
85+
}
86+
},
87+
plugins: {
88+
legend: {
89+
labels: {
90+
color: '#d4d4d8',
91+
usePointStyle: true,
92+
padding: 20
93+
}
94+
}
95+
}
96+
}
97+
});
98+
99+
new Chart(document.getElementById('totalTrendChart'), {
100+
type: 'line',
101+
data: {
102+
labels: _.pluck(this.activityTrendsTimeline, 'timelineLabel'),
103+
datasets: [{
104+
label: 'Total CVEs',
105+
data: _.pluck(this.activityTrendsTimeline, 'totalNumberOfCves'),
106+
borderColor: '#8b5cf6',
107+
backgroundColor: 'rgba(139, 92, 246, 0.1)',
108+
tension: 0.4,
109+
borderWidth: 3,
110+
pointBackgroundColor: '#8b5cf6',
111+
pointBorderColor: '#ffffff',
112+
pointBorderWidth: 2,
113+
pointRadius: 6,
114+
fill: true
115+
}]
116+
},
117+
options: {
118+
responsive: true,
119+
maintainAspectRatio: false,
120+
scales: {
121+
y: {
122+
beginAtZero: false,
123+
min: 25000,
124+
grid: { color: '#21262d' },
125+
ticks: {
126+
color: '#7d8590',
127+
callback: function(value) {
128+
return (value / 1000).toFixed(1) + 'k';
129+
}
130+
}
131+
},
132+
x: {
133+
grid: { color: '#21262d' },
134+
ticks: { color: '#7d8590' }
135+
}
136+
},
137+
plugins: {
138+
legend: {
139+
labels: {
140+
color: '#d4d4d8',
141+
usePointStyle: true,
142+
padding: 20
143+
}
144+
}
145+
}
146+
}
147+
});
148+
},
149+
150+
// ╦╔╗╔╔╦╗╔═╗╦═╗╔═╗╔═╗╔╦╗╦╔═╗╔╗╔╔═╗
151+
// ║║║║ ║ ║╣ ╠╦╝╠═╣║ ║ ║║ ║║║║╚═╗
152+
// ╩╝╚╝ ╩ ╚═╝╩╚═╩ ╩╚═╝ ╩ ╩╚═╝╝╚╝╚═╝
153+
methods: {
154+
//…
155+
}
156+
});

ee/vulnerability-dashboard/assets/styles/importer.less

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,4 @@
4444
@import 'pages/500.less';
4545
@import 'pages/498.less';
4646
@import 'pages/patch-progress.less';
47+
@import 'pages/dashboard.less';

ee/vulnerability-dashboard/assets/styles/layout.less

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,11 @@ html, body {
4040
// ^^The above is to disable "importantRule" and "duplicateProperty" rules.
4141
min-height: 100%;
4242
position: relative;
43+
4344
padding-bottom: @footer-height;
45+
&.header-hidden {
46+
padding-bottom: 0px;
47+
}
4448
background-color: #f8f9fa;
4549
color: #292b2d;
4650
a {

0 commit comments

Comments
 (0)