refactor: add banner in PCI Devices page (#785)

* refactor: add banner in PCI Devices page

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

* refactor: based on copilot review

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

---------

Signed-off-by: Andy Lee <andy.lee@suse.com>
This commit is contained in:
Andy Lee 2026-03-31 17:45:06 +08:00 committed by GitHub
parent 4ce35ce075
commit c5b4f6cd1e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 38 additions and 11 deletions

View File

@ -243,9 +243,9 @@ export default {
<Banner color="info"> <Banner color="info">
<MessageLink <MessageLink
:to="toVGpuDevicesPage" :to="toVGpuDevicesPage"
prefix-label="harvester.pci.howToUseDevice.prefix" prefix-label="harvester.pci.howToUseDeviceInVMCreation.prefix"
middle-label="harvester.pci.howToUseDevice.middle" middle-label="harvester.pci.howToUseDeviceInVMCreation.middle"
suffix-label="harvester.pci.howToUseDevice.suffix" suffix-label="harvester.pci.howToUseDeviceInVMCreation.suffix"
/> />
</Banner> </Banner>
<Banner <Banner

View File

@ -376,10 +376,14 @@ harvester:
available: Available Devices available: Available Devices
compatibleNodes: Compatible Nodes compatibleNodes: Compatible Nodes
impossibleSelection: 'There are no hosts with all of the selected devices.' impossibleSelection: 'There are no hosts with all of the selected devices.'
howToUseDevice: howToUseDeviceInVMCreation:
prefix: 'Use the table below to enable PCI passthrough on each device you want to use in this virtual machine.<br>For vGPU devices, please enable them on the' prefix: 'Use the table below to enable PCI passthrough on each device you want to use in this virtual machine. <br>For vGPU devices, please enable them on the'
middle: vGPU Devices middle: vGPU Devices
suffix: page first. suffix: page first.
howToUseDevice:
prefix: 'Select the device in the table to enable PCI passthrough. <br>For vGPU devices, please enable them on the'
middle: vGPU Devices
suffix: page.
deviceInTheSameHost: 'You can only select devices on the same host.' deviceInTheSameHost: 'You can only select devices on the same host.'
oldFormatDevices: oldFormatDevices:
help: |- help: |-

View File

@ -60,6 +60,17 @@ export default {
return schema; return schema;
}, },
toVGpuDevicesPage() {
return {
name: 'harvester-c-cluster-resource',
params: { cluster: this.$store.getters['clusterId'], resource: HCI.VGPU_DEVICE },
};
},
vGPUAsPCIDeviceEnabled() {
return this.$store.getters['harvester-common/getFeatureEnabled']('vGPUAsPCIDevice');
},
rows() { rows() {
const inStore = this.$store.getters['currentProduct'].inStore; const inStore = this.$store.getters['currentProduct'].inStore;
const rows = this.$store.getters[`${ inStore }/all`](HCI.PCI_DEVICE); const rows = this.$store.getters[`${ inStore }/all`](HCI.PCI_DEVICE);
@ -85,11 +96,23 @@ export default {
{{ t('harvester.pci.noPCIPermission') }} {{ t('harvester.pci.noPCIPermission') }}
</Banner> </Banner>
</div> </div>
<DeviceList <div v-else-if="hasSchema && enabledPCI">
v-else-if="hasSchema && enabledPCI" <Banner
:devices="rows" v-if="vGPUAsPCIDeviceEnabled"
:schema="schema" color="info"
/> >
<MessageLink
:to="toVGpuDevicesPage"
prefix-label="harvester.pci.howToUseDevice.prefix"
middle-label="harvester.pci.howToUseDevice.middle"
suffix-label="harvester.pci.howToUseDevice.suffix"
/>
</Banner>
<DeviceList
:devices="rows"
:schema="schema"
/>
</div>
<div v-else> <div v-else>
<Banner color="warning"> <Banner color="warning">
<MessageLink <MessageLink