mirror of
https://github.com/harvester/harvester-ui-extension.git
synced 2026-10-01 03:36:04 +08:00
fix: vGPU and USB enable/disable actions needs to be hidden for read only users (#877)
* fix: vGPU / USB enable/disable actions needs to be hidden for read only users Signed-off-by: Andy Lee <andy.lee@suse.com> * style: add scoped styles for group actions in DeviceList component Signed-off-by: Andy Lee <andy.lee@suse.com> * style: remove width property from group actions in DeviceList components Signed-off-by: Andy Lee <andy.lee@suse.com> * fix: update logging type in init function and improve SideNav visibility handling Signed-off-by: Andy Lee <andy.lee@suse.com> * fix: ensure canManageGroup only returns true for non-empty rows with updatable permissions Signed-off-by: Andy Lee <andy.lee@suse.com> --------- Signed-off-by: Andy Lee <andy.lee@suse.com>
This commit is contained in:
+30
-15
@@ -152,6 +152,10 @@ export default {
|
||||
return !rows.find((device) => !device.passthroughClaim);
|
||||
},
|
||||
|
||||
canManageGroup(rows = []) {
|
||||
return rows.length > 0 && rows.every((row) => row.canUpdate === true);
|
||||
},
|
||||
|
||||
changeRows(filterRows, parentSriov) {
|
||||
this['filterRows'] = filterRows;
|
||||
this['parentSriov'] = parentSriov;
|
||||
@@ -185,22 +189,27 @@ export default {
|
||||
v-trim-whitespace
|
||||
class="group-tab"
|
||||
>
|
||||
<button
|
||||
v-if="groupIsAllEnabled(group.rows)"
|
||||
type="button"
|
||||
class="btn btn-sm role-secondary mr-5"
|
||||
@click="e=>{disableGroup(group.rows); e.target.blur()}"
|
||||
<div
|
||||
v-if="canManageGroup(group.rows)"
|
||||
class="group-actions"
|
||||
>
|
||||
{{ t('harvester.pci.disableGroup') }}
|
||||
</button>
|
||||
<button
|
||||
v-else
|
||||
type="button"
|
||||
class="btn btn-sm role-secondary mr-5"
|
||||
@click="e=>{enableGroup(group.rows); e.target.blur()}"
|
||||
>
|
||||
{{ t('harvester.pci.enableGroup') }}
|
||||
</button>
|
||||
<button
|
||||
v-if="groupIsAllEnabled(group.rows)"
|
||||
type="button"
|
||||
class="btn btn-sm role-secondary mr-5"
|
||||
@click="e=>{disableGroup(group.rows); e.target.blur()}"
|
||||
>
|
||||
{{ t('harvester.pci.disableGroup') }}
|
||||
</button>
|
||||
<button
|
||||
v-else
|
||||
type="button"
|
||||
class="btn btn-sm role-secondary mr-5"
|
||||
@click="e=>{enableGroup(group.rows); e.target.blur()}"
|
||||
>
|
||||
{{ t('harvester.pci.enableGroup') }}
|
||||
</button>
|
||||
</div>
|
||||
<span v-clean-html="group.key" />
|
||||
</div>
|
||||
</template>
|
||||
@@ -232,3 +241,9 @@ export default {
|
||||
</template>
|
||||
</ResourceTable>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.group-actions {
|
||||
display: inline;
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user