From 48974c801b1db100926381dc8f91c89cb6bf7cc4 Mon Sep 17 00:00:00 2001 From: Joris-k Date: Thu, 21 Nov 2024 12:20:46 +0100 Subject: [PATCH] feat(xo-lite): add selected pifs in side panel and copy to clipboard --- @xen-orchestra/lite/src/locales/en.json | 2 + @xen-orchestra/lite/src/locales/fr.json | 2 + .../lite/src/stores/xen-api/network.store.ts | 8 +- .../lite/src/views/pool/PoolNetworkView.vue | 78 ++++++++++++++++--- 4 files changed, 78 insertions(+), 12 deletions(-) diff --git a/@xen-orchestra/lite/src/locales/en.json b/@xen-orchestra/lite/src/locales/en.json index 4046052bfb0..77c77b30fd1 100644 --- a/@xen-orchestra/lite/src/locales/en.json +++ b/@xen-orchestra/lite/src/locales/en.json @@ -67,6 +67,7 @@ "dns": "DNS", "do-you-have-needs": "You have needs and/or expectations? Let us know", "documentation": "Documentation", + "device": "Device", "edit": "Edit", "edit-config": "Edit config", "enabled": "Enabled", @@ -155,6 +156,7 @@ "password-invalid": "Password invalid", "pause": "Pause", "please-confirm": "Please confirm", + "pifs": "PIFs", "pifs-status": "PIFs status", "pool-cpu-usage": "Pool CPU Usage", "pool-ram-usage": "Pool RAM Usage", diff --git a/@xen-orchestra/lite/src/locales/fr.json b/@xen-orchestra/lite/src/locales/fr.json index ef8f72746e7..f9447d25773 100644 --- a/@xen-orchestra/lite/src/locales/fr.json +++ b/@xen-orchestra/lite/src/locales/fr.json @@ -67,6 +67,7 @@ "display": "Affichage", "do-you-have-needs": "Vous avez des besoins et/ou des attentes ? Faites le nous savoir", "documentation": "Documentation", + "device": "Appareil", "edit": "Modifier", "edit-config": "Modifier config", "enabled": "Activé", @@ -155,6 +156,7 @@ "password-invalid": "Mot de passe incorrect", "pause": "Pause", "please-confirm": "Veuillez confirmer", + "pifs": "PIFs", "pifs-status": "Statut des PIFs", "pool-cpu-usage": "Utilisation CPU du Pool", "pool-ram-usage": "Utilisation RAM du Pool", diff --git a/@xen-orchestra/lite/src/stores/xen-api/network.store.ts b/@xen-orchestra/lite/src/stores/xen-api/network.store.ts index 6f35646dee5..96c1670dd9d 100644 --- a/@xen-orchestra/lite/src/stores/xen-api/network.store.ts +++ b/@xen-orchestra/lite/src/stores/xen-api/network.store.ts @@ -1,4 +1,4 @@ -import type { XenApiPif } from '@/libs/xen-api/xen-api.types' +import type { XenApiNetwork, XenApiPif } from '@/libs/xen-api/xen-api.types' import { createXapiStoreConfig } from '@/stores/xen-api/create-xapi-store-config' import { useHostStore } from '@/stores/xen-api/host.store' import { usePifStore } from '@/stores/xen-api/pif.store' @@ -79,8 +79,14 @@ export const useNetworkStore = defineStore('xen-api-network', () => { })) }) + const getPIFsInformationByNetwork = (network: XenApiNetwork) => { + const PIFsOpaqueRefNetwork = network.PIFs + return PIFsOpaqueRefNetwork.map(ref => pifContext.records.value.find(pif => pif.$ref === ref)).filter(pif => !!pif) + } + const context = { ...baseContext, + getPIFsInformationByNetwork, networksWithVLANs, hostPrivateNetworks, } diff --git a/@xen-orchestra/lite/src/views/pool/PoolNetworkView.vue b/@xen-orchestra/lite/src/views/pool/PoolNetworkView.vue index 8f1803493b9..d5fc5be3192 100644 --- a/@xen-orchestra/lite/src/views/pool/PoolNetworkView.vue +++ b/@xen-orchestra/lite/src/views/pool/PoolNetworkView.vue @@ -35,7 +35,7 @@ - + {{ item.name_label }} {{ item.name_description }} @@ -108,8 +108,8 @@ - -