had claude look at the bin player to determine how to take into account the component history for the top nodes
This commit is contained in:
parent
a4ed52db1e
commit
939a53d072
4 changed files with 135 additions and 6 deletions
|
|
@ -62,6 +62,14 @@ export interface IComponentAPIContext {
|
|||
keys?: string[],
|
||||
types?: string[]
|
||||
) => Promise<AxiosResponse<pond.ListComponentHistoryResponse>>;
|
||||
listHistoryBetween: (
|
||||
deviceId: string | number,
|
||||
componentKey: string,
|
||||
start: string,
|
||||
end: string,
|
||||
keys?: string[],
|
||||
types?: string[]
|
||||
) => Promise<AxiosResponse<pond.ListComponentHistoryBetweenResponse>>;
|
||||
// Old measuremnt structure functions, no longer used in codebase
|
||||
// listMeasurements: (
|
||||
// device: number,
|
||||
|
|
@ -391,6 +399,36 @@ export default function ComponentProvider(props: PropsWithChildren<Props>) {
|
|||
})
|
||||
};
|
||||
|
||||
const listHistoryBetween = (
|
||||
deviceId: string | number,
|
||||
componentKey: string,
|
||||
start: string,
|
||||
end: string,
|
||||
keys?: string[],
|
||||
types?: string[]
|
||||
) => {
|
||||
let url = pondURL(
|
||||
"/devices/" +
|
||||
deviceId +
|
||||
"/components/" +
|
||||
componentKey +
|
||||
"/historyBetween?start=" +
|
||||
start +
|
||||
"&end=" +
|
||||
end +
|
||||
(keys ? "&keys=" + keys : "&keys=" + [deviceId.toString()]) +
|
||||
(types ? "&types=" + types : "&types=" + ["device"])
|
||||
)
|
||||
return new Promise<AxiosResponse<pond.ListComponentHistoryBetweenResponse>>((resolve,reject) => {
|
||||
get<pond.ListComponentHistoryBetweenResponse>(url).then(resp => {
|
||||
resp.data = pond.ListComponentHistoryBetweenResponse.fromObject(resp.data)
|
||||
return resolve(resp)
|
||||
}).catch(err => {
|
||||
return reject(err)
|
||||
})
|
||||
})
|
||||
};
|
||||
|
||||
// const listMeasurements = (
|
||||
// device: number,
|
||||
// component: string,
|
||||
|
|
@ -596,6 +634,7 @@ export default function ComponentProvider(props: PropsWithChildren<Props>) {
|
|||
listForObject: listComponentsForObject,
|
||||
listComponentCardData: listComponentCardData,
|
||||
listHistory,
|
||||
listHistoryBetween,
|
||||
//listMeasurements: listMeasurements,
|
||||
//sampleMeasurements: sampleMeasurements,
|
||||
sampleUnitMeasurements,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue