@@ -2,7 +2,6 @@ import React from "react";
2
2
3
3
import prettyBytes from "pretty-bytes" ;
4
4
5
- import { ChartDonut } from "@patternfly/react-charts" ;
6
5
import {
7
6
Card ,
8
7
CardBody ,
@@ -15,7 +14,6 @@ import {
15
14
GridItem ,
16
15
} from "@patternfly/react-core" ;
17
16
18
- import { compareBySeverityFn , severityList } from "@app/api/model-utils" ;
19
17
import { AdvisorySummary , Severity } from "@app/client" ;
20
18
import { SeverityShieldAndText } from "@app/components/SeverityShieldAndText" ;
21
19
import { formatDate } from "@app/utils/utils" ;
@@ -115,77 +113,3 @@ export const Overview: React.FC<InfoProps> = ({ advisory }) => {
115
113
</ Grid >
116
114
) ;
117
115
} ;
118
-
119
- //
120
-
121
- interface ChartData {
122
- severity : Severity ;
123
- legend : string ;
124
- count : number ;
125
- color : string ;
126
- }
127
-
128
- interface CVEsChartProps {
129
- data : { [ key in Severity ] : number } ;
130
- }
131
-
132
- export const CVEsChart : React . FC < CVEsChartProps > = ( { data } ) => {
133
- const enrichedData = Object . entries ( data )
134
- . map ( ( [ severity , count ] ) => {
135
- const severityProps = severityList [ severity as Severity ] ;
136
-
137
- const result : ChartData = {
138
- severity : severity as Severity ,
139
- legend : severityProps . name ,
140
- color : severityProps . color . value ,
141
- count : count ,
142
- } ;
143
-
144
- return result ;
145
- } )
146
- . sort ( compareBySeverityFn ( ( item ) => item . severity ) ) ;
147
-
148
- const chartData = enrichedData . map ( ( e ) => {
149
- return {
150
- x : e . legend ,
151
- y : e . count ,
152
- } ;
153
- } ) ;
154
-
155
- const chartLegendData = enrichedData . map ( ( e ) => ( {
156
- name : `${ e . count } ${ e . legend } ` ,
157
- } ) ) ;
158
-
159
- const chartColorData = enrichedData . map ( ( e ) => e . color ) ;
160
-
161
- return (
162
- < >
163
- < div style = { { height : "230px" , width : "350px" } } >
164
- < ChartDonut
165
- ariaDesc = "CVEs"
166
- ariaTitle = "CVEs"
167
- constrainToVisibleArea
168
- data = { chartData }
169
- labels = { ( { datum } ) => `${ datum . x } : ${ datum . y } ` }
170
- legendData = { chartLegendData }
171
- colorScale = { chartColorData }
172
- legendOrientation = "vertical"
173
- legendPosition = "right"
174
- name = "CVEs"
175
- padding = { {
176
- bottom : 20 ,
177
- left : 20 ,
178
- right : 140 , // Adjusted to accommodate legend
179
- top : 20 ,
180
- } }
181
- subTitle = "CVEs"
182
- title = { enrichedData
183
- . map ( ( e ) => e . count )
184
- . reduce ( ( prev , current ) => prev + current , 0 )
185
- . toString ( ) }
186
- width = { 350 }
187
- />
188
- </ div >
189
- </ >
190
- ) ;
191
- } ;
0 commit comments