Skip to content

Commit 158e404

Browse files
authored
Lots of fixes, big and small for processviewer (frontend and backend) (#3224)
The big fix is not spawning a goroutine per process. other fixes are more minor, but improve the quality and clean up some edge cases.
1 parent 4a55b7e commit 158e404

File tree

9 files changed

+125
-99
lines changed

9 files changed

+125
-99
lines changed

Taskfile.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ tasks:
156156
- tsunami/go.mod
157157
- tsunami/go.sum
158158
- tsunami/**/*.go
159+
- package.json
159160

160161
build:schema:
161162
desc: Build the schema for configuration.
@@ -185,6 +186,7 @@ tasks:
185186
- "pkg/**/*.json"
186187
- "pkg/**/*.sh"
187188
- tsunami/**/*.go
189+
- package.json
188190
generates:
189191
- dist/bin/wavesrv.*
190192

@@ -289,6 +291,7 @@ tasks:
289291
sources:
290292
- "cmd/wsh/**/*.go"
291293
- "pkg/**/*.go"
294+
- package.json
292295
generates:
293296
- "dist/bin/wsh*"
294297

docs/docs/keybindings.mdx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,14 @@ Chords are shown with a + between the keys. You have 2 seconds to hit the 2nd ch
107107
| <Kbd k="Shift:PageUp"/> | Scroll up one page |
108108
| <Kbd k="Shift:PageDown"/>| Scroll down one page |
109109

110+
## Process Viewer Keybindings
111+
112+
| Key | Function |
113+
| ----------------------- | ------------------------------------- |
114+
| <Kbd k="Space"/> | Pause / resume live updates |
115+
| <Kbd k="Cmd:f"/> | Open process filter / search |
116+
| <Kbd k="Escape"/> | Close search bar |
117+
110118
## Customizeable Systemwide Global Hotkey
111119

112120
Wave allows setting a custom global hotkey to focus your most recent window from anywhere in your computer. For more information on this, see [the config docs](./config#customizable-systemwide-global-hotkey).

docs/docs/releasenotes.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ sidebar_position: 200
1111
Wave v0.14.5 introduces a new Process Viewer widget, Quake Mode for global hotkey, and several quality-of-life improvements.
1212

1313
- **Process Viewer** - New widget that displays running processes on local and remote machines, with CPU and memory usage, sortable columns, and the ability to send signals to processes
14-
- **Quake Mode** - The global hotkey (`app:globalhotkey`) now triggers a dedicated quake mode that drops a Wave window down from the top of the screen, similar to classic quake-style terminals
14+
- **Quake Mode** - The global hotkey (`app:globalhotkey`) now toggles a Wave window visible and invisible
1515
- **[bugfix] Settings Widget** - Fixed a bug where config files that didn't exist yet couldn't be created or edited from the Settings widget UI
1616
- **Drag & Drop Files into Terminal** - Drag files from Finder (macOS) or your file manager into a terminal block to paste their quoted path ([#746](https://github.com/wavetermdev/waveterm/issues/746))
1717
- New opt-in `app:showsplitbuttons` setting adds horizontal/vertical split buttons to block headers

docs/docs/widgets.mdx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ title: "Widgets"
66

77
import { Kbd } from "@site/src/components/kbd";
88
import { PlatformProvider, PlatformSelectorButton } from "@site/src/components/platformcontext";
9+
import { VersionBadge } from "@site/src/components/versionbadge";
910

1011
<PlatformProvider>
1112

@@ -138,4 +139,10 @@ You can also save by pressing <Kbd k="Cmd:s" />.
138139
To exit **edit mode** without saving, click the cancel button to the right of the header.
139140
You can also exit without saving by pressing <Kbd k="Cmd:r" />.
140141

142+
### Process Viewer <VersionBadge version="v0.14.5" />
143+
144+
The Process Viewer shows a live list of running processes on any connected host. It is similar to `top` or `htop`, displaying PID, command, CPU%, and memory usage. On Linux it also shows process status and thread count.
145+
146+
Columns are sortable by clicking their headers. Right-clicking a row lets you send Unix signals (SIGTERM, SIGKILL, etc.) or copy the PID. You can filter the list by pressing <Kbd k="Cmd:f"/> and typing a search term. Press <Kbd k="Space"/> to pause live updates (useful when inspecting a specific process); press it again to resume.
147+
141148
</PlatformProvider>

frontend/app/onboarding/onboarding-upgrade-v0145.tsx

Lines changed: 11 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ const UpgradeOnboardingModal_v0_14_5_Content = () => {
66
<div className="flex flex-col items-start gap-6 w-full mb-4 unselectable">
77
<div className="text-secondary leading-relaxed">
88
<p className="mb-0">
9-
Wave v0.14.5 introduces a new Process Viewer widget, Quake Mode for the global hotkey, and several
10-
quality-of-life improvements.
9+
Wave v0.14.5 introduces a new Process Viewer widget, several quality-of-life improvements, and a
10+
fix for creating new config files from the Settings widget.
1111
</p>
1212
</div>
1313

@@ -24,19 +24,6 @@ const UpgradeOnboardingModal_v0_14_5_Content = () => {
2424
</div>
2525
</div>
2626

27-
<div className="flex w-full items-start gap-4">
28-
<div className="flex-shrink-0">
29-
<i className="text-[24px] text-accent fa-solid fa-terminal"></i>
30-
</div>
31-
<div className="flex flex-col items-start gap-2 flex-1">
32-
<div className="text-foreground text-base font-semibold leading-[18px]">Quake Mode</div>
33-
<div className="text-secondary leading-5">
34-
The global hotkey (<code>app:globalhotkey</code>) now triggers a dedicated quake mode that
35-
drops a Wave window down from the top of the screen, similar to classic quake-style terminals.
36-
</div>
37-
</div>
38-
</div>
39-
4027
<div className="flex w-full items-start gap-4">
4128
<div className="flex-shrink-0">
4229
<i className="text-[24px] text-accent fa-solid fa-wrench"></i>
@@ -46,18 +33,21 @@ const UpgradeOnboardingModal_v0_14_5_Content = () => {
4633
<div className="text-secondary leading-5">
4734
<ul className="list-disc list-outside space-y-1 pl-5">
4835
<li>
49-
<strong>Drag &amp; Drop Files into Terminal</strong> - Drag files from Finder or your
50-
file manager into a terminal to paste their quoted path
36+
<strong>Quake Mode</strong> &mdash; global hotkey (
37+
<code>app:globalhotkey</code>) now toggles a Wave window visible and invisible
38+
</li>
39+
<li>
40+
<strong>Drag &amp; Drop Files into Terminal</strong>
41+
to paste their quoted path
5142
</li>
5243
<li>
53-
New opt-in <code>app:showsplitbuttons</code> setting adds split buttons to block
54-
headers
44+
New <code>app:showsplitbuttons</code> setting adds split buttons to block headers
5545
</li>
56-
<li>Toggle the widgets sidebar from the View menu</li>
46+
<li>Toggle the widgets sidebar on and off from the View menu</li>
5747
<li>F2 to rename the active tab</li>
5848
<li>Mouse back/forward buttons now navigate in web widgets</li>
5949
<li>
60-
<strong>[bugfix]</strong>{" "}Config files that didn&apos;t exist yet couldn&apos;t be
50+
<strong>[bugfix]</strong> Config files that didn&apos;t exist yet couldn&apos;t be
6151
created or edited from the Settings widget
6252
</li>
6353
</ul>

frontend/app/view/processviewer/processviewer.tsx

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,10 @@ export class ProcessViewerViewModel implements ViewModel {
311311
this.cancelPoll = null;
312312
this.startKeepAlive();
313313
} else {
314+
if (this.cancelPoll) {
315+
this.cancelPoll();
316+
}
317+
this.cancelPoll = null;
314318
this.startPolling();
315319
}
316320
}
@@ -470,7 +474,7 @@ const Columns: ColDef[] = [
470474
{ key: "pid", label: "PID", width: "70px", align: "right" },
471475
{ key: "command", label: "Command", width: "minmax(120px, 4fr)" },
472476
{ key: "status", label: "Status", width: "75px", hideOnPlatform: ["windows", "darwin"] },
473-
{ key: "user", label: "User", width: "80px" },
477+
{ key: "user", label: "User", width: "80px", hideOnPlatform: ["windows"] },
474478
{ key: "threads", label: "NT", tooltip: "Num Threads", width: "40px", align: "right", hideOnPlatform: ["windows"] },
475479
{ key: "cpu", label: "CPU%", width: "70px", align: "right" },
476480
{ key: "mem", label: "Memory", width: "90px", align: "right" },
@@ -603,9 +607,9 @@ const ProcessRow = React.memo(function ProcessRow({
603607
onSelect: (pid: number) => void;
604608
onContextMenu: (pid: number, e: React.MouseEvent) => void;
605609
}) {
610+
const cols = getColumns(platform);
611+
const visibleKeys = new Set(cols.map((c) => c.key));
606612
const gridTemplate = getGridTemplate(platform);
607-
const showStatus = platform !== "windows" && platform !== "darwin";
608-
const showThreads = platform !== "windows";
609613
if (proc.gone) {
610614
return (
611615
<div
@@ -618,9 +622,9 @@ const ProcessRow = React.memo(function ProcessRow({
618622
{proc.pid}
619623
</div>
620624
<div className="px-2 flex items-center truncate text-muted italic">(gone)</div>
621-
{showStatus && <div className="px-2 flex items-center truncate" />}
622-
<div className="px-2 flex items-center truncate" />
623-
{showThreads && <div className="px-2 flex items-center truncate" />}
625+
{visibleKeys.has("status") && <div className="px-2 flex items-center truncate" />}
626+
{visibleKeys.has("user") && <div className="px-2 flex items-center truncate" />}
627+
{visibleKeys.has("threads") && <div className="px-2 flex items-center truncate" />}
624628
<div className="px-2 flex items-center truncate" />
625629
<div className="px-2 flex items-center truncate" />
626630
</div>
@@ -637,11 +641,13 @@ const ProcessRow = React.memo(function ProcessRow({
637641
{proc.pid}
638642
</div>
639643
<div className="px-2 flex items-center truncate">{proc.command}</div>
640-
{showStatus && (
644+
{visibleKeys.has("status") && (
641645
<div className="px-2 flex items-center truncate text-secondary text-[11px]">{proc.status}</div>
642646
)}
643-
<div className="px-2 flex items-center truncate text-secondary">{proc.user}</div>
644-
{showThreads && (
647+
{visibleKeys.has("user") && (
648+
<div className="px-2 flex items-center truncate text-secondary">{proc.user}</div>
649+
)}
650+
{visibleKeys.has("threads") && (
645651
<div className="px-2 flex items-center truncate justify-end text-secondary font-mono text-[11px]">
646652
{proc.numthreads === -1 ? "-" : proc.numthreads >= 1 ? proc.numthreads : ""}
647653
</div>

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/wconfig/defaultconfig/widgets.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,5 +40,15 @@
4040
"view": "sysinfo"
4141
}
4242
}
43+
},
44+
"defwidget@processviewer": {
45+
"display:order": -1,
46+
"icon": "list-tree",
47+
"label": "processes",
48+
"blockdef": {
49+
"meta": {
50+
"view": "processviewer"
51+
}
52+
}
4353
}
4454
}

0 commit comments

Comments
 (0)