now passing the type to the remove function for scans
This commit is contained in:
parent
487c8617e4
commit
10308942ac
2 changed files with 6 additions and 6 deletions
|
|
@ -207,8 +207,8 @@ export default function DeviceScannedComponents(props: Props){
|
||||||
setComponents(cloneList)
|
setComponents(cloneList)
|
||||||
}
|
}
|
||||||
|
|
||||||
const removeScan = (key: string) => {
|
const removeScan = (key: string, type: pond.ObjectType) => {
|
||||||
deviceAPI.removeFoundComponents(device.settings.deviceId, key)
|
deviceAPI.removeFoundComponents(device.settings.deviceId, key, type)
|
||||||
.then(resp => {
|
.then(resp => {
|
||||||
console.log("Cleared this scan")
|
console.log("Cleared this scan")
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
|
|
@ -227,7 +227,7 @@ export default function DeviceScannedComponents(props: Props){
|
||||||
<Typography sx={{fontWeight: 650}}>
|
<Typography sx={{fontWeight: 650}}>
|
||||||
I2C Sensors
|
I2C Sensors
|
||||||
</Typography>
|
</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>
|
</Box>
|
||||||
{validI2CCompAddresses.length > 0 ? validI2CCompAddresses.map((addr, index) => {
|
{validI2CCompAddresses.length > 0 ? validI2CCompAddresses.map((addr, index) => {
|
||||||
return (
|
return (
|
||||||
|
|
@ -269,7 +269,7 @@ export default function DeviceScannedComponents(props: Props){
|
||||||
<Box display="flex" justifyContent="space-between" alignItems={"center"}>
|
<Box display="flex" justifyContent="space-between" alignItems={"center"}>
|
||||||
<Typography>Port: {portLabel}</Typography>
|
<Typography>Port: {portLabel}</Typography>
|
||||||
<Button variant="contained" color="primary" onClick={()=>{
|
<Button variant="contained" color="primary" onClick={()=>{
|
||||||
removeScan(scan.key)
|
removeScan(scan.key, pond.ObjectType.OBJECT_TYPE_DETECT_ONEWIRE)
|
||||||
}}>Clear Port Scan</Button>
|
}}>Clear Port Scan</Button>
|
||||||
</Box>
|
</Box>
|
||||||
<ScannedOneWirePort scan={scan} componentSelectionCallback={componentSelection}/>
|
<ScannedOneWirePort scan={scan} componentSelectionCallback={componentSelection}/>
|
||||||
|
|
|
||||||
|
|
@ -149,7 +149,7 @@ export interface IDeviceAPIContext {
|
||||||
keys?: string[],
|
keys?: string[],
|
||||||
types?: string[]
|
types?: string[]
|
||||||
) => Promise<any>;
|
) => 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);
|
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;
|
let url = "/devices/" + id + "/removeFoundComponents/" + key;
|
||||||
const view = otherTeam ? otherTeam : as
|
const view = otherTeam ? otherTeam : as
|
||||||
if(view) url = url + "?as=" + view
|
if(view) url = url + "?as=" + view
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue