changed test button to load scans

This commit is contained in:
csawatzky 2025-06-24 11:01:37 -06:00
parent 2c3ba2c1f5
commit f5bc230fb6
3 changed files with 21 additions and 3 deletions

View file

@ -23,6 +23,7 @@ export interface IDeviceAPIContext {
) => Promise<AxiosResponse<pond.GetDevicePageDataResponse>>;
getMulti: (ids: number[] | string[], otherTeam?: string) => Promise<AxiosResponse<pond.GetMultiDeviceResponse>>;
detectI2C: (id: number, otherTeam?: string) => Promise<AxiosResponse<pond.DetectI2CResponse>>;
listFoundComponents: (is: number, otherTeam?: string) => Promise<AxiosResponse<pond.ListFoundComponentsResponse>>
getGeoJson: (id: number | string, demo?: boolean, otherTeam?: string) => Promise<any>;
getMultiGeoJson: (ids: number[] | string[], otherTeam?: string) => Promise<any>;
list: (
@ -960,6 +961,19 @@ export default function DeviceProvider(props: PropsWithChildren<Props>) {
})
}
const listFoundComponents = (id: number, otherTeam?: string) => {
let url = "/devices/" + id + "/listScannedComponents";
const view = otherTeam ? otherTeam : as
if(view) url = url + "?as=" + view
return new Promise<AxiosResponse<pond.ListFoundComponentsResponse>>((resolve, reject) => {
get<pond.ListFoundComponentsResponse>(pondURL(url)).then(resp => {
return resolve(resp)
}).catch(err => {
return reject(err)
})
})
}
return (
<DeviceAPIContext.Provider
value={{
@ -1006,7 +1020,8 @@ export default function DeviceProvider(props: PropsWithChildren<Props>) {
buyData,
updateComponentPreferences,
listDeviceComponentPreferences,
detectI2C
detectI2C,
listFoundComponents
}}>
{children}
</DeviceAPIContext.Provider>