From b7169a17b4108623c950d5ef4a46bcc04b5c2c12 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Tue, 13 Feb 2024 19:49:55 +0100 Subject: [PATCH] refactor(ui): cleanup configuration types and variables 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/assets/config.ts | 6 +++--- ui/web/src/composables/UIClient.ts | 6 +++--- ui/web/src/types/ConfigurationType.ts | 6 +++--- ui/web/src/types/index.ts | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/ui/web/src/assets/config.ts b/ui/web/src/assets/config.ts index cf6f3eb2..28b3f158 100644 --- a/ui/web/src/assets/config.ts +++ b/ui/web/src/assets/config.ts @@ -1,6 +1,6 @@ -import type { BaseConfig } from '@/types' +import type { ConfigurationData } from '@/types' -const config: BaseConfig = { +const configuration: ConfigurationData = { uiServer: { host: 'localhost', port: 8080, @@ -8,4 +8,4 @@ const config: BaseConfig = { } } -export default config +export default configuration diff --git a/ui/web/src/composables/UIClient.ts b/ui/web/src/composables/UIClient.ts index fa1479ef..d056f631 100644 --- a/ui/web/src/composables/UIClient.ts +++ b/ui/web/src/composables/UIClient.ts @@ -5,7 +5,7 @@ import { type ResponsePayload, ResponseStatus } from '@/types' -import config from '@/assets/config' +import configuration from '@/assets/config' type ResponseHandler = { procedureName: ProcedureName @@ -111,8 +111,8 @@ export class UIClient { private openWS(): void { this.ws = new WebSocket( - `ws://${config.uiServer.host}:${config.uiServer.port}`, - config.uiServer.protocol + `ws://${configuration.uiServer.host}:${configuration.uiServer.port}`, + configuration.uiServer.protocol ) this.ws.onmessage = this.responseHandler.bind(this) this.ws.onerror = errorEvent => { diff --git a/ui/web/src/types/ConfigurationType.ts b/ui/web/src/types/ConfigurationType.ts index 3753d584..cfdbf34a 100644 --- a/ui/web/src/types/ConfigurationType.ts +++ b/ui/web/src/types/ConfigurationType.ts @@ -1,8 +1,8 @@ -export type BaseConfig = { - uiServer: UIServerConfig +export type ConfigurationData = { + uiServer: UIServerConfigurationSection } -type UIServerConfig = { +type UIServerConfigurationSection = { host: string port: number protocol: string diff --git a/ui/web/src/types/index.ts b/ui/web/src/types/index.ts index ec7821f3..1f1f0556 100644 --- a/ui/web/src/types/index.ts +++ b/ui/web/src/types/index.ts @@ -3,7 +3,7 @@ export type { ChargingStationInfo, ConnectorStatus } from './ChargingStationType' -export type { BaseConfig } from './ConfigurationType' +export type { ConfigurationData } from './ConfigurationType' export { ProcedureName, type ProtocolResponse, -- 2.34.1