revert "remove node work" commit

This commit is contained in:
Hunter Thornsberry
2024-06-15 00:14:38 -04:00
parent 0b1e206702
commit bdc060d6ad
5 changed files with 93 additions and 9 deletions
+16 -1
View File
@@ -24,7 +24,8 @@ export type DialogVariant =
| "QR"
| "shutdown"
| "reboot"
| "deviceName";
| "deviceName"
| "nodeRemoval";
export interface Device {
id: number;
@@ -54,6 +55,7 @@ export interface Device {
shutdown: boolean;
reboot: boolean;
deviceName: boolean;
nodeRemoval: boolean;
};
setStatus: (status: Types.DeviceStatusEnum) => void;
@@ -74,6 +76,7 @@ export interface Device {
addConnection: (connection: Types.ConnectionType) => void;
addMessage: (message: MessageWithState) => void;
addMetadata: (from: number, metadata: Protobuf.Mesh.DeviceMetadata) => void;
removeNode: (nodeNum: number) => void;
setMessageState: (
type: "direct" | "broadcast",
channelIndex: Types.ChannelNumber,
@@ -130,6 +133,7 @@ export const useDeviceStore = create<DeviceState>((set, get) => ({
shutdown: false,
reboot: false,
deviceName: false,
nodeRemoval: false,
},
pendingSettingsChanges: false,
messageDraft: "",
@@ -494,6 +498,17 @@ export const useDeviceStore = create<DeviceState>((set, get) => ({
}),
);
},
removeNode: (nodeNum) => {
set(
produce<DeviceState>((draft) => {
const device = draft.devices.get(id);
if (!device) {
return;
}
device.nodes.delete(nodeNum);
})
)
},
setMessageState: (
type: "direct" | "broadcast",
channelIndex: Types.ChannelNumber,