1
1
import React from "react" ;
2
2
3
- import {
4
- Button ,
5
- ButtonVariant ,
6
- TextContent ,
7
- Title ,
8
- Toolbar ,
9
- ToolbarContent ,
10
- ToolbarItem ,
11
- } from "@patternfly/react-core" ;
12
- import spacing from "@patternfly/react-styles/css/utilities/Spacing/spacing" ;
3
+ import { Toolbar , ToolbarContent , ToolbarItem } from "@patternfly/react-core" ;
13
4
import {
14
5
Table ,
15
6
TableProps ,
@@ -19,10 +10,9 @@ import {
19
10
Thead ,
20
11
Tr ,
21
12
} from "@patternfly/react-table" ;
13
+ import { Link } from "react-router-dom" ;
22
14
23
- import { AdvisoryInDrawerInfo } from "@app/components/AdvisoryInDrawerInfo" ;
24
15
import { FilterToolbar } from "@app/components/FilterToolbar" ;
25
- import { PageDrawerContent } from "@app/components/PageDrawerContext" ;
26
16
import { SeverityShieldAndText } from "@app/components/SeverityShieldAndText" ;
27
17
import { SimplePagination } from "@app/components/SimplePagination" ;
28
18
import {
@@ -31,40 +21,28 @@ import {
31
21
} from "@app/components/TableControls" ;
32
22
import { useLocalTableControls } from "@app/hooks/table-controls" ;
33
23
import { formatDate } from "@app/utils/utils" ;
34
- import { VulnerabilityAdvisoryHead } from "@app/client" ;
24
+ import { VulnerabilityAdvisorySummary } from "@app/client" ;
35
25
36
26
interface AdvisoriesByVulnerabilityProps {
37
27
variant ?: TableProps [ "variant" ] ;
38
- advisories : VulnerabilityAdvisoryHead [ ] ;
28
+ advisories : VulnerabilityAdvisorySummary [ ] ;
39
29
}
40
30
41
31
export const AdvisoriesByVulnerability : React . FC <
42
32
AdvisoriesByVulnerabilityProps
43
33
> = ( { variant, advisories } ) => {
44
- type RowAction = "showAdvisory" ;
45
- const [ selectedRowAction , setSelectedRowAction ] =
46
- React . useState < RowAction | null > ( null ) ;
47
- const [ selectedRow , setSelectedRow ] =
48
- React . useState < VulnerabilityAdvisoryHead | null > ( null ) ;
49
-
50
- const showDrawer = ( action : RowAction , row : VulnerabilityAdvisoryHead ) => {
51
- setSelectedRowAction ( action ) ;
52
- setSelectedRow ( row ) ;
53
- } ;
54
-
55
- //
56
34
const tableControls = useLocalTableControls ( {
57
35
variant : variant ,
58
36
tableName : "advisory-table" ,
59
37
idProperty : "uuid" ,
60
38
items : advisories ,
61
39
isLoading : false ,
62
40
columnNames : {
63
- identifier : "Name " ,
64
- title : "Description " ,
65
- severity : "CVSS " ,
66
- published : "Published " ,
67
- modified : "Modified " ,
41
+ identifier : "ID " ,
42
+ title : "Title " ,
43
+ severity : "Aggregated Severity " ,
44
+ revision : "Revision " ,
45
+ vulnerabilities : "Vulnerabilities " ,
68
46
} ,
69
47
hasActionsColumn : false ,
70
48
isSortEnabled : false ,
@@ -111,8 +89,8 @@ export const AdvisoriesByVulnerability: React.FC<
111
89
< Th { ...getThProps ( { columnKey : "identifier" } ) } />
112
90
< Th { ...getThProps ( { columnKey : "title" } ) } />
113
91
< Th { ...getThProps ( { columnKey : "severity" } ) } />
114
- < Th { ...getThProps ( { columnKey : "published " } ) } />
115
- < Th { ...getThProps ( { columnKey : "modified " } ) } />
92
+ < Th { ...getThProps ( { columnKey : "revision " } ) } />
93
+ < Th { ...getThProps ( { columnKey : "vulnerabilities " } ) } />
116
94
</ TableHeaderContentWithControls >
117
95
</ Tr >
118
96
</ Thead >
@@ -127,13 +105,7 @@ export const AdvisoriesByVulnerability: React.FC<
127
105
return (
128
106
< Tr key = { item . identifier } { ...getTrProps ( { item } ) } >
129
107
< Td width = { 15 } { ...getTdProps ( { columnKey : "identifier" } ) } >
130
- < Button
131
- size = "sm"
132
- variant = { ButtonVariant . secondary }
133
- onClick = { ( ) => showDrawer ( "showAdvisory" , item ) }
134
- >
135
- { item . identifier }
136
- </ Button >
108
+ < Link to = { `/advisory/${ item . uuid } ` } > { item . identifier } </ Link >
137
109
</ Td >
138
110
< Td
139
111
width = { 50 }
@@ -142,28 +114,24 @@ export const AdvisoriesByVulnerability: React.FC<
142
114
>
143
115
{ item . title }
144
116
</ Td >
145
- < Td
146
- width = { 10 }
147
- modifier = "truncate"
148
- { ...getTdProps ( { columnKey : "severity" } ) }
149
- >
117
+ < Td width = { 10 } { ...getTdProps ( { columnKey : "severity" } ) } >
150
118
{ item . severity && (
151
119
< SeverityShieldAndText value = { item . severity } />
152
120
) }
153
121
</ Td >
154
122
< Td
155
123
width = { 10 }
156
124
modifier = "truncate"
157
- { ...getTdProps ( { columnKey : "published " } ) }
125
+ { ...getTdProps ( { columnKey : "revision " } ) }
158
126
>
159
- { formatDate ( item . published ) }
127
+ { formatDate ( item . modified ) }
160
128
</ Td >
161
129
< Td
162
130
width = { 10 }
163
131
modifier = "truncate"
164
- { ...getTdProps ( { columnKey : "modified " } ) }
132
+ { ...getTdProps ( { columnKey : "vulnerabilities " } ) }
165
133
>
166
- { formatDate ( item . modified ) }
134
+ { item . number_of_vulnerabilities }
167
135
</ Td >
168
136
</ Tr >
169
137
) ;
@@ -177,32 +145,6 @@ export const AdvisoriesByVulnerability: React.FC<
177
145
isCompact
178
146
paginationProps = { paginationProps }
179
147
/>
180
-
181
- < PageDrawerContent
182
- isExpanded = { selectedRowAction !== null }
183
- onCloseClick = { ( ) => setSelectedRowAction ( null ) }
184
- pageKey = "drawer"
185
- drawerPanelContentProps = { { defaultSize : "600px" } }
186
- header = {
187
- < >
188
- { selectedRowAction === "showAdvisory" && (
189
- < TextContent >
190
- < Title headingLevel = "h2" size = "lg" className = { spacing . mtXs } >
191
- Advisory
192
- </ Title >
193
- </ TextContent >
194
- ) }
195
- </ >
196
- }
197
- >
198
- { selectedRowAction === "showAdvisory" && (
199
- < >
200
- { selectedRow && (
201
- < AdvisoryInDrawerInfo advisoryId = { selectedRow ?. uuid } />
202
- ) }
203
- </ >
204
- ) }
205
- </ PageDrawerContent >
206
148
</ >
207
149
) ;
208
150
} ;
0 commit comments