From a4868fd7e236faf73e62efeeadad20119e2d96eb Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Tue, 27 Feb 2024 01:24:38 +0100 Subject: [PATCH] fix(ui): re-render charging stations table without reloading MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- ui/web/src/views/ChargingStationsView.vue | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/ui/web/src/views/ChargingStationsView.vue b/ui/web/src/views/ChargingStationsView.vue index cb8d607d..18b0cc02 100644 --- a/ui/web/src/views/ChargingStationsView.vue +++ b/ui/web/src/views/ChargingStationsView.vue @@ -43,8 +43,8 @@ 0 " + :key="state.reload" :charging-stations="app?.appContext.config.globalProperties.$chargingStations" /> @@ -67,8 +68,13 @@ import ReloadButton from '@/components/buttons/ReloadButton.vue' import Button from '@/components/buttons/Button.vue' import { getFromLocalStorage, setToLocalStorage } from '@/composables' +const randomUUID = (): `${string}-${string}-${string}-${string}-${string}` => { + return crypto.randomUUID() +} + const state = reactive({ - isLoading: false, + loading: false, + reload: randomUUID(), uiServerIndex: getFromLocalStorage('uiServerConfigurationIndex', 0) }) @@ -85,8 +91,8 @@ const uiServerConfigurations: { configuration: UIServerConfigurationSection; ind const $toast = useToast() const loadChargingStations = (reloadCallback?: () => void): void => { - if (state.isLoading === false) { - state.isLoading = true + if (state.loading === false) { + state.loading = true uiClient .listChargingStations() .then((response: ResponsePayload) => { @@ -102,7 +108,7 @@ const loadChargingStations = (reloadCallback?: () => void): void => { if (reloadCallback != null) { reloadCallback() } - state.isLoading = false + state.loading = false }) } } -- 2.34.1