From: Jérôme Benoit Date: Fri, 9 Feb 2024 19:42:02 +0000 (+0100) Subject: feat(ui): display supervision url in charging stations list X-Git-Tag: v1.2.36~22 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=1d41bc6b533ef7361954f472811263c24cd6f64b;p=e-mobility-charging-stations-simulator.git feat(ui): display supervision url in charging stations list closes #967 Signed-off-by: Jérôme Benoit --- diff --git a/src/charging-station/ChargingStation.ts b/src/charging-station/ChargingStation.ts index a0867719..8bbf7848 100644 --- a/src/charging-station/ChargingStation.ts +++ b/src/charging-station/ChargingStation.ts @@ -260,7 +260,7 @@ export class ChargingStation extends EventEmitter { return this.connectors.size === 0 && this.evses.size > 0 } - private get wsConnectionUrl (): URL { + public get wsConnectionUrl (): URL { return new URL( `${ this.stationInfo?.supervisionUrlOcppConfiguration === true && @@ -801,14 +801,12 @@ export class ChargingStation extends EventEmitter { if (this.isWebSocketConnectionOpened()) { logger.warn( - `${this.logPrefix()} OCPP connection to URL ${this.wsConnectionUrl.toString()} is already opened` + `${this.logPrefix()} OCPP connection to URL ${this.wsConnectionUrl.href} is already opened` ) return } - logger.info( - `${this.logPrefix()} Open OCPP connection to URL ${this.wsConnectionUrl.toString()}` - ) + logger.info(`${this.logPrefix()} Open OCPP connection to URL ${this.wsConnectionUrl.href}`) this.wsConnection = new WebSocket( this.wsConnectionUrl, @@ -1802,7 +1800,7 @@ export class ChargingStation extends EventEmitter { private async onOpen (): Promise { if (this.isWebSocketConnectionOpened()) { logger.info( - `${this.logPrefix()} Connection to OCPP server through ${this.wsConnectionUrl.toString()} succeeded` + `${this.logPrefix()} Connection to OCPP server through ${this.wsConnectionUrl.href} succeeded` ) let registrationRetryCount = 0 if (!this.isRegistered()) { @@ -1856,7 +1854,7 @@ export class ChargingStation extends EventEmitter { this.emit(ChargingStationEvents.updated) } else { logger.warn( - `${this.logPrefix()} Connection to OCPP server through ${this.wsConnectionUrl.toString()} failed` + `${this.logPrefix()} Connection to OCPP server through ${this.wsConnectionUrl.href} failed` ) } } diff --git a/src/types/ChargingStationWorker.ts b/src/types/ChargingStationWorker.ts index df4a789c..d0cdf900 100644 --- a/src/types/ChargingStationWorker.ts +++ b/src/types/ChargingStationWorker.ts @@ -31,6 +31,7 @@ export interface ChargingStationData extends WorkerData { connectors: ConnectorStatus[] evses: EvseStatusWorkerType[] ocppConfiguration: ChargingStationOcppConfiguration + supervisionUrl: string wsState?: | typeof WebSocket.CONNECTING | typeof WebSocket.OPEN diff --git a/src/utils/MessageChannelUtils.ts b/src/utils/MessageChannelUtils.ts index 212ed5f2..a3b267ee 100644 --- a/src/utils/MessageChannelUtils.ts +++ b/src/utils/MessageChannelUtils.ts @@ -68,6 +68,7 @@ export const buildChargingStationDataPayload = ( evses: buildEvsesStatus(chargingStation, OutputFormat.worker), // eslint-disable-next-line @typescript-eslint/no-non-null-assertion ocppConfiguration: chargingStation.ocppConfiguration!, + supervisionUrl: chargingStation.wsConnectionUrl.href, wsState: chargingStation.wsConnection?.readyState, bootNotificationResponse: chargingStation.bootNotificationResponse, ...(chargingStation.automaticTransactionGenerator != null && { diff --git a/ui/web/src/App.vue b/ui/web/src/App.vue index d6df1a21..87c7aa45 100644 --- a/ui/web/src/App.vue +++ b/ui/web/src/App.vue @@ -4,8 +4,8 @@ diff --git a/ui/web/src/components/Container.vue b/ui/web/src/components/Container.vue index c9683bbe..451a7659 100644 --- a/ui/web/src/components/Container.vue +++ b/ui/web/src/components/Container.vue @@ -6,9 +6,6 @@ diff --git a/ui/web/src/components/charging-stations/CSConnector.vue b/ui/web/src/components/charging-stations/CSConnector.vue index d828ae86..29bb0718 100644 --- a/ui/web/src/components/charging-stations/CSConnector.vue +++ b/ui/web/src/components/charging-stations/CSConnector.vue @@ -1,5 +1,5 @@