From 2293fadc545b3f531f3c94c2f9f622eeab331bd7 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Mon, 26 Feb 2024 14:02:45 +0100 Subject: [PATCH] fix: fix supervision url handling at charging stations adding MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- src/charging-station/ChargingStation.ts | 16 ++++------------ src/charging-station/Helpers.ts | 3 +-- .../components/actions/AddChargingStations.vue | 14 +++++++++++++- 3 files changed, 18 insertions(+), 15 deletions(-) diff --git a/src/charging-station/ChargingStation.ts b/src/charging-station/ChargingStation.ts index 4ee9ff67..82fba5ad 100644 --- a/src/charging-station/ChargingStation.ts +++ b/src/charging-station/ChargingStation.ts @@ -534,15 +534,6 @@ export class ChargingStation extends EventEmitter { return Constants.DEFAULT_HEARTBEAT_INTERVAL } - public setSupervisionUrls (urls: string | string[], saveStationInfo = true): void { - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - this.stationInfo!.supervisionUrls = urls - if (saveStationInfo) { - this.saveStationInfo() - } - this.configuredSupervisionUrl = this.getConfiguredSupervisionUrl() - } - public setSupervisionUrl (url: string): void { if ( this.stationInfo?.supervisionUrlOcppConfiguration === true && @@ -550,7 +541,10 @@ export class ChargingStation extends EventEmitter { ) { setConfigurationKeyValue(this, this.stationInfo.supervisionUrlOcppKey, url) } else { - this.setSupervisionUrls(url) + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + this.stationInfo!.supervisionUrls = url + this.configuredSupervisionUrl = this.getConfiguredSupervisionUrl() + this.saveStationInfo() } } @@ -1251,7 +1245,6 @@ export class ChargingStation extends EventEmitter { stationInfoFromFile.templateHash === stationInfoFromTemplate.templateHash ) { return setChargingStationOptions( - this, { ...Constants.DEFAULT_STATION_INFO, ...stationInfoFromFile }, options ) @@ -1263,7 +1256,6 @@ export class ChargingStation extends EventEmitter { stationInfoFromTemplate ) return setChargingStationOptions( - this, { ...Constants.DEFAULT_STATION_INFO, ...stationInfoFromTemplate }, options ) diff --git a/src/charging-station/Helpers.ts b/src/charging-station/Helpers.ts index 2b3e1c7e..22ed5041 100644 --- a/src/charging-station/Helpers.ts +++ b/src/charging-station/Helpers.ts @@ -335,12 +335,11 @@ export const buildConnectorsMap = ( } export const setChargingStationOptions = ( - chargingStation: ChargingStation, stationInfo: ChargingStationInfo, options?: ChargingStationOptions ): ChargingStationInfo => { if (options?.supervisionUrls != null) { - chargingStation.setSupervisionUrls(options.supervisionUrls, false) + stationInfo.supervisionUrls = options.supervisionUrls } if (options?.persistentConfiguration != null) { stationInfo.stationInfoPersistentConfiguration = options.persistentConfiguration diff --git a/ui/web/src/components/actions/AddChargingStations.vue b/ui/web/src/components/actions/AddChargingStations.vue index 612c8ee8..076ffdbd 100644 --- a/ui/web/src/components/actions/AddChargingStations.vue +++ b/ui/web/src/components/actions/AddChargingStations.vue @@ -17,8 +17,18 @@ name="number-of-stations" placeholder="number of stations" /> -

Options:

+

Template options overrides: