Skip to content

Commit 0ac17b3

Browse files
committed
bug: The table action effects on an unselected row in VEX management list
1 parent 00e69d4 commit 0ac17b3

File tree

1 file changed

+30
-6
lines changed

1 file changed

+30
-6
lines changed

pkg/sbombastic-image-vulnerability-scanner/models/sbombastic.rancher.io.vexhub.js

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,21 @@ export default class SbombasticRancherIoVexhub extends SteveModel {
6969
icon: 'icon-pause',
7070
enabled: true,
7171
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+
}
7587
}
7688
}
7789
: {
@@ -80,9 +92,21 @@ export default class SbombasticRancherIoVexhub extends SteveModel {
8092
icon: 'icon-play',
8193
enabled: true,
8294
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+
}
86110
}
87111
};
88112
}

0 commit comments

Comments
 (0)