changed test button to load scans
This commit is contained in:
parent
2c3ba2c1f5
commit
f5bc230fb6
3 changed files with 21 additions and 3 deletions
2
package-lock.json
generated
2
package-lock.json
generated
|
|
@ -10864,7 +10864,7 @@
|
|||
},
|
||||
"node_modules/protobuf-ts": {
|
||||
"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": {
|
||||
"protobufjs": "^6.8.8"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -390,6 +390,8 @@ export default function DevicePage() {
|
|||
refreshCallback={loadDevice}
|
||||
/>
|
||||
</Grid>
|
||||
{/* add grid card here for I2C detected components */}
|
||||
|
||||
{diagnosticComponents.map(comp => (
|
||||
<Grid size={{ xs: 12 }} key={comp.key()}>
|
||||
<ComponentDiagnostics
|
||||
|
|
@ -443,7 +445,8 @@ export default function DevicePage() {
|
|||
<DeviceActions
|
||||
device={device}
|
||||
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}
|
||||
isLoading={loading}
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue