+
+ {yvals.map((yval, idx) => {
+ return (
+
+ );
+ })}
+
+
+ );
+});
+
+export { makeSysinfoViewModel, SysinfoView, SysinfoViewModel };
diff --git a/frontend/types/custom.d.ts b/frontend/types/custom.d.ts
index eee4dae5c..a33feb5fb 100644
--- a/frontend/types/custom.d.ts
+++ b/frontend/types/custom.d.ts
@@ -332,6 +332,15 @@ declare global {
command: string;
msgFn: (msg: RpcMessage) => void;
};
+
+ type TimeSeriesMeta = {
+ name?: string;
+ color?: string;
+ label?: string;
+ maxy?: string | number;
+ miny?: string | number;
+ decimalPlaces?: number;
+ };
}
export {};
diff --git a/frontend/types/gotypes.d.ts b/frontend/types/gotypes.d.ts
index a3e6eba1b..fcbe84680 100644
--- a/frontend/types/gotypes.d.ts
+++ b/frontend/types/gotypes.d.ts
@@ -306,6 +306,7 @@ declare global {
"graph:*"?: boolean;
"graph:numpoints"?: number;
"graph:metrics"?: string[];
+ "sysinfo:type"?: string;
"bg:*"?: boolean;
bg?: string;
"bg:opacity"?: number;
diff --git a/pkg/waveobj/metaconsts.go b/pkg/waveobj/metaconsts.go
index 41fdce4dd..e904c3def 100644
--- a/pkg/waveobj/metaconsts.go
+++ b/pkg/waveobj/metaconsts.go
@@ -64,6 +64,8 @@ const (
MetaKey_GraphNumPoints = "graph:numpoints"
MetaKey_GraphMetrics = "graph:metrics"
+ MetaKey_SysinfoType = "sysinfo:type"
+
MetaKey_BgClear = "bg:*"
MetaKey_Bg = "bg"
MetaKey_BgOpacity = "bg:opacity"
diff --git a/pkg/waveobj/wtypemeta.go b/pkg/waveobj/wtypemeta.go
index 2b52e897a..93c1919f0 100644
--- a/pkg/waveobj/wtypemeta.go
+++ b/pkg/waveobj/wtypemeta.go
@@ -64,6 +64,8 @@ type MetaTSType struct {
GraphNumPoints int `json:"graph:numpoints,omitempty"`
GraphMetrics []string `json:"graph:metrics,omitempty"`
+ SysinfoType string `json:"sysinfo:type,omitempty"`
+
// for tabs
BgClear bool `json:"bg:*,omitempty"`
Bg string `json:"bg,omitempty"`
diff --git a/pkg/wconfig/defaultconfig/defaultwidgets.json b/pkg/wconfig/defaultconfig/defaultwidgets.json
index 5711e1f7b..b59e5c59a 100644
--- a/pkg/wconfig/defaultconfig/defaultwidgets.json
+++ b/pkg/wconfig/defaultconfig/defaultwidgets.json
@@ -41,13 +41,13 @@
}
}
},
- "defwidget@cpuplot": {
+ "defwidget@sysinfo": {
"display:order": 5,
"icon": "chart-line",
- "label": "cpu",
+ "label": "sysinfo",
"blockdef": {
"meta": {
- "view": "cpuplot"
+ "view": "sysinfo"
}
}
}
diff --git a/pkg/wlayout/wlayout.go b/pkg/wlayout/wlayout.go
index 3f8bfdbd1..96885d17b 100644
--- a/pkg/wlayout/wlayout.go
+++ b/pkg/wlayout/wlayout.go
@@ -38,7 +38,7 @@ func GetStarterLayout() PortableLayout {
}, Focused: true},
{IndexArr: []int{1}, BlockDef: &waveobj.BlockDef{
Meta: waveobj.MetaMapType{
- waveobj.MetaKey_View: "cpuplot",
+ waveobj.MetaKey_View: "sysinfo",
},
}},
{IndexArr: []int{1, 1}, BlockDef: &waveobj.BlockDef{
diff --git a/pkg/wshrpc/wshremote/sysinfo.go b/pkg/wshrpc/wshremote/sysinfo.go
index eba8290fb..045e5b5d1 100644
--- a/pkg/wshrpc/wshremote/sysinfo.go
+++ b/pkg/wshrpc/wshremote/sysinfo.go
@@ -16,6 +16,8 @@ import (
"github.com/wavetermdev/waveterm/pkg/wshutil"
)
+const BYTES_PER_GB = 1073741824
+
func getCpuData(values map[string]float64) {
percentArr, err := cpu.Percent(0, false)
if err != nil {
@@ -38,10 +40,10 @@ func getMemData(values map[string]float64) {
if err != nil {
return
}
- values["mem:total"] = float64(memData.Total)
- values["mem:available"] = float64(memData.Available)
- values["mem:used"] = float64(memData.Used)
- values["mem:free"] = float64(memData.Free)
+ values["mem:total"] = float64(memData.Total) / BYTES_PER_GB
+ values["mem:available"] = float64(memData.Available) / BYTES_PER_GB
+ values["mem:used"] = float64(memData.Used) / BYTES_PER_GB
+ values["mem:free"] = float64(memData.Free) / BYTES_PER_GB
}
func generateSingleServerData(client *wshutil.WshRpc, connName string) {
diff --git a/pkg/wshrpc/wshserver/wshserver.go b/pkg/wshrpc/wshserver/wshserver.go
index baed1bd3e..fe093250f 100644
--- a/pkg/wshrpc/wshserver/wshserver.go
+++ b/pkg/wshrpc/wshserver/wshserver.go
@@ -83,7 +83,7 @@ func MakePlotData(ctx context.Context, blockId string) error {
return err
}
viewName := block.Meta.GetString(waveobj.MetaKey_View, "")
- if viewName != "cpuplot" {
+ if viewName != "cpuplot" && viewName != "sysinfo" {
return fmt.Errorf("invalid view type: %s", viewName)
}
return filestore.WFS.MakeFile(ctx, blockId, "cpuplotdata", nil, filestore.FileOptsType{})
@@ -95,7 +95,7 @@ func SavePlotData(ctx context.Context, blockId string, history string) error {
return err
}
viewName := block.Meta.GetString(waveobj.MetaKey_View, "")
- if viewName != "cpuplot" {
+ if viewName != "cpuplot" && viewName != "sysinfo" {
return fmt.Errorf("invalid view type: %s", viewName)
}
// todo: interpret the data being passed