diff --git a/ui-ngx/src/app/modules/home/components/iot-hub/device-install-dialog/device-install-dialog.component.ts b/ui-ngx/src/app/modules/home/components/iot-hub/device-install-dialog/device-install-dialog.component.ts index ca38fa383c..e1cacc2660 100644 --- a/ui-ngx/src/app/modules/home/components/iot-hub/device-install-dialog/device-install-dialog.component.ts +++ b/ui-ngx/src/app/modules/home/components/iot-hub/device-install-dialog/device-install-dialog.component.ts @@ -80,12 +80,43 @@ const TRANSPORT_PORT_FIELD_KEY = 'tbTransportPort'; // Not the translated label, so review mode finds the values in any UI language const TRANSPORT_STEP_STATE_KEY = 'tbTransportConnection'; -// Install methods whose packages get a transport host field, and the transport whose -// ${.host} it fills. Other methods use the host differently (a ChirpStack package -// builds the ThingsBoard URL from it, a gateway puts it into docker-compose) and keep the -// resolved value until they are handled separately. -const HOST_FIELD_TRANSPORTS = new Map([ - [InstallMethod.DIRECT_MQTT, 'mqtt'] +/** + * A transport whose ${.host} / ${.port} the install form lets the user check, + * with the translation keys of its fields. The wording is per transport (the label, the hints and + * the help popup name the protocol and its default port), so each entry brings its own keys. + */ +interface HostFieldTransport { + protocol: string; + hostLabel: string; + portLabel: string; + // Host taken from the address ThingsBoard was opened with / from the Base URL in General settings + requestHostHint: string; + baseUrlHostHint: string; + // Host resolved to a loopback address: via the request, via the Base URL, or from an unknown source + requestLoopbackHint: string; + baseUrlLoopbackHint: string; + loopbackHint: string; + // Review mode: the stored value is shown without its source + reviewHostHint: string; + helpPopupId: string; +} + +// Install methods whose packages get the transport fields. Other methods use the host differently +// (a ChirpStack package builds the ThingsBoard URL from it, a gateway puts it into docker-compose) +// and keep the resolved value until they are handled separately. +const HOST_FIELD_TRANSPORTS = new Map([ + [InstallMethod.DIRECT_MQTT, { + protocol: 'mqtt', + hostLabel: 'iot-hub.device-install-mqtt-host', + portLabel: 'iot-hub.device-install-mqtt-port', + requestHostHint: 'iot-hub.device-install-mqtt-host-request-hint', + baseUrlHostHint: 'iot-hub.device-install-mqtt-host-base-url-hint', + requestLoopbackHint: 'iot-hub.device-install-mqtt-host-opened-via-loopback-hint', + baseUrlLoopbackHint: 'iot-hub.device-install-mqtt-host-base-url-loopback-hint', + loopbackHint: 'iot-hub.device-install-mqtt-host-loopback-hint', + reviewHostHint: 'iot-hub.device-install-mqtt-host-hint', + helpPopupId: 'iot-hub/device-connection-host' + }] ]); /** @@ -777,7 +808,8 @@ export class TbDeviceInstallDialogComponent extends DialogComponent