mirror of
https://github.com/meshtastic/web.git
synced 2026-03-13 03:16:38 -04:00
Config saving behaviour change
This commit is contained in:
@@ -15,7 +15,7 @@ import { classValidatorResolver } from "@hookform/resolvers/class-validator";
|
||||
import { Protobuf } from "@meshtastic/meshtasticjs";
|
||||
|
||||
export const Bluetooth = (): JSX.Element => {
|
||||
const { config, connection } = useDevice();
|
||||
const { config, connection, setConfig } = useDevice();
|
||||
|
||||
const {
|
||||
register,
|
||||
@@ -44,7 +44,14 @@ export const Bluetooth = (): JSX.Element => {
|
||||
}
|
||||
}
|
||||
})
|
||||
.then(() => reset({ ...data })),
|
||||
.then(() =>
|
||||
setConfig({
|
||||
payloadVariant: {
|
||||
oneofKind: "bluetooth",
|
||||
bluetooth: data
|
||||
}
|
||||
})
|
||||
),
|
||||
{
|
||||
loading: "Saving...",
|
||||
success: "Saved Bluetooth Config, Restarting Node",
|
||||
|
||||
@@ -15,7 +15,7 @@ import { classValidatorResolver } from "@hookform/resolvers/class-validator";
|
||||
import { Protobuf } from "@meshtastic/meshtasticjs";
|
||||
|
||||
export const Device = (): JSX.Element => {
|
||||
const { config, connection } = useDevice();
|
||||
const { config, connection, setConfig } = useDevice();
|
||||
const {
|
||||
register,
|
||||
handleSubmit,
|
||||
@@ -43,7 +43,14 @@ export const Device = (): JSX.Element => {
|
||||
}
|
||||
}
|
||||
})
|
||||
.then(() => reset({ ...data })),
|
||||
.then(() =>
|
||||
setConfig({
|
||||
payloadVariant: {
|
||||
oneofKind: "device",
|
||||
device: data
|
||||
}
|
||||
})
|
||||
),
|
||||
{
|
||||
loading: "Saving...",
|
||||
success: "Saved Device Config, Restarting Node",
|
||||
|
||||
@@ -15,7 +15,7 @@ import { classValidatorResolver } from "@hookform/resolvers/class-validator";
|
||||
import { Protobuf } from "@meshtastic/meshtasticjs";
|
||||
|
||||
export const Display = (): JSX.Element => {
|
||||
const { config, connection } = useDevice();
|
||||
const { config, connection, setConfig } = useDevice();
|
||||
const {
|
||||
register,
|
||||
handleSubmit,
|
||||
@@ -43,7 +43,14 @@ export const Display = (): JSX.Element => {
|
||||
}
|
||||
}
|
||||
})
|
||||
.then(() => reset({ ...data })),
|
||||
.then(() =>
|
||||
setConfig({
|
||||
payloadVariant: {
|
||||
oneofKind: "display",
|
||||
display: data
|
||||
}
|
||||
})
|
||||
),
|
||||
{
|
||||
loading: "Saving...",
|
||||
success: "Saved Display Config, Restarting Node",
|
||||
|
||||
@@ -16,7 +16,7 @@ import { classValidatorResolver } from "@hookform/resolvers/class-validator";
|
||||
import { Protobuf } from "@meshtastic/meshtasticjs";
|
||||
|
||||
export const LoRa = (): JSX.Element => {
|
||||
const { config, connection } = useDevice();
|
||||
const { config, connection, setConfig } = useDevice();
|
||||
|
||||
const {
|
||||
register,
|
||||
@@ -51,7 +51,14 @@ export const LoRa = (): JSX.Element => {
|
||||
}
|
||||
}
|
||||
})
|
||||
.then(() => reset({ ...data })),
|
||||
.then(() =>
|
||||
setConfig({
|
||||
payloadVariant: {
|
||||
oneofKind: "lora",
|
||||
lora: data
|
||||
}
|
||||
})
|
||||
),
|
||||
{
|
||||
loading: "Saving...",
|
||||
success: "Saved LoRa Config, Restarting Node",
|
||||
|
||||
@@ -17,7 +17,7 @@ import { classValidatorResolver } from "@hookform/resolvers/class-validator";
|
||||
import { Protobuf } from "@meshtastic/meshtasticjs";
|
||||
|
||||
export const Network = (): JSX.Element => {
|
||||
const { config, connection } = useDevice();
|
||||
const { config, connection, setConfig } = useDevice();
|
||||
const {
|
||||
register,
|
||||
handleSubmit,
|
||||
@@ -65,7 +65,14 @@ export const Network = (): JSX.Element => {
|
||||
}
|
||||
}
|
||||
})
|
||||
.then(() => reset({ ...data })),
|
||||
.then(() =>
|
||||
setConfig({
|
||||
payloadVariant: {
|
||||
oneofKind: "network",
|
||||
network: data
|
||||
}
|
||||
})
|
||||
),
|
||||
{
|
||||
loading: "Saving...",
|
||||
success: "Saved Network Config, Restarting Node",
|
||||
|
||||
@@ -15,7 +15,7 @@ import { classValidatorResolver } from "@hookform/resolvers/class-validator";
|
||||
import { Protobuf } from "@meshtastic/meshtasticjs";
|
||||
|
||||
export const Position = (): JSX.Element => {
|
||||
const { config, connection, nodes, hardware } = useDevice();
|
||||
const { config, connection, nodes, hardware, setConfig } = useDevice();
|
||||
|
||||
const myNode = nodes.find((n) => n.data.num === hardware.myNodeNum);
|
||||
|
||||
@@ -86,7 +86,14 @@ export const Position = (): JSX.Element => {
|
||||
}
|
||||
}
|
||||
})
|
||||
.then(() => reset({ ...data })),
|
||||
.then(() =>
|
||||
setConfig({
|
||||
payloadVariant: {
|
||||
oneofKind: "position",
|
||||
position: data
|
||||
}
|
||||
})
|
||||
),
|
||||
{
|
||||
loading: "Saving...",
|
||||
success: "Saved Position Config, Restarting Node",
|
||||
|
||||
@@ -13,7 +13,7 @@ import { useDevice } from "@core/providers/useDevice.js";
|
||||
import { classValidatorResolver } from "@hookform/resolvers/class-validator";
|
||||
|
||||
export const Power = (): JSX.Element => {
|
||||
const { config, connection } = useDevice();
|
||||
const { config, connection, setConfig } = useDevice();
|
||||
const {
|
||||
register,
|
||||
handleSubmit,
|
||||
@@ -41,7 +41,14 @@ export const Power = (): JSX.Element => {
|
||||
}
|
||||
}
|
||||
})
|
||||
.then(() => reset({ ...data })),
|
||||
.then(() =>
|
||||
setConfig({
|
||||
payloadVariant: {
|
||||
oneofKind: "power",
|
||||
power: data
|
||||
}
|
||||
})
|
||||
),
|
||||
{
|
||||
loading: "Saving...",
|
||||
success: "Saved Power Config, Restarting Node",
|
||||
|
||||
Reference in New Issue
Block a user