This commit is contained in:
sawka
2024-08-19 15:01:00 -07:00
parent 0d8c159101
commit 00958b8fed
6 changed files with 41 additions and 20 deletions
+6 -1
View File
@@ -102,6 +102,11 @@ class WshServerType {
return WOS.wshServerRpcHelper_call("remotefileinfo", data, opts);
}
// command "remotestreamcpudata" [responsestream]
RemoteStreamCpuDataCommand(opts?: RpcOpts): AsyncGenerator<TimeSeriesData, void, boolean> {
return WOS.wshServerRpcHelper_responsestream("remotestreamcpudata", null, opts);
}
// command "remotestreamfile" [responsestream]
RemoteStreamFileCommand(data: CommandRemoteStreamFileData, opts?: RpcOpts): AsyncGenerator<CommandRemoteStreamFileRtnData, void, boolean> {
return WOS.wshServerRpcHelper_responsestream("remotestreamfile", data, opts);
@@ -128,7 +133,7 @@ class WshServerType {
}
// command "streamcpudata" [responsestream]
StreamCpuDataCommand(data: CpuDataRequest, opts?: RpcOpts): AsyncGenerator<CpuDataType, void, boolean> {
StreamCpuDataCommand(data: CpuDataRequest, opts?: RpcOpts): AsyncGenerator<TimeSeriesData, void, boolean> {
return WOS.wshServerRpcHelper_responsestream("streamcpudata", data, opts);
}
+3 -2
View File
@@ -14,7 +14,7 @@ import * as React from "react";
import "./cpuplot.less";
type Point = {
time: number;
time: number; // note this is in seconds not milliseconds
value: number;
};
@@ -89,7 +89,8 @@ function CpuPlotView({ model }: { model: CpuPlotViewModel }) {
);
try {
for await (const datum of dataGen) {
addPlotData(datum);
const ts = datum.ts;
addPlotData({ time: ts / 1000, value: datum.values?.["cpu"] });
}
} catch (e) {
console.log(e);
+6 -6
View File
@@ -158,12 +158,6 @@ declare global {
count: number;
};
// wshrpc.CpuDataType
type CpuDataType = {
time: number;
value: number;
};
// wstore.FileDef
type FileDef = {
filetype?: string;
@@ -437,6 +431,12 @@ declare global {
disablewebgl: boolean;
};
// wshrpc.TimeSeriesData
type TimeSeriesData = {
ts: number;
values: {[key: string]: number};
};
// wstore.UIContext
type UIContext = {
windowid: string;