@@ -107,33 +107,17 @@ const OsExposureReportModal = ({
107
107
108
108
const CVE_REPORT_FILTERS = getCveReportFilters ( false , true ) ;
109
109
110
+ console . log ( '>>>' , selectedOsVersions ) ;
111
+
110
112
const selectedTotal = useMemo ( ( ) => {
111
- /**
112
- * Counts the total number of OS item objects in the provided data structure.
113
- *
114
- * @param {Array<Object> } selectedOsVersions - An array of dictionaries, where each dictionary
115
- * contains a key (e.g., "RHEL 8") and a value
116
- * that is an array of OS item objects.
117
- * @returns {number } An integer representing the total count of OS item objects.
118
- */
119
-
120
- // Initialize total_count to 0. This variable will store the cumulative count.
121
113
let totalCount = 0 ;
122
114
123
- // Iterate through each category object in the main dataStructure array.
124
- // For example, the first category object is { "RHEL 8": [...] }
125
115
for ( const categoryObject of selectedOsVersions ) {
126
- // For each categoryObject, iterate through its keys.
127
- // For example, the key would be "RHEL 8" or "RHEL 7".
128
116
for ( const key in categoryObject ) {
129
- // Ensure that the key belongs to the object itself and not its prototype.
130
117
if ( Object . prototype . hasOwnProperty . call ( categoryObject , key ) ) {
131
- // Get the array of OS items associated with the current key.
132
118
const osItemsArray = categoryObject [ key ] ;
133
119
134
- // Check if osItemsArray is actually an array before trying to get its length.
135
120
if ( Array . isArray ( osItemsArray ) ) {
136
- // Add the number of items in the current osItemsArray to the totalCount.
137
121
totalCount += osItemsArray . length ;
138
122
} else {
139
123
console . warn ( `Expected an array for key "${ key } ", but found:` , osItemsArray ) ;
@@ -142,7 +126,6 @@ const OsExposureReportModal = ({
142
126
}
143
127
}
144
128
145
- // Return the final total count.
146
129
return totalCount ;
147
130
} , [ selectedOsVersions ] ) ;
148
131
@@ -308,47 +291,39 @@ const OsExposureReportModal = ({
308
291
< Flex >
309
292
{ selectedOsVersions . length === 0
310
293
? < Text style = { { color : '#6a6e73' } } >
311
- Select at least 1 minor version of RHEL to further select the desired life cycle.
294
+ Select at least 1 minor version of RHEL to further select the desired life cycle.
312
295
</ Text >
313
- : exposureMap . map (
314
- ( majorVersionEntry , majorIndex ) => {
315
- return (
316
- Object . entries ( majorVersionEntry ) . map (
317
- ( [ majorVersion , minorValues ] ) => {
318
- return (
319
- minorValues . map ( ( {
320
- isSelected,
321
- os,
322
- osMinorVersion,
323
- lifecycles,
324
- selectedLifecycle
325
- } , minorIndex ) => {
326
- if ( isSelected ) {
327
- return (
328
- < FlexItem key = { `lifecycle-select-${ os } ` } >
329
- < LifecycleSelect
330
- isFetchLoading = { isFetchLoading }
331
- lifecycles = { lifecycles }
332
- osVersion = { os }
333
- selectedLifecycle = { selectedLifecycle }
334
- setSelectedLifecycle = { ( value ) => setSelectedLifecycle (
335
- majorVersion ,
336
- majorIndex ,
337
- osMinorVersion ,
338
- minorIndex ,
339
- value
340
- ) }
341
- />
342
- </ FlexItem >
343
- ) ;
344
- }
345
- } )
346
- ) ;
347
- }
348
- )
349
- ) ;
350
- }
351
- )
296
+ : exposureMap . map ( ( majorVersionEntry , majorIndex ) => {
297
+ Object . entries ( majorVersionEntry ) . map ( ( [ majorVersion , minorValues ] ) =>
298
+ minorValues . map ( ( {
299
+ isSelected,
300
+ os,
301
+ osMinorVersion,
302
+ lifecycles,
303
+ selectedLifecycle
304
+ } , minorIndex ) => {
305
+ if ( isSelected ) {
306
+ return (
307
+ < FlexItem key = { `lifecycle-select-${ os } ` } >
308
+ < LifecycleSelect
309
+ isFetchLoading = { isFetchLoading }
310
+ lifecycles = { lifecycles }
311
+ osVersion = { os }
312
+ selectedLifecycle = { selectedLifecycle }
313
+ setSelectedLifecycle = { ( value ) => setSelectedLifecycle (
314
+ majorVersion ,
315
+ majorIndex ,
316
+ osMinorVersion ,
317
+ minorIndex ,
318
+ value
319
+ ) }
320
+ />
321
+ </ FlexItem >
322
+ ) ;
323
+ }
324
+ } )
325
+ ) ;
326
+ } )
352
327
}
353
328
</ Flex >
354
329
</ FormGroup >
0 commit comments