From 9ed9924b4696526be897bd293d4e9f35704a429f Mon Sep 17 00:00:00 2001 From: Mengling Ding Date: Fri, 4 Oct 2024 15:59:39 -0500 Subject: [PATCH] feat: display host status in cfm-webui --- webui/src/components/CXL-Hosts/CXL-Hosts.vue | 90 +++++++++++++++---- webui/src/components/CXL-Hosts/HostMemory.vue | 2 +- .../components/CXL-Hosts/HostMemoryDevice.vue | 2 +- webui/src/components/CXL-Hosts/HostPorts.vue | 2 +- webui/src/components/Stores/HostStore.ts | 4 +- 5 files changed, 77 insertions(+), 23 deletions(-) diff --git a/webui/src/components/CXL-Hosts/CXL-Hosts.vue b/webui/src/components/CXL-Hosts/CXL-Hosts.vue index 59608a1..1fd1710 100644 --- a/webui/src/components/CXL-Hosts/CXL-Hosts.vue +++ b/webui/src/components/CXL-Hosts/CXL-Hosts.vue @@ -31,7 +31,13 @@ :key="host.id" :id="host.id" @click=" - selectHost(host.id, host.ipAddress, host.port, host.localMemoryMiB) + selectHost( + host.id, + host.ipAddress, + host.port, + host.localMemoryMiB, + host.status + ) " > @@ -69,13 +75,9 @@ - + - + Basic Information + + Status + {{ + selectedHostStatus + }} + + CXL-Host Id {{ host.id }} + IpAddress {{ host.ipAddress + ":" + host.port }} + LocalMemoryGiB @@ -121,13 +144,18 @@ : "N/A" }} + - + - + Ports Information - - + + - + Memory Devices - + - + Memory hostStore.selectedHostId); const selectedHostIp = computed(() => hostStore.selectedHostIp); const selectedHostPort = computed(() => hostStore.selectedHostPortNum); + const selectedHostStatus = computed(() => hostStore.selectedHostStatus); + + const statusColor = computed(() => { + return selectedHostStatus.value === "online" ? "#6ebe4a" : "warning"; + }); + + const statusIcon = computed(() => { + return selectedHostStatus.value === "online" + ? "mdi-check-circle" + : "mdi-close-circle"; + }); // Methods to update state const selectHost = ( hostId: string, hostIp: string, hostPort: number, - hostLocalMemory: number | undefined + hostLocalMemory: number | undefined, + hostStatus: string ) => { - hostStore.selectHost(hostId, hostIp, hostPort, hostLocalMemory); + hostStore.selectHost( + hostId, + hostIp, + hostPort, + hostLocalMemory, + hostStatus + ); }; return { @@ -897,6 +946,9 @@ export default { selectedHostId, selectedHostPort, selectedHostIp, + selectedHostStatus, + statusColor, + statusIcon, selectHost, loading, }; diff --git a/webui/src/components/CXL-Hosts/HostMemory.vue b/webui/src/components/CXL-Hosts/HostMemory.vue index 5611a84..1764378 100644 --- a/webui/src/components/CXL-Hosts/HostMemory.vue +++ b/webui/src/components/CXL-Hosts/HostMemory.vue @@ -4,7 +4,7 @@ diff --git a/webui/src/components/CXL-Hosts/HostMemoryDevice.vue b/webui/src/components/CXL-Hosts/HostMemoryDevice.vue index 55f9a7f..5f25ce6 100644 --- a/webui/src/components/CXL-Hosts/HostMemoryDevice.vue +++ b/webui/src/components/CXL-Hosts/HostMemoryDevice.vue @@ -4,7 +4,7 @@ diff --git a/webui/src/components/CXL-Hosts/HostPorts.vue b/webui/src/components/CXL-Hosts/HostPorts.vue index 28d6afc..2b9602c 100644 --- a/webui/src/components/CXL-Hosts/HostPorts.vue +++ b/webui/src/components/CXL-Hosts/HostPorts.vue @@ -4,7 +4,7 @@ diff --git a/webui/src/components/Stores/HostStore.ts b/webui/src/components/Stores/HostStore.ts index 3c04cae..ff6c7ef 100644 --- a/webui/src/components/Stores/HostStore.ts +++ b/webui/src/components/Stores/HostStore.ts @@ -14,6 +14,7 @@ export const useHostStore = defineStore('host', { selectedHostIp: null as unknown as string, selectedHostPortNum: null as unknown as number, selectedHostLocalMemory: null as unknown as number | undefined, + selectedHostStatus: null as unknown as string, addHostError: null as unknown, deleteHostError: null as unknown, resyncHostError: null as unknown, @@ -123,11 +124,12 @@ export const useHostStore = defineStore('host', { } }, - selectHost(selectedHostId: string, selectedHostIp: string, selectedHostPortNum: number, selectedHostLocalMemory: number | undefined) { + selectHost(selectedHostId: string, selectedHostIp: string, selectedHostPortNum: number, selectedHostLocalMemory: number | undefined, status: string) { this.selectedHostId = selectedHostId; this.selectedHostIp = selectedHostIp; this.selectedHostPortNum = selectedHostPortNum; this.selectedHostLocalMemory = selectedHostLocalMemory; + this.selectedHostStatus = status }, } }) \ No newline at end of file