@@ -4,7 +4,15 @@ import { Link } from "react-router-dom";
4
4
import dayjs from "dayjs" ;
5
5
6
6
import { Toolbar , ToolbarContent , ToolbarItem } from "@patternfly/react-core" ;
7
- import { Table , Tbody , Td , Th , Thead , Tr } from "@patternfly/react-table" ;
7
+ import {
8
+ ExpandableRowContent ,
9
+ Table ,
10
+ Tbody ,
11
+ Td ,
12
+ Th ,
13
+ Thead ,
14
+ Tr ,
15
+ } from "@patternfly/react-table" ;
8
16
9
17
import { FilterType } from "@app/components/FilterToolbar" ;
10
18
import { SimplePagination } from "@app/components/SimplePagination" ;
@@ -17,7 +25,8 @@ import { VulnerabilityStatusLabel } from "@app/components/VulnerabilityStatusLab
17
25
import { useSbomsOfVulnerability } from "@app/hooks/domain-controls/useSbomsOfVulnerability" ;
18
26
import { useLocalTableControls } from "@app/hooks/table-controls" ;
19
27
import { useWithUiId } from "@app/utils/query-utils" ;
20
- import { formatDate } from "@app/utils/utils" ;
28
+ import { decomposePurl , formatDate } from "@app/utils/utils" ;
29
+ import { PackageQualifiers } from "@app/components/PackageQualifiers" ;
21
30
22
31
interface SbomsByVulnerabilityProps {
23
32
vulnerabilityId : string ;
@@ -41,7 +50,7 @@ export const SbomsByVulnerability: React.FC<SbomsByVulnerabilityProps> = ({
41
50
tableName : "sboms-table" ,
42
51
idProperty : "_ui_unique_id" ,
43
52
items : tableDataWithUiId ,
44
- isLoading : false ,
53
+ isLoading : isFetching ,
45
54
columnNames : {
46
55
name : "Name" ,
47
56
version : "Version" ,
@@ -69,7 +78,8 @@ export const SbomsByVulnerability: React.FC<SbomsByVulnerabilityProps> = ({
69
78
getItemValue : ( item ) => item . sbom ?. name ?? "" ,
70
79
} ,
71
80
] ,
72
- isExpansionEnabled : false ,
81
+ isExpansionEnabled : true ,
82
+ expandableVariant : "compound" ,
73
83
} ) ;
74
84
75
85
const {
@@ -84,6 +94,7 @@ export const SbomsByVulnerability: React.FC<SbomsByVulnerabilityProps> = ({
84
94
getThProps,
85
95
getTrProps,
86
96
getTdProps,
97
+ getExpandedContentTdProps,
87
98
} ,
88
99
expansionDerivedState : { isCellExpanded } ,
89
100
} = tableControls ;
@@ -149,9 +160,14 @@ export const SbomsByVulnerability: React.FC<SbomsByVulnerabilityProps> = ({
149
160
</ Td >
150
161
< Td
151
162
width = { 10 }
152
- { ...getTdProps ( { columnKey : "dependencies" } ) }
163
+ { ...getTdProps ( {
164
+ columnKey : "dependencies" ,
165
+ isCompoundExpandToggle : true ,
166
+ item : item ,
167
+ rowIndex,
168
+ } ) }
153
169
>
154
- { item ?. sbom ?. number_of_packages }
170
+ { item . relatedPackages . length }
155
171
</ Td >
156
172
< Td width = { 10 } { ...getTdProps ( { columnKey : "supplier" } ) } >
157
173
{ item ?. sbom ?. authors . join ( ", " ) }
@@ -165,6 +181,63 @@ export const SbomsByVulnerability: React.FC<SbomsByVulnerabilityProps> = ({
165
181
</ Td >
166
182
</ TableRowContentWithControls >
167
183
</ Tr >
184
+ { isCellExpanded ( item ) ? (
185
+ < Tr isExpanded >
186
+ < Td
187
+ { ...getExpandedContentTdProps ( {
188
+ item,
189
+ } ) }
190
+ >
191
+ < ExpandableRowContent >
192
+ { isCellExpanded ( item , "dependencies" ) ? (
193
+ < >
194
+ < Table variant = "compact" >
195
+ < Thead >
196
+ < Tr >
197
+ < Th > Type</ Th >
198
+ < Th > Namespace</ Th >
199
+ < Th > Name</ Th >
200
+ < Th > Version</ Th >
201
+ < Th > Path</ Th >
202
+ < Th > Qualifiers</ Th >
203
+ </ Tr >
204
+ </ Thead >
205
+ < Tbody >
206
+ { item . relatedPackages
207
+ . flatMap ( ( item ) => item . packages )
208
+ . map ( ( purl , index ) => {
209
+ const decomposedPurl = decomposePurl (
210
+ purl . purl
211
+ ) ;
212
+ return (
213
+ < Tr key = { `${ index } -purl` } >
214
+ < Td > { decomposedPurl ?. type } </ Td >
215
+ < Td > { decomposedPurl ?. namespace } </ Td >
216
+ < Td >
217
+ < Link to = { `/packages/${ purl . uuid } ` } >
218
+ { decomposedPurl ?. name }
219
+ </ Link >
220
+ </ Td >
221
+ < Td > { decomposedPurl ?. version } </ Td >
222
+ < Td > { decomposedPurl ?. path } </ Td >
223
+ < Td >
224
+ { decomposedPurl ?. qualifiers && (
225
+ < PackageQualifiers
226
+ value = { decomposedPurl ?. qualifiers }
227
+ />
228
+ ) }
229
+ </ Td >
230
+ </ Tr >
231
+ ) ;
232
+ } ) }
233
+ </ Tbody >
234
+ </ Table >
235
+ </ >
236
+ ) : null }
237
+ </ ExpandableRowContent >
238
+ </ Td >
239
+ </ Tr >
240
+ ) : null }
168
241
</ Tbody >
169
242
) ;
170
243
} ) }
0 commit comments