Fix MQTT config
This commit is contained in:
@@ -25,7 +25,7 @@ export const MQTT = (): JSX.Element => {
|
|||||||
|
|
||||||
const moduleEnabled = useWatch({
|
const moduleEnabled = useWatch({
|
||||||
control,
|
control,
|
||||||
name: "disabled",
|
name: "enabled",
|
||||||
defaultValue: false,
|
defaultValue: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -54,11 +54,11 @@ export const MQTT = (): JSX.Element => {
|
|||||||
<FormField
|
<FormField
|
||||||
label="Module Disabled"
|
label="Module Disabled"
|
||||||
description="Description"
|
description="Description"
|
||||||
isInvalid={!!errors.disabled?.message}
|
isInvalid={!!errors.enabled?.message}
|
||||||
validationMessage={errors.disabled?.message}
|
validationMessage={errors.enabled?.message}
|
||||||
>
|
>
|
||||||
<Controller
|
<Controller
|
||||||
name="disabled"
|
name="enabled"
|
||||||
control={control}
|
control={control}
|
||||||
render={({ field: { value, ...field } }) => (
|
render={({ field: { value, ...field } }) => (
|
||||||
<Switch height={24} marginLeft="auto" checked={value} {...field} />
|
<Switch height={24} marginLeft="auto" checked={value} {...field} />
|
||||||
@@ -68,13 +68,13 @@ export const MQTT = (): JSX.Element => {
|
|||||||
<TextInputField
|
<TextInputField
|
||||||
label="MQTT Server Address"
|
label="MQTT Server Address"
|
||||||
description="Max transmit power in dBm"
|
description="Max transmit power in dBm"
|
||||||
disabled={moduleEnabled}
|
disabled={!moduleEnabled}
|
||||||
{...register("address")}
|
{...register("address")}
|
||||||
/>
|
/>
|
||||||
<TextInputField
|
<TextInputField
|
||||||
label="MQTT Username"
|
label="MQTT Username"
|
||||||
description="Max transmit power in dBm"
|
description="Max transmit power in dBm"
|
||||||
disabled={moduleEnabled}
|
disabled={!moduleEnabled}
|
||||||
{...register("username")}
|
{...register("username")}
|
||||||
/>
|
/>
|
||||||
<TextInputField
|
<TextInputField
|
||||||
@@ -82,13 +82,13 @@ export const MQTT = (): JSX.Element => {
|
|||||||
description="Max transmit power in dBm"
|
description="Max transmit power in dBm"
|
||||||
type="password"
|
type="password"
|
||||||
autoComplete="off"
|
autoComplete="off"
|
||||||
disabled={moduleEnabled}
|
disabled={!moduleEnabled}
|
||||||
{...register("password")}
|
{...register("password")}
|
||||||
/>
|
/>
|
||||||
<FormField
|
<FormField
|
||||||
label="Encryption Enabled"
|
label="Encryption Enabled"
|
||||||
description="Description"
|
description="Description"
|
||||||
disabled={moduleEnabled}
|
disabled={!moduleEnabled}
|
||||||
isInvalid={!!errors.encryptionEnabled?.message}
|
isInvalid={!!errors.encryptionEnabled?.message}
|
||||||
validationMessage={errors.encryptionEnabled?.message}
|
validationMessage={errors.encryptionEnabled?.message}
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import type { Protobuf } from "@meshtastic/meshtasticjs";
|
|||||||
|
|
||||||
export class MQTTValidation implements Protobuf.ModuleConfig_MQTTConfig {
|
export class MQTTValidation implements Protobuf.ModuleConfig_MQTTConfig {
|
||||||
@IsBoolean()
|
@IsBoolean()
|
||||||
disabled: boolean;
|
enabled: boolean;
|
||||||
|
|
||||||
@Length(0, 30)
|
@Length(0, 30)
|
||||||
address: string;
|
address: string;
|
||||||
|
|||||||
Reference in New Issue
Block a user