From: Jérôme Benoit Date: Mon, 26 Feb 2024 13:02:45 +0000 (+0100) Subject: fix: fix supervision url handling at charging stations adding X-Git-Tag: v1.2.38~42 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=2293fadc545b3f531f3c94c2f9f622eeab331bd7;p=e-mobility-charging-stations-simulator.git fix: fix supervision url handling at charging stations adding Signed-off-by: Jérôme Benoit --- 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: