From 487c8617e4fe2ba2d514a2f76c3264a18cfb8600 Mon Sep 17 00:00:00 2001 From: csawatzky Date: Mon, 3 Nov 2025 16:41:26 -0600 Subject: [PATCH 1/5] first iteration of basic layout --- src/device/DeviceWizard.tsx | 4 +- .../autoDetect/DeviceScannedComponents.tsx | 10 +-- .../autoDetect/OneWire/PortComponent.tsx | 89 ++++++++++++++++--- .../autoDetect/OneWire/ScannedOneWirePort.tsx | 9 +- src/pages/Device.tsx | 11 ++- 5 files changed, 100 insertions(+), 23 deletions(-) diff --git a/src/device/DeviceWizard.tsx b/src/device/DeviceWizard.tsx index 6c8f361..cf0a061 100644 --- a/src/device/DeviceWizard.tsx +++ b/src/device/DeviceWizard.tsx @@ -142,8 +142,8 @@ export default function DeviceWizard(props: Props) { )} {selectedPort && - // selectedPort.addressType === quack.AddressType.ADDRESS_TYPE_CONFIGURABLE_PIN_ARRAY && - // device.featureSupported("detectOneWire") && + selectedPort.addressType === quack.AddressType.ADDRESS_TYPE_CONFIGURABLE_PIN_ARRAY && + device.featureSupported("detectOneWire") && selectedPort.autoDetectable && ( {scannedI2C !== undefined && - + I2C Sensors @@ -244,10 +244,10 @@ export default function DeviceScannedComponents(props: Props){ } - + } {scannedOneWire.length > 0 && - + Pin Port Sensors @@ -265,8 +265,8 @@ export default function DeviceScannedComponents(props: Props){ } }) return( - - + + Port: {portLabel} + {validI2CCompAddresses.length > 0 ? validI2CCompAddresses.map((addr, index) => { return ( @@ -269,7 +269,7 @@ export default function DeviceScannedComponents(props: Props){ Port: {portLabel} diff --git a/src/providers/pond/deviceAPI.tsx b/src/providers/pond/deviceAPI.tsx index f967774..56a0c0f 100644 --- a/src/providers/pond/deviceAPI.tsx +++ b/src/providers/pond/deviceAPI.tsx @@ -149,7 +149,7 @@ export interface IDeviceAPIContext { keys?: string[], types?: string[] ) => Promise; - removeFoundComponents: (id: number, key: string, otherTeam?: string) => Promise>; + removeFoundComponents: (id: number, key: string, type: pond.ObjectType, otherTeam?: string) => Promise>; } export const DeviceAPIContext = createContext({} as IDeviceAPIContext); @@ -989,7 +989,7 @@ export default function DeviceProvider(props: PropsWithChildren) { }) } - const removeFoundComponents = (id: number, key: string, otherTeam?: string) => { + const removeFoundComponents = (id: number, key: string, type: pond.ObjectType, otherTeam?: string) => { let url = "/devices/" + id + "/removeFoundComponents/" + key; const view = otherTeam ? otherTeam : as if(view) url = url + "?as=" + view From 8dcc0405581c9d359a5be695bbc8a88df39b6ca9 Mon Sep 17 00:00:00 2001 From: csawatzky Date: Tue, 4 Nov 2025 12:28:21 -0600 Subject: [PATCH 3/5] fixing the url for the api call --- src/providers/pond/deviceAPI.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/providers/pond/deviceAPI.tsx b/src/providers/pond/deviceAPI.tsx index 56a0c0f..391caf7 100644 --- a/src/providers/pond/deviceAPI.tsx +++ b/src/providers/pond/deviceAPI.tsx @@ -990,9 +990,9 @@ export default function DeviceProvider(props: PropsWithChildren) { } const removeFoundComponents = (id: number, key: string, type: pond.ObjectType, otherTeam?: string) => { - let url = "/devices/" + id + "/removeFoundComponents/" + key; + let url = "/devices/" + id + "/removeFoundComponents/" + key + "?type=" + type; const view = otherTeam ? otherTeam : as - if(view) url = url + "?as=" + view + if(view) url = url + "&as=" + view return new Promise>((resolve, reject) => { del(pondURL(url)).then(resp => { return resolve(resp) From efb3c9eb59d5413de77f7b366dc95bbd6a9fa91b Mon Sep 17 00:00:00 2001 From: csawatzky Date: Tue, 4 Nov 2025 12:29:08 -0600 Subject: [PATCH 4/5] use scanType instead of type --- src/providers/pond/deviceAPI.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/providers/pond/deviceAPI.tsx b/src/providers/pond/deviceAPI.tsx index 391caf7..4a90b85 100644 --- a/src/providers/pond/deviceAPI.tsx +++ b/src/providers/pond/deviceAPI.tsx @@ -990,7 +990,7 @@ export default function DeviceProvider(props: PropsWithChildren) { } const removeFoundComponents = (id: number, key: string, type: pond.ObjectType, otherTeam?: string) => { - let url = "/devices/" + id + "/removeFoundComponents/" + key + "?type=" + type; + let url = "/devices/" + id + "/removeFoundComponents/" + key + "?scanType=" + type; const view = otherTeam ? otherTeam : as if(view) url = url + "&as=" + view return new Promise>((resolve, reject) => { From 14126fd7c5e60b41562d5cfbe57ada0a00f9138f Mon Sep 17 00:00:00 2001 From: csawatzky Date: Tue, 4 Nov 2025 14:16:40 -0600 Subject: [PATCH 5/5] adding button for clearing all of the scans, including ones that were replaced by new scans --- package-lock.json | 2 +- .../autoDetect/DeviceScannedComponents.tsx | 28 +++++++++++++++++++ src/pages/Device.tsx | 2 +- src/providers/pond/deviceAPI.tsx | 19 +++++++++++-- 4 files changed, 47 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index f60c304..1bef6b0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10953,7 +10953,7 @@ }, "node_modules/protobuf-ts": { "version": "1.0.0", - "resolved": "git+https://gitlab+deploy-token-50627:hv8mB4WkyvtjBpJKU1rN@gitlab.com/brandx/protobuf-ts.git#9dcc83dddad31d4a4d8a002ec31475cbb83f0689", + "resolved": "git+https://gitlab+deploy-token-50627:hv8mB4WkyvtjBpJKU1rN@gitlab.com/brandx/protobuf-ts.git#910e6c4dd322a52a7f0c82d5bde650d8ccfff548", "dependencies": { "protobufjs": "^6.8.8" } diff --git a/src/device/autoDetect/DeviceScannedComponents.tsx b/src/device/autoDetect/DeviceScannedComponents.tsx index 3448b86..cda95ae 100644 --- a/src/device/autoDetect/DeviceScannedComponents.tsx +++ b/src/device/autoDetect/DeviceScannedComponents.tsx @@ -41,6 +41,7 @@ export default function DeviceScannedComponents(props: Props){ const [currentStep, setCurrentStep] = useState(0) const [settingsValid, setSettingsValid] = useState(false); const [openDialog, setOpenDialog] = useState(false); + const [clearOpen, setClearOpen] = useState(false); useEffect(()=>{ if (scannedComponents.i2c) setScannedI2C(scannedComponents.i2c) @@ -216,11 +217,38 @@ export default function DeviceScannedComponents(props: Props){ }) } + const removeAllScans = () => { + deviceAPI.removeAllFoundComponents(device.settings.deviceId) + .then(resp => { + console.log("Cleared all scans") + }).catch(err => { + console.log("There was a problem clearing scans") + }) + } + + const clearWarning = () => { + return ( + {setClearOpen(false)}}> + Clear All Scans + This action will clear all scans for this device. + + + + + + ) + } + return ( + {clearWarning()} + + Sensor Scan + + {scannedI2C !== undefined && diff --git a/src/pages/Device.tsx b/src/pages/Device.tsx index 0a4e89a..7344659 100644 --- a/src/pages/Device.tsx +++ b/src/pages/Device.tsx @@ -170,7 +170,7 @@ export default function DevicePage() { deviceAPI.listFoundComponents(parseInt(deviceID)) .then(resp => { console.log(resp.data) - if (resp.data.foundComponents){ + if (resp.data.foundComponents?.i2c || resp.data.foundComponents?.oneWire){ setScannedAddresses(pond.ListFoundComponentsResponse.fromObject(resp.data).foundComponents ?? undefined) } }) diff --git a/src/providers/pond/deviceAPI.tsx b/src/providers/pond/deviceAPI.tsx index 4a90b85..241781b 100644 --- a/src/providers/pond/deviceAPI.tsx +++ b/src/providers/pond/deviceAPI.tsx @@ -149,6 +149,7 @@ export interface IDeviceAPIContext { keys?: string[], types?: string[] ) => Promise; + removeAllFoundComponents: (id: number,otherTeam?: string) => Promise>; removeFoundComponents: (id: number, key: string, type: pond.ObjectType, otherTeam?: string) => Promise>; } @@ -990,7 +991,7 @@ export default function DeviceProvider(props: PropsWithChildren) { } const removeFoundComponents = (id: number, key: string, type: pond.ObjectType, otherTeam?: string) => { - let url = "/devices/" + id + "/removeFoundComponents/" + key + "?scanType=" + type; + let url = "/devices/" + id + "/removeFoundComponents/" + key + "?scanType=" + type; const view = otherTeam ? otherTeam : as if(view) url = url + "&as=" + view return new Promise>((resolve, reject) => { @@ -1002,6 +1003,19 @@ export default function DeviceProvider(props: PropsWithChildren) { }) } + const removeAllFoundComponents = (id: number, otherTeam?: string) => { + let url = "/devices/" + id + "/removeAllFoundComponents"; + const view = otherTeam ? otherTeam : as + if(view) url = url + "?as=" + view + return new Promise>((resolve, reject) => { + del(pondURL(url)).then(resp => { + return resolve(resp) + }).catch(err => { + return reject(err) + }) + }) + } + return ( ) { detectI2C, detectOneWire, listFoundComponents, - removeFoundComponents + removeFoundComponents, + removeAllFoundComponents }}> {children}