From ab9d9299b910864d795696e160181a9983dd0309 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Wed, 22 Apr 2026 20:28:07 +0200 Subject: [PATCH] fix(ui-server): harmonize setSupervisionUrl semantics and text descriptions - Fix SetSupervisionUrl.vue passing empty credentials that silently clear existing values; align with AddChargingStations.vue pattern - Fix double saveStationInfo() call and missing updated event when only URL changes in ChargingStation.setSupervisionUrl - Remove verbose JSDoc, redundant comment, and parenthetical UI label - Harmonize MCP descriptions: use natural language instead of camelCase code names, unify credential field descriptions across schemas --- src/charging-station/ChargingStation.ts | 14 +++++--------- .../ui-server/mcp/MCPToolSchemas.ts | 14 ++++++++------ .../src/components/actions/AddChargingStations.vue | 2 +- .../src/components/actions/SetSupervisionUrl.vue | 4 ++-- ui/web/tests/unit/SetSupervisionUrl.test.ts | 10 +++++----- 5 files changed, 21 insertions(+), 23 deletions(-) diff --git a/src/charging-station/ChargingStation.ts b/src/charging-station/ChargingStation.ts index 170f376d..674825e1 100644 --- a/src/charging-station/ChargingStation.ts +++ b/src/charging-station/ChargingStation.ts @@ -993,10 +993,10 @@ export class ChargingStation extends EventEmitter { } /** - * Updates the supervision server URL and optionally the CSMS basic auth credentials in configuration or station info. - * @param url - The new supervision server URL - * @param supervisionUser - The new CSMS basic auth user (optional; "" clears, undefined preserves) - * @param supervisionPassword - The new CSMS basic auth password (optional; "" clears, undefined preserves) + * Updates the supervision server URL and optionally the CSMS basic auth credentials. + * @param url + * @param supervisionUser + * @param supervisionPassword */ public setSupervisionUrl ( url: string, @@ -1011,9 +1011,8 @@ export class ChargingStation extends EventEmitter { } else if (this.stationInfo != null) { this.stationInfo.supervisionUrls = url this.configuredSupervisionUrl = this.getConfiguredSupervisionUrl() - this.saveStationInfo() } - if (this.stationInfo != null && (supervisionUser != null || supervisionPassword != null)) { + if (this.stationInfo != null) { if (supervisionUser != null) { this.stationInfo.supervisionUser = supervisionUser } @@ -1576,9 +1575,6 @@ export class ChargingStation extends EventEmitter { checkEvsesConfiguration(stationTemplate, this.logPrefix(), this.templateFile) } const stationInfo = stationTemplateToStationInfo(stationTemplate) - // hashId and chargingStationId are intentionally not set here. They are derived - // at the end of getStationInfo() so that any identity overrides coming from - // ChargingStationOptions (baseName, fixedName, nameSuffix) are honoured. stationInfo.templateIndex = this.index stationInfo.templateName = buildTemplateName(this.templateFile) createSerialNumber(stationTemplate, stationInfo) diff --git a/src/charging-station/ui-server/mcp/MCPToolSchemas.ts b/src/charging-station/ui-server/mcp/MCPToolSchemas.ts index 703cabf4..30c91098 100644 --- a/src/charging-station/ui-server/mcp/MCPToolSchemas.ts +++ b/src/charging-station/ui-server/mcp/MCPToolSchemas.ts @@ -35,16 +35,18 @@ const chargingStationOptionsSchema = z.object({ baseName: z .string() .optional() - .describe('Override the template base name used to derive the chargingStationId'), + .describe('Override the template base name used to derive the charging station id'), enableStatistics: z.boolean().optional().describe('Enable charging station statistics'), fixedName: z .boolean() .optional() - .describe('Use baseName verbatim as chargingStationId instead of appending index/suffix'), + .describe('Use base name verbatim as charging station id instead of appending index/suffix'), nameSuffix: z .string() .optional() - .describe('Suffix appended to the derived chargingStationId (ignored when fixedName is true)'), + .describe( + 'Suffix appended to the derived charging station id (ignored when fixed name is true)' + ), ocppStrictCompliance: z .boolean() .optional() @@ -338,17 +340,17 @@ export const mcpToolSchemas = new Map([ ProcedureName.SET_SUPERVISION_URL, { description: - 'Set the OCPP server supervision URL for one or more charging stations. Optionally updates the CSMS basic auth credentials (empty string clears a credential, undefined preserves it).', + 'Set the OCPP server supervision URL and optionally the CSMS basic auth credentials for one or more charging stations', inputSchema: z.object({ hashIds, supervisionPassword: z .string() .optional() - .describe('CSMS basic auth password (empty string clears)'), + .describe('CSMS basic auth password used on the supervision WebSocket'), supervisionUser: z .string() .optional() - .describe('CSMS basic auth user (empty string clears)'), + .describe('CSMS basic auth user used on the supervision WebSocket'), url: z.url().describe('The OCPP server supervision URL to set'), }), }, diff --git a/ui/web/src/components/actions/AddChargingStations.vue b/ui/web/src/components/actions/AddChargingStations.vue index dbd968bc..8a7f3264 100644 --- a/ui/web/src/components/actions/AddChargingStations.vue +++ b/ui/web/src/components/actions/AddChargingStations.vue @@ -43,7 +43,7 @@ placeholder="