From ca1e5439d7a19520d752a8c60513d4229b118e35 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Sat, 17 Feb 2024 23:57:02 +0100 Subject: [PATCH] refactor(ui): cleanup CSS styles namespace MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- ui/web/src/App.vue | 4 ++-- ui/web/src/composables/UIClient.ts | 7 +++++-- ui/web/src/main.ts | 2 +- ui/web/src/views/ChargingStationsView.vue | 4 ++-- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/ui/web/src/App.vue b/ui/web/src/App.vue index 1f2dcf85..ab08dea6 100644 --- a/ui/web/src/App.vue +++ b/ui/web/src/App.vue @@ -1,6 +1,6 @@ @@ -22,7 +22,7 @@ import Container from '@/components/Container.vue' background-color: white; } -#action { +#action-container { min-width: max-content; display: flex; flex-direction: column; diff --git a/ui/web/src/composables/UIClient.ts b/ui/web/src/composables/UIClient.ts index 536b6e84..c5f20ce0 100644 --- a/ui/web/src/composables/UIClient.ts +++ b/ui/web/src/composables/UIClient.ts @@ -33,8 +33,11 @@ export class UIClient { return UIClient.instance } - public registerWSonOpenListener(listener: (event: Event) => void) { - this.ws.addEventListener('open', listener) + public registerWSEventListener( + event: K, + listener: (event: WebSocketEventMap[K]) => void + ) { + this.ws.addEventListener(event, listener) } public async startSimulator(): Promise { diff --git a/ui/web/src/main.ts b/ui/web/src/main.ts index 7b36de58..18186e16 100644 --- a/ui/web/src/main.ts +++ b/ui/web/src/main.ts @@ -13,7 +13,7 @@ const initializeApp = (config: ConfigurationData) => { // TODO: add code for UI notifications or other error handling logic } app.config.globalProperties.$uiClient = UIClient.getInstance(config) - app.config.globalProperties.$uiClient.registerWSonOpenListener(() => { + app.config.globalProperties.$uiClient.registerWSEventListener('open', () => { app.config.globalProperties.$uiClient .listChargingStations() .then((response: ResponsePayload) => { diff --git a/ui/web/src/views/ChargingStationsView.vue b/ui/web/src/views/ChargingStationsView.vue index 5e0ce534..c2e12cb5 100644 --- a/ui/web/src/views/ChargingStationsView.vue +++ b/ui/web/src/views/ChargingStationsView.vue @@ -1,5 +1,5 @@