diff --git a/pkg/sbombastic-image-vulnerability-scanner/models/sbombastic.rancher.io.vexhub.js b/pkg/sbombastic-image-vulnerability-scanner/models/sbombastic.rancher.io.vexhub.js index 93c053f..42acc5e 100644 --- a/pkg/sbombastic-image-vulnerability-scanner/models/sbombastic.rancher.io.vexhub.js +++ b/pkg/sbombastic-image-vulnerability-scanner/models/sbombastic.rancher.io.vexhub.js @@ -69,9 +69,21 @@ export default class SbombasticRancherIoVexhub extends SteveModel { icon: 'icon-pause', enabled: true, bulkable: true, - invoke: async() => { - this.spec = { ...(this.spec || {}), enabled: false }; - await this.save(); + invoke: async(_, resources = []) => { + // Handle bulk action - process all selected resources + if (resources && resources.length > 1) { + // Bulk operation + await Promise.all(resources.map(async (resource) => { + if (resource.spec) { + resource.spec = { ...(resource.spec || {}), enabled: false }; + await resource.save(); + } + })); + } else { + // Single resource operation + this.spec = { ...(this.spec || {}), enabled: false }; + await this.save(); + } } } : { @@ -80,9 +92,21 @@ export default class SbombasticRancherIoVexhub extends SteveModel { icon: 'icon-play', enabled: true, bulkable: true, - invoke: async() => { - this.spec = { ...(this.spec || {}), enabled: true }; - await this.save(); + invoke: async(_, resources = []) => { + // Handle bulk action - process all selected resources + if (resources && resources.length > 1) { + // Bulk operation + await Promise.all(resources.map(async (resource) => { + if (resource.spec) { + resource.spec = { ...(resource.spec || {}), enabled: true }; + await resource.save(); + } + })); + } else { + // Single resource operation + this.spec = { ...(this.spec || {}), enabled: true }; + await this.save(); + } } }; }