fix: some actions should be hidden for read-only user (#855)

* fix: some actions limited for virt-viewer

Signed-off-by: Andy Lee <andy.lee@suse.com>

* refactor: based on schema collectionMethods

Signed-off-by: Andy Lee <andy.lee@suse.com>

* fix: conditionally add migrate action to available actions

* fix: update collectionMethods check to use find for case-insensitive matching

* fix: update canEditClusterMembers method to use schema for collectionMethods

* fix: update canCreateImage check to use case-insensitive matching

---------

Signed-off-by: Andy Lee <andy.lee@suse.com>
This commit is contained in:
Andy Lee authored and GitHub committed 2026-05-07 10:21:26 +08:00
1 parent 032700293c
commit 5cc8b4c301
15 files changed
+111 -14

No files matched your search

@@ -30,11 +30,12 @@ const STATUS_DISPLAY = {
export default class PCIDevice extends SteveModel {
get _availableActions() {
const out = super._availableActions;
const canUpdate = !!this.linkFor('update');
out.push(
{
action: 'enablePassthroughBulk',
enabled: !this.isEnabling && !this.isvGPUDevice,
enabled: !this.isEnabling && !this.isvGPUDevice && canUpdate,
icon: 'icon icon-fw icon-dot',
label: 'Enable Passthrough',
bulkable: true,
@@ -43,7 +44,7 @@ export default class PCIDevice extends SteveModel {
},
{
action: 'disablePassthrough',
enabled: this.isEnabling && this.claimedByMe && !this.isvGPUDevice,
enabled: this.isEnabling && this.claimedByMe && !this.isvGPUDevice && canUpdate,
icon: 'icon icon-fw icon-dot-open',
label: 'Disable Passthrough',
bulkable: true,