From 0aeeabfbde003731f557a451f69fa1505b6381be Mon Sep 17 00:00:00 2001 From: Joris-k Date: Fri, 6 Dec 2024 17:40:13 +0100 Subject: [PATCH 1/3] feat(xo-lite): add host network tab and pif table / status component and pif store --- .../lite/src/components/host/HostTabBar.vue | 2 +- .../components/host/network/HostPifStatus.vue | 44 ++++ .../components/host/network/HostPifTable.vue | 235 ++++++++++++++++++ @xen-orchestra/lite/src/locales/en.json | 7 + @xen-orchestra/lite/src/locales/fr.json | 7 + .../lite/src/stores/xen-api/pif.store.ts | 34 +++ .../lite/src/views/host/HostNetworkView.vue | 17 +- .../lib/components/ui/checkbox/UiCheckbox.vue | 2 +- 8 files changed, 344 insertions(+), 4 deletions(-) create mode 100644 @xen-orchestra/lite/src/components/host/network/HostPifStatus.vue create mode 100644 @xen-orchestra/lite/src/components/host/network/HostPifTable.vue create mode 100644 @xen-orchestra/lite/src/stores/xen-api/pif.store.ts diff --git a/@xen-orchestra/lite/src/components/host/HostTabBar.vue b/@xen-orchestra/lite/src/components/host/HostTabBar.vue index e918ee34e70..d64d5cf2626 100644 --- a/@xen-orchestra/lite/src/components/host/HostTabBar.vue +++ b/@xen-orchestra/lite/src/components/host/HostTabBar.vue @@ -6,7 +6,7 @@ {{ $t('console') }} - + {{ $t('network') }} diff --git a/@xen-orchestra/lite/src/components/host/network/HostPifStatus.vue b/@xen-orchestra/lite/src/components/host/network/HostPifStatus.vue new file mode 100644 index 00000000000..1590f46082d --- /dev/null +++ b/@xen-orchestra/lite/src/components/host/network/HostPifStatus.vue @@ -0,0 +1,44 @@ + + + + + diff --git a/@xen-orchestra/lite/src/components/host/network/HostPifTable.vue b/@xen-orchestra/lite/src/components/host/network/HostPifTable.vue new file mode 100644 index 00000000000..565e7d42930 --- /dev/null +++ b/@xen-orchestra/lite/src/components/host/network/HostPifTable.vue @@ -0,0 +1,235 @@ + + + + + diff --git a/@xen-orchestra/lite/src/locales/en.json b/@xen-orchestra/lite/src/locales/en.json index a9217ed7ae1..1dde1a40903 100644 --- a/@xen-orchestra/lite/src/locales/en.json +++ b/@xen-orchestra/lite/src/locales/en.json @@ -35,6 +35,7 @@ "close": "Close", "community": "Community", "community-name": "{name} community", + "connected": "Connected", "configuration": "Configuration", "confirm-cancel": "Are you sure you want to cancel?", "confirm-delete": "You're about to delete {0}", @@ -60,11 +61,14 @@ "descending": "descending", "description": "Description", "dhcp": "DHCP", + "disconnected": "Disconnected", + "disconnected-from-physical-device": "Disconnected from physical device", "disabled": "Disabled", "display": "Display", "dns": "DNS", "do-you-have-needs": "You have needs and/or expectations? Let us know", "documentation": "Documentation", + "edit": "Edit", "edit-config": "Edit config", "enabled": "Enabled", "error-occurred": "An error has occurred", @@ -186,6 +190,7 @@ "new-features-are-coming": "New features are coming soon!", "news": "News", "news-name": "{name} news", + "none": "None", "no-alarm-triggered": "No alarm triggered", "no-result": "No result", "no-selected-vm-can-be-exported": "No selected VM can be exported", @@ -199,6 +204,7 @@ "password": "Password", "password-invalid": "Password invalid", "pause": "Pause", + "pifs": "PIFs", "please-confirm": "Please confirm", "pool-cpu-usage": "Pool CPU Usage", "pool-ram-usage": "Pool RAM Usage", @@ -220,6 +226,7 @@ "resume": "Resume", "save": "Save", + "scan-pifs": "Scan PIFs", "select-compression": "Select a compression", "select-destination-host": "Select a destination host", "selected-vms-in-execution": "Some selected VMs are running", diff --git a/@xen-orchestra/lite/src/locales/fr.json b/@xen-orchestra/lite/src/locales/fr.json index d9f86ea546e..a7ac3f46e1f 100644 --- a/@xen-orchestra/lite/src/locales/fr.json +++ b/@xen-orchestra/lite/src/locales/fr.json @@ -36,6 +36,7 @@ "community": "Communauté", "community-name": "Communauté {name}", "configuration": "Configuration", + "connected": "Connecté", "confirm-cancel": "Êtes-vous sûr de vouloir annuler ?", "confirm-delete": "Vous êtes sur le point de supprimer {0}", "console-unavailable": "Console indisponible", @@ -60,11 +61,14 @@ "descending": "descendant", "description": "Description", "dhcp": "DHCP", + "disconnected": "Déconnecté", + "disconnected-from-physical-device": "Déconnecté de l'appareil physique", "dns": "DNS", "disabled": "Désactivé", "display": "Affichage", "do-you-have-needs": "Vous avez des besoins et/ou des attentes ? Faites le nous savoir", "documentation": "Documentation", + "edit": "Modifier", "edit-config": "Modifier config", "enabled": "Activé", "error-occurred": "Une erreur est survenue", @@ -186,6 +190,7 @@ "new-features-are-coming": "De nouvelles fonctionnalités arrivent bientôt !", "news": "Actualités", "news-name": "Actualités {name}", + "none": "Aucun", "no-alarm-triggered": "Aucune alarme déclenchée", "no-result": "Aucun résultat", "no-selected-vm-can-be-exported": "Aucune VM sélectionnée ne peut être exportée", @@ -199,6 +204,7 @@ "password": "Mot de passe", "password-invalid": "Mot de passe incorrect", "pause": "Pause", + "pifs": "PIFs", "please-confirm": "Veuillez confirmer", "pool-cpu-usage": "Utilisation CPU du Pool", "pool-ram-usage": "Utilisation RAM du Pool", @@ -220,6 +226,7 @@ "resume": "Reprendre", "save": "Enregistrer", + "scan-pifs": "Scanner les PIFs", "select-compression": "Sélectionnez une compression", "select-destination-host": "Sélectionnez un hôte de destination", "selected-vms-in-execution": "Certaines VMs sélectionnées sont en cours d'exécution", diff --git a/@xen-orchestra/lite/src/stores/xen-api/pif.store.ts b/@xen-orchestra/lite/src/stores/xen-api/pif.store.ts new file mode 100644 index 00000000000..b0e11880f15 --- /dev/null +++ b/@xen-orchestra/lite/src/stores/xen-api/pif.store.ts @@ -0,0 +1,34 @@ +import type { XenApiHost } 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 { createSubscribableStoreContext } from '@core/utils/create-subscribable-store-context.util' +import { defineStore } from 'pinia' +import { computed } from 'vue' +import { useRoute } from 'vue-router' + +export const usePifStore = defineStore('xen-api-pif', () => { + const route = useRoute() + + const deps = { + hostStore: useHostStore(), + } + const { context: baseContext, ...configRest } = createXapiStoreConfig('pif') + + const hostContext = deps.hostStore.getContext() + + const currentHostPifs = computed(() => { + const currentHostUuid = route.params.uuid as XenApiHost['uuid'] + + return baseContext.records.value.filter(pif => { + const host = hostContext.getByOpaqueRef(pif.host) + return host?.uuid === currentHostUuid + }) + }) + + const context = { + ...baseContext, + currentHostPifs, + } + + return createSubscribableStoreContext({ context, ...configRest }, deps) +}) diff --git a/@xen-orchestra/lite/src/views/host/HostNetworkView.vue b/@xen-orchestra/lite/src/views/host/HostNetworkView.vue index 4a52297b68a..60cba06b207 100644 --- a/@xen-orchestra/lite/src/views/host/HostNetworkView.vue +++ b/@xen-orchestra/lite/src/views/host/HostNetworkView.vue @@ -1,11 +1,24 @@ + + diff --git a/@xen-orchestra/web-core/lib/components/ui/checkbox/UiCheckbox.vue b/@xen-orchestra/web-core/lib/components/ui/checkbox/UiCheckbox.vue index 8b1bdaf05b3..2092b8a2d93 100644 --- a/@xen-orchestra/web-core/lib/components/ui/checkbox/UiCheckbox.vue +++ b/@xen-orchestra/web-core/lib/components/ui/checkbox/UiCheckbox.vue @@ -43,7 +43,7 @@ const props = withDefaults( { disabled: undefined } ) -const checkboxModel = defineModel({ default: undefined }) +const checkboxModel = defineModel({ default: undefined }) const slots = defineSlots<{ default?(): any From 8efb839a02251a41af0c9b7d5c386567c9d3e44d Mon Sep 17 00:00:00 2001 From: Joris-K Date: Mon, 30 Dec 2024 17:04:50 +0100 Subject: [PATCH 2/3] remove duplicate --- @xen-orchestra/lite/src/locales/en.json | 3 --- @xen-orchestra/lite/src/locales/fr.json | 3 --- 2 files changed, 6 deletions(-) diff --git a/@xen-orchestra/lite/src/locales/en.json b/@xen-orchestra/lite/src/locales/en.json index 1dde1a40903..b57f333c450 100644 --- a/@xen-orchestra/lite/src/locales/en.json +++ b/@xen-orchestra/lite/src/locales/en.json @@ -35,7 +35,6 @@ "close": "Close", "community": "Community", "community-name": "{name} community", - "connected": "Connected", "configuration": "Configuration", "confirm-cancel": "Are you sure you want to cancel?", "confirm-delete": "You're about to delete {0}", @@ -61,8 +60,6 @@ "descending": "descending", "description": "Description", "dhcp": "DHCP", - "disconnected": "Disconnected", - "disconnected-from-physical-device": "Disconnected from physical device", "disabled": "Disabled", "display": "Display", "dns": "DNS", diff --git a/@xen-orchestra/lite/src/locales/fr.json b/@xen-orchestra/lite/src/locales/fr.json index a7ac3f46e1f..b59b5273752 100644 --- a/@xen-orchestra/lite/src/locales/fr.json +++ b/@xen-orchestra/lite/src/locales/fr.json @@ -36,7 +36,6 @@ "community": "Communauté", "community-name": "Communauté {name}", "configuration": "Configuration", - "connected": "Connecté", "confirm-cancel": "Êtes-vous sûr de vouloir annuler ?", "confirm-delete": "Vous êtes sur le point de supprimer {0}", "console-unavailable": "Console indisponible", @@ -61,8 +60,6 @@ "descending": "descendant", "description": "Description", "dhcp": "DHCP", - "disconnected": "Déconnecté", - "disconnected-from-physical-device": "Déconnecté de l'appareil physique", "dns": "DNS", "disabled": "Désactivé", "display": "Affichage", From 0604061cf3ae52cc840502de70e8db3819d12534 Mon Sep 17 00:00:00 2001 From: Joris-K Date: Thu, 2 Jan 2025 15:48:55 +0100 Subject: [PATCH 3/3] adding VtsConnectionStatus component and pif metrics store --- .../components/host/network/HostPifStatus.vue | 44 ------------------- .../components/host/network/HostPifTable.vue | 25 ++++++++--- .../src/stores/xen-api/pif-metrics.store.ts | 20 +++++++++ 3 files changed, 40 insertions(+), 49 deletions(-) delete mode 100644 @xen-orchestra/lite/src/components/host/network/HostPifStatus.vue create mode 100644 @xen-orchestra/lite/src/stores/xen-api/pif-metrics.store.ts diff --git a/@xen-orchestra/lite/src/components/host/network/HostPifStatus.vue b/@xen-orchestra/lite/src/components/host/network/HostPifStatus.vue deleted file mode 100644 index 1590f46082d..00000000000 --- a/@xen-orchestra/lite/src/components/host/network/HostPifStatus.vue +++ /dev/null @@ -1,44 +0,0 @@ - - - - - diff --git a/@xen-orchestra/lite/src/components/host/network/HostPifTable.vue b/@xen-orchestra/lite/src/components/host/network/HostPifTable.vue index 565e7d42930..69bfe556145 100644 --- a/@xen-orchestra/lite/src/components/host/network/HostPifTable.vue +++ b/@xen-orchestra/lite/src/components/host/network/HostPifTable.vue @@ -66,7 +66,7 @@
- +
@@ -94,11 +94,12 @@