adding button for clearing all of the scans, including ones that were replaced by new scans
This commit is contained in:
parent
efb3c9eb59
commit
14126fd7c5
4 changed files with 47 additions and 4 deletions
|
|
@ -149,6 +149,7 @@ export interface IDeviceAPIContext {
|
|||
keys?: string[],
|
||||
types?: string[]
|
||||
) => Promise<any>;
|
||||
removeAllFoundComponents: (id: number,otherTeam?: string) => Promise<AxiosResponse<pond.RemoveAllFoundComponentsResponse>>;
|
||||
removeFoundComponents: (id: number, key: string, type: pond.ObjectType, otherTeam?: string) => Promise<AxiosResponse<pond.RemoveFoundComponentsResponse>>;
|
||||
}
|
||||
|
||||
|
|
@ -990,7 +991,7 @@ export default function DeviceProvider(props: PropsWithChildren<Props>) {
|
|||
}
|
||||
|
||||
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<AxiosResponse<pond.RemoveFoundComponentsResponse>>((resolve, reject) => {
|
||||
|
|
@ -1002,6 +1003,19 @@ export default function DeviceProvider(props: PropsWithChildren<Props>) {
|
|||
})
|
||||
}
|
||||
|
||||
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<AxiosResponse<pond.RemoveAllFoundComponentsResponse>>((resolve, reject) => {
|
||||
del<pond.RemoveAllFoundComponentsResponse>(pondURL(url)).then(resp => {
|
||||
return resolve(resp)
|
||||
}).catch(err => {
|
||||
return reject(err)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
return (
|
||||
<DeviceAPIContext.Provider
|
||||
value={{
|
||||
|
|
@ -1051,7 +1065,8 @@ export default function DeviceProvider(props: PropsWithChildren<Props>) {
|
|||
detectI2C,
|
||||
detectOneWire,
|
||||
listFoundComponents,
|
||||
removeFoundComponents
|
||||
removeFoundComponents,
|
||||
removeAllFoundComponents
|
||||
}}>
|
||||
{children}
|
||||
</DeviceAPIContext.Provider>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue