File tree Expand file tree Collapse file tree 1 file changed +30
-6
lines changed
pkg/sbombastic-image-vulnerability-scanner/models Expand file tree Collapse file tree 1 file changed +30
-6
lines changed Original file line number Diff line number Diff line change @@ -69,9 +69,21 @@ export default class SbombasticRancherIoVexhub extends SteveModel {
69
69
icon : 'icon-pause' ,
70
70
enabled : true ,
71
71
bulkable : true ,
72
- invoke : async ( ) => {
73
- this . spec = { ...( this . spec || { } ) , enabled : false } ;
74
- await this . save ( ) ;
72
+ invoke : async ( _ , resources = [ ] ) => {
73
+ // Handle bulk action - process all selected resources
74
+ if ( resources && resources . length > 1 ) {
75
+ // Bulk operation
76
+ await Promise . all ( resources . map ( async ( resource ) => {
77
+ if ( resource . spec ) {
78
+ resource . spec = { ...( resource . spec || { } ) , enabled : false } ;
79
+ await resource . save ( ) ;
80
+ }
81
+ } ) ) ;
82
+ } else {
83
+ // Single resource operation
84
+ this . spec = { ...( this . spec || { } ) , enabled : false } ;
85
+ await this . save ( ) ;
86
+ }
75
87
}
76
88
}
77
89
: {
@@ -80,9 +92,21 @@ export default class SbombasticRancherIoVexhub extends SteveModel {
80
92
icon : 'icon-play' ,
81
93
enabled : true ,
82
94
bulkable : true ,
83
- invoke : async ( ) => {
84
- this . spec = { ...( this . spec || { } ) , enabled : true } ;
85
- await this . save ( ) ;
95
+ invoke : async ( _ , resources = [ ] ) => {
96
+ // Handle bulk action - process all selected resources
97
+ if ( resources && resources . length > 1 ) {
98
+ // Bulk operation
99
+ await Promise . all ( resources . map ( async ( resource ) => {
100
+ if ( resource . spec ) {
101
+ resource . spec = { ...( resource . spec || { } ) , enabled : true } ;
102
+ await resource . save ( ) ;
103
+ }
104
+ } ) ) ;
105
+ } else {
106
+ // Single resource operation
107
+ this . spec = { ...( this . spec || { } ) , enabled : true } ;
108
+ await this . save ( ) ;
109
+ }
86
110
}
87
111
} ;
88
112
}
You can’t perform that action at this time.
0 commit comments