Skip to content

Commit 87ff014

Browse files
refactor: add banner in PCI Devices page (#785) (#788)
* refactor: add banner in PCI Devices page * refactor: based on copilot review --------- (cherry picked from commit c5b4f6c) Signed-off-by: Andy Lee <andy.lee@suse.com> Co-authored-by: Andy Lee <andy.lee@suse.com>
1 parent 20328b0 commit 87ff014

3 files changed

Lines changed: 38 additions & 11 deletions

File tree

pkg/harvester/edit/kubevirt.io.virtualmachine/VirtualMachinePciDevices/index.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -243,9 +243,9 @@ export default {
243243
<Banner color="info">
244244
<MessageLink
245245
:to="toVGpuDevicesPage"
246-
prefix-label="harvester.pci.howToUseDevice.prefix"
247-
middle-label="harvester.pci.howToUseDevice.middle"
248-
suffix-label="harvester.pci.howToUseDevice.suffix"
246+
prefix-label="harvester.pci.howToUseDeviceInVMCreation.prefix"
247+
middle-label="harvester.pci.howToUseDeviceInVMCreation.middle"
248+
suffix-label="harvester.pci.howToUseDeviceInVMCreation.suffix"
249249
/>
250250
</Banner>
251251
<Banner

pkg/harvester/l10n/en-us.yaml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -376,10 +376,14 @@ harvester:
376376
available: Available Devices
377377
compatibleNodes: Compatible Nodes
378378
impossibleSelection: 'There are no hosts with all of the selected devices.'
379-
howToUseDevice:
380-
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'
381-
middle: vGPU Devices
379+
howToUseDeviceInVMCreation:
380+
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'
381+
middle: vGPU Devices
382382
suffix: page first.
383+
howToUseDevice:
384+
prefix: 'Select the device in the table to enable PCI passthrough. <br>For vGPU devices, please enable them on the'
385+
middle: vGPU Devices
386+
suffix: page.
383387
deviceInTheSameHost: 'You can only select devices on the same host.'
384388
oldFormatDevices:
385389
help: |-

pkg/harvester/list/devices.harvesterhci.io.pcidevice.vue

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,17 @@ export default {
6060
return schema;
6161
},
6262
63+
toVGpuDevicesPage() {
64+
return {
65+
name: 'harvester-c-cluster-resource',
66+
params: { cluster: this.$store.getters['clusterId'], resource: HCI.VGPU_DEVICE },
67+
};
68+
},
69+
70+
vGPUAsPCIDeviceEnabled() {
71+
return this.$store.getters['harvester-common/getFeatureEnabled']('vGPUAsPCIDevice');
72+
},
73+
6374
rows() {
6475
const inStore = this.$store.getters['currentProduct'].inStore;
6576
const rows = this.$store.getters[`${ inStore }/all`](HCI.PCI_DEVICE);
@@ -85,11 +96,23 @@ export default {
8596
{{ t('harvester.pci.noPCIPermission') }}
8697
</Banner>
8798
</div>
88-
<DeviceList
89-
v-else-if="hasSchema && enabledPCI"
90-
:devices="rows"
91-
:schema="schema"
92-
/>
99+
<div v-else-if="hasSchema && enabledPCI">
100+
<Banner
101+
v-if="vGPUAsPCIDeviceEnabled"
102+
color="info"
103+
>
104+
<MessageLink
105+
:to="toVGpuDevicesPage"
106+
prefix-label="harvester.pci.howToUseDevice.prefix"
107+
middle-label="harvester.pci.howToUseDevice.middle"
108+
suffix-label="harvester.pci.howToUseDevice.suffix"
109+
/>
110+
</Banner>
111+
<DeviceList
112+
:devices="rows"
113+
:schema="schema"
114+
/>
115+
</div>
93116
<div v-else>
94117
<Banner color="warning">
95118
<MessageLink

0 commit comments

Comments
 (0)