now passing the type to the remove function for scans

This commit is contained in:
csawatzky 2025-11-04 12:27:10 -06:00
parent 487c8617e4
commit 10308942ac
2 changed files with 6 additions and 6 deletions

View file

@ -207,8 +207,8 @@ export default function DeviceScannedComponents(props: Props){
setComponents(cloneList)
}
const removeScan = (key: string) => {
deviceAPI.removeFoundComponents(device.settings.deviceId, key)
const removeScan = (key: string, type: pond.ObjectType) => {
deviceAPI.removeFoundComponents(device.settings.deviceId, key, type)
.then(resp => {
console.log("Cleared this scan")
}).catch(err => {
@ -227,7 +227,7 @@ export default function DeviceScannedComponents(props: Props){
<Typography sx={{fontWeight: 650}}>
I2C Sensors
</Typography>
<Button variant="contained" color="primary" onClick={()=>{removeScan(scannedI2C.key)}}>Clear Scan</Button>
<Button variant="contained" color="primary" onClick={()=>{removeScan(scannedI2C.key, pond.ObjectType.OBJECT_TYPE_DETECT_I2C)}}>Clear Scan</Button>
</Box>
{validI2CCompAddresses.length > 0 ? validI2CCompAddresses.map((addr, index) => {
return (
@ -269,7 +269,7 @@ export default function DeviceScannedComponents(props: Props){
<Box display="flex" justifyContent="space-between" alignItems={"center"}>
<Typography>Port: {portLabel}</Typography>
<Button variant="contained" color="primary" onClick={()=>{
removeScan(scan.key)
removeScan(scan.key, pond.ObjectType.OBJECT_TYPE_DETECT_ONEWIRE)
}}>Clear Port Scan</Button>
</Box>
<ScannedOneWirePort scan={scan} componentSelectionCallback={componentSelection}/>

View file

@ -149,7 +149,7 @@ export interface IDeviceAPIContext {
keys?: string[],
types?: string[]
) => Promise<any>;
removeFoundComponents: (id: number, key: string, otherTeam?: string) => Promise<AxiosResponse<pond.RemoveFoundComponentsResponse>>;
removeFoundComponents: (id: number, key: string, type: pond.ObjectType, otherTeam?: string) => Promise<AxiosResponse<pond.RemoveFoundComponentsResponse>>;
}
export const DeviceAPIContext = createContext<IDeviceAPIContext>({} as IDeviceAPIContext);
@ -989,7 +989,7 @@ export default function DeviceProvider(props: PropsWithChildren<Props>) {
})
}
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