|
| 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 | +}); |
0 commit comments