File tree Expand file tree Collapse file tree 2 files changed +52
-0
lines changed
SmartComponents/AffectedSystems Expand file tree Collapse file tree 2 files changed +52
-0
lines changed Original file line number Diff line number Diff line change @@ -91,6 +91,39 @@ const AffectedSystems = ({ advisoryName }) => {
91
91
setRemediationModalCmp ( ( ) => ( ) => < RemediationModal data = { data } /> ) ;
92
92
} ;
93
93
94
+ const onSelect = React . useCallback ( ( event ) => {
95
+ const toSelect = [ ] ;
96
+ switch ( event ) {
97
+ case 'none' : {
98
+ Object . keys ( selectedRows ) . forEach ( id => {
99
+ toSelect . push (
100
+ {
101
+ id,
102
+ selected : false
103
+ }
104
+ ) ;
105
+ } ) ;
106
+ break ;
107
+ }
108
+
109
+ case 'page' : {
110
+ rawAffectedSystems . forEach ( ( { id } ) => {
111
+ toSelect . push (
112
+ {
113
+ id,
114
+ selected : true
115
+ }
116
+ ) ; } ) ;
117
+ break ;
118
+ } }
119
+
120
+ dispatch (
121
+ { type : 'SELECT_ENTITY' , payload : toSelect }
122
+ ) ; }
123
+ ) ;
124
+
125
+ const selectedCount = selectedRows && arrayFromObj ( selectedRows ) . length ;
126
+
94
127
return (
95
128
< React . Fragment >
96
129
{ status === STATUS_REJECTED ? < Error message = { error . detail } /> : InventoryCmp && (
@@ -101,6 +134,24 @@ const AffectedSystems = ({ advisoryName }) => {
101
134
perPage = { perPage }
102
135
onRefresh = { handleRefresh }
103
136
actions = { systemsRowActions ( showRemediationModal ) }
137
+ bulkSelect = { onSelect && {
138
+ count : selectedCount ,
139
+ items : [ {
140
+ title : `Select none (0)` ,
141
+ onClick : ( ) => {
142
+ onSelect ( 'none' ) ;
143
+ }
144
+ } , {
145
+ title : `Select page (${ perPage } )` ,
146
+ onClick : ( ) => {
147
+ onSelect ( 'page' ) ;
148
+ }
149
+ } ] ,
150
+ onSelect : ( value ) => {
151
+ value ? onSelect ( 'page' ) : onSelect ( 'none' ) ;
152
+ } ,
153
+ checked : Boolean ( selectedCount )
154
+ } }
104
155
>
105
156
< reactCore . ToolbarGroup >
106
157
< reactCore . ToolbarItem >
Original file line number Diff line number Diff line change @@ -128,6 +128,7 @@ export const createSystemAdvisoriesRows = (
128
128
} ;
129
129
130
130
export const createSystemsRows = ( rows , selectedRows = { } ) => {
131
+ console . log ( selectedRows ) ;
131
132
const data =
132
133
rows &&
133
134
rows . map ( row => {
You can’t perform that action at this time.
0 commit comments