]> Piment Noir Git Repositories - e-mobility-charging-stations-simulator.git/commit
feat(ui-server): allow override of station identity and CSMS credentials in addChargi...
authorDaniel <7558512+DerGenaue@users.noreply.github.com>
Wed, 22 Apr 2026 17:50:28 +0000 (19:50 +0200)
committerGitHub <noreply@github.com>
Wed, 22 Apr 2026 17:50:28 +0000 (19:50 +0200)
commitf23ba158a146ac3a0aedd85195c16e4d4595acd9
tree4b3379a1bff645b8b45b2e97fa0dccd5bc5fd29d
parent45624f2acecdaf37a67963a45f8ffa7816fbcfdd
feat(ui-server): allow override of station identity and CSMS credentials in addChargingStations (#1802)

* feat(ui-server): allow per-call override of station identity and CSMS credentials

Extend ChargingStationOptions with baseName, fixedName, nameSuffix,
supervisionUser and supervisionPassword so that callers of the
addChargingStations UI procedure can fully customise a station without
editing template files.

Identity derivation (chargingStationId, hashId) moves to the tail of
getStationInfo, after setChargingStationOptions runs, so the merged
stationInfo is the single source of truth for baseName/fixedName/nameSuffix.
getChargingStationId now accepts a narrow StationIdentity pick that both
ChargingStationTemplate and ChargingStationInfo satisfy; getHashId grows
an optional chargingStationIdOverride so the new identity flows through
without altering the hashed payload shape for existing callers.

Default behaviour is unchanged: hash ID regression test pins the
pre-existing hash, and omitted options leave stationInfo untouched.

* docs(ui-server): sync ChargingStationOptions docs with source interface

Bring the README protocol reference, the MCP zod schema and the web UI
ChargingStationOptions type back in sync with src/types/ChargingStationWorker.ts.
Covers the newly added baseName, fixedName, nameSuffix, supervisionUser and
supervisionPassword fields, plus previously missing fields not yet surfaced
in the public docs.

* feat(ui-web): expose baseName, fixedName and CSMS credentials in add-station dialog

Surface the new addChargingStations options on the web UI form: a base
name text field, an "append counter to name" checkbox that controls
fixedName, and a supervision user/password pair alongside the existing
supervision URL. Empty fields are omitted from the payload so the
template defaults apply unchanged.

\ 1 Conflicts:
\ 1 ui/web/src/components/actions/AddChargingStations.vue

* feat(ui-server): allow setSupervisionUrl to update CSMS credentials

Extend the setSupervisionUrl UI procedure so callers can update the
supervision WebSocket's basic auth user and password on an already
running station, not only the URL. All three fields (url,
supervisionUser, supervisionPassword) become optional; the handler now
requires at least one to be set.

ChargingStation.setSupervisionUrl accepts the three optional arguments
and writes the non-URL fields onto stationInfo via saveStationInfo.
Changes take effect on the next WebSocket (re)connect, mirroring how
URL updates already worked. The MCP zod schema and the protocol
reference in the README are updated accordingly.

* feat(ui-web): expose CSMS credentials in set-supervision dialog

Surface the extended setSupervisionUrl procedure on the web UI: user
and password inputs next to the existing URL field, a client-side
guard that requires at least one field set, and a renamed form
header ("Set Supervision") that matches the broader scope. UIClient
passes the new fields through only when populated, so existing
URL-only callers are unaffected.

* fix(ui-web): serve index.html as SPA fallback so deep-linked routes survive reload

The built bundle is served by start.js via serve-static, which 404s on
any path that isn't a physical file — so refreshing a router route
like /add-charging-stations or /set-supervision-url/... produced
"Cannot GET ...". When serve-static gives up, fall back to sending
the bundled index.html with 200 OK so the SPA router can resolve the
route client-side. POST/PUT/etc. still fall through to finalhandler.

* [autofix.ci] apply automated fixes

* test(ui-web): update AddChargingStations tests for new fields

Bump checkbox count to 5 (appendCounter added) and cover baseName,
supervision credential pass-through and fixedName behaviour.

* fix: PR comments

* fix: PR comments

  - server: setSupervisionUrl: url required, supervisionUser/supervisionPassword
    independent (string updates incl. "" to clear, undefined preserves);
    drop block-comment noise; align README and MCP schema descriptions
  - ui: SetSupervisionUrl dialog: always send credentials verbatim — empty
    fields clear stored credentials (frontend can't distinguish null
    vs empty)
  - ui: AddChargingStations dialog: replace inverted appendCounter with
    fixedName mirroring the API field; label "(base name is full
    station name)"; empty fields keep preserving template defaults
  - server: Rename StationIdentity → ChargingStationNameTemplate (and the
    parameter in getChargingStationId) so the type name reflects its
    role as the building blocks of chargingStationId
  - Tests updated to match the new semantics

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
15 files changed:
README.md
src/charging-station/ChargingStation.ts
src/charging-station/Helpers.ts
src/charging-station/broadcast-channel/ChargingStationWorkerBroadcastChannel.ts
src/charging-station/ui-server/mcp/MCPToolSchemas.ts
src/types/ChargingStationWorker.ts
tests/charging-station/Helpers.test.ts
ui/common/src/types/ChargingStationType.ts
ui/web/src/components/actions/AddChargingStations.vue
ui/web/src/components/actions/SetSupervisionUrl.vue
ui/web/src/composables/UIClient.ts
ui/web/start.js
ui/web/tests/unit/AddChargingStations.test.ts
ui/web/tests/unit/SetSupervisionUrl.test.ts
ui/web/tests/unit/UIClient.test.ts