Skip to content

Commit

Permalink
Plot Sysinfo (#1054)
Browse files Browse the repository at this point in the history
Expands the cpuplot with memory plots and individual cpu plots. Also
improves the styling and handling of multiple plots.
  • Loading branch information
oneirocosm authored Oct 17, 2024
1 parent fae0660 commit a5999aa
Show file tree
Hide file tree
Showing 14 changed files with 571 additions and 326 deletions.
12 changes: 7 additions & 5 deletions frontend/app/block/block.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import { BlockComponentModel2, BlockProps } from "@/app/block/blocktypes";
import { PlotView } from "@/app/view/plotview/plotview";
import { PreviewModel, PreviewView, makePreviewModel } from "@/app/view/preview/preview";
import { SysinfoView, SysinfoViewModel, makeSysinfoViewModel } from "@/app/view/sysinfo/sysinfo";
import { ErrorBoundary } from "@/element/errorboundary";
import { CenteredDiv } from "@/element/quickelems";
import { NodeModel, useDebouncedNodeInnerRect } from "@/layout/index";
Expand All @@ -16,7 +17,6 @@ import {
import { getWaveObjectAtom, makeORef, useWaveObjectValue } from "@/store/wos";
import { focusedBlockId, getElemAsStr } from "@/util/focusutil";
import { isBlank } from "@/util/util";
import { CpuPlotView, CpuPlotViewModel, makeCpuPlotViewModel } from "@/view/cpuplot/cpuplot";
import { HelpView, HelpViewModel, makeHelpViewModel } from "@/view/helpview/helpview";
import { QuickTipsView, QuickTipsViewModel } from "@/view/quicktipsview/quicktipsview";
import { TermViewModel, TerminalView, makeTerminalModel } from "@/view/term/term";
Expand Down Expand Up @@ -47,8 +47,9 @@ function makeViewModel(blockId: string, blockView: string, nodeModel: NodeModel)
if (blockView === "waveai") {
return makeWaveAiViewModel(blockId);
}
if (blockView === "cpuplot") {
return makeCpuPlotViewModel(blockId);
if (blockView === "cpuplot" || blockView == "sysinfo") {
// "cpuplot" is for backwards compatibility with already-opened widgets
return makeSysinfoViewModel(blockId, blockView);
}
if (blockView === "help") {
return makeHelpViewModel(blockId, nodeModel);
Expand Down Expand Up @@ -89,8 +90,9 @@ function getViewElem(
if (blockView === "waveai") {
return <WaveAi key={blockId} blockId={blockId} model={viewModel as WaveAiModel} />;
}
if (blockView === "cpuplot") {
return <CpuPlotView key={blockId} blockId={blockId} model={viewModel as CpuPlotViewModel} />;
if (blockView === "cpuplot" || blockView === "sysinfo") {
// "cpuplot" is for backwards compatibility with already opened widgets
return <SysinfoView key={blockId} blockId={blockId} model={viewModel as SysinfoViewModel} />;
}
if (blockView == "help") {
return <HelpView key={blockId} model={viewModel as HelpViewModel} />;
Expand Down
3 changes: 3 additions & 0 deletions frontend/app/theme.less
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,9 @@
--conn-icon-color-7: #dbde52;
--conn-icon-color-8: #58c142;

--sysinfo-cpu-color: #58c142;
--sysinfo-mem-color: #53b4ea;

--bulb-color: rgb(255, 221, 51);

// term colors (16 + 6) form the base terminal theme
Expand Down
9 changes: 0 additions & 9 deletions frontend/app/view/cpuplot/cpuplot.less

This file was deleted.

302 changes: 0 additions & 302 deletions frontend/app/view/cpuplot/cpuplot.tsx

This file was deleted.

33 changes: 33 additions & 0 deletions frontend/app/view/sysinfo/sysinfo.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// Copyright 2024, Command Line Inc.
// SPDX-License-Identifier: Apache-2.0

.scrollable {
flex-flow: column nowrap;
flex-grow: 1;
margin-bottom: 0;
overflow-y: auto;
.sysinfo-view {
width: 100%;
height: 100%;
display: grid;
grid-template-rows: repeat(auto-fit, minmax(100px, 1fr));
gap: 10px;

&.two-columns {
grid-template-columns: 1fr 1fr;
}

.sysinfo-plot-content {
min-height: 100px;
svg {
[aria-label="tip"] {
g {
path {
color: var(--border-color);
}
}
}
}
}
}
}
Loading

0 comments on commit a5999aa

Please sign in to comment.