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

2
package-lock.json generated
View file

@ -10864,7 +10864,7 @@
}, },
"node_modules/protobuf-ts": { "node_modules/protobuf-ts": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "git+https://gitlab+deploy-token-50627:hv8mB4WkyvtjBpJKU1rN@gitlab.com/brandx/protobuf-ts.git#b7bf189d71066fd840b9a34e06c29134fdd7f00b", "resolved": "git+https://gitlab+deploy-token-50627:hv8mB4WkyvtjBpJKU1rN@gitlab.com/brandx/protobuf-ts.git#a565b6b7382543f1b71ed6f55ff213ccf2d41c5b",
"dependencies": { "dependencies": {
"protobufjs": "^6.8.8" "protobufjs": "^6.8.8"
} }

View file

@ -390,6 +390,8 @@ export default function DevicePage() {
refreshCallback={loadDevice} refreshCallback={loadDevice}
/> />
</Grid> </Grid>
{/* add grid card here for I2C detected components */}
{diagnosticComponents.map(comp => ( {diagnosticComponents.map(comp => (
<Grid size={{ xs: 12 }} key={comp.key()}> <Grid size={{ xs: 12 }} key={comp.key()}>
<ComponentDiagnostics <ComponentDiagnostics
@ -443,7 +445,8 @@ export default function DevicePage() {
<DeviceActions <DeviceActions
device={device} device={device}
scanFunction={() => { scanFunction={() => {
deviceAPI.detectI2C(device.id()).then(resp => {console.log("No errors")}).catch(err => {console.log("error")}) //deviceAPI.detectI2C(device.id()).then(resp => {console.log("No errors")}).catch(err => {console.log("error")})
deviceAPI.listFoundComponents(device.id()).then(resp => console.log(resp)).catch(err => {console.log("errors")})
}} }}
isPaused={false} isPaused={false}
isLoading={loading} isLoading={loading}

View file

@ -23,6 +23,7 @@ export interface IDeviceAPIContext {
) => Promise<AxiosResponse<pond.GetDevicePageDataResponse>>; ) => Promise<AxiosResponse<pond.GetDevicePageDataResponse>>;
getMulti: (ids: number[] | string[], otherTeam?: string) => Promise<AxiosResponse<pond.GetMultiDeviceResponse>>; getMulti: (ids: number[] | string[], otherTeam?: string) => Promise<AxiosResponse<pond.GetMultiDeviceResponse>>;
detectI2C: (id: number, otherTeam?: string) => Promise<AxiosResponse<pond.DetectI2CResponse>>; 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>; getGeoJson: (id: number | string, demo?: boolean, otherTeam?: string) => Promise<any>;
getMultiGeoJson: (ids: number[] | string[], otherTeam?: string) => Promise<any>; getMultiGeoJson: (ids: number[] | string[], otherTeam?: string) => Promise<any>;
list: ( 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 ( return (
<DeviceAPIContext.Provider <DeviceAPIContext.Provider
value={{ value={{
@ -1006,7 +1020,8 @@ export default function DeviceProvider(props: PropsWithChildren<Props>) {
buyData, buyData,
updateComponentPreferences, updateComponentPreferences,
listDeviceComponentPreferences, listDeviceComponentPreferences,
detectI2C detectI2C,
listFoundComponents
}}> }}>
{children} {children}
</DeviceAPIContext.Provider> </DeviceAPIContext.Provider>