Skip to content

Commit 5d0e8e3

Browse files
authored
fix connstatus in new processviewer widget (#3222)
1 parent 5e3673c commit 5d0e8e3

File tree

3 files changed

+36
-27
lines changed

3 files changed

+36
-27
lines changed

frontend/app/view/processviewer/processviewer.tsx

Lines changed: 36 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,11 @@ export class ProcessViewerViewModel implements ViewModel {
153153
const containerHeight = globalStore.get(this.containerHeightAtom);
154154
const conn = globalStore.get(this.connection);
155155
const textSearch = globalStore.get(this.textSearchAtom);
156+
const connStatus = globalStore.get(this.connStatus);
156157

158+
if (!connStatus?.connected) {
159+
return;
160+
}
157161
const start = Math.max(0, Math.floor(scrollTop / RowHeight) - OverscanRows);
158162
const visibleRows = containerHeight > 0 ? Math.ceil(containerHeight / RowHeight) : 50;
159163
const limit = visibleRows + OverscanRows * 2;
@@ -190,6 +194,10 @@ export class ProcessViewerViewModel implements ViewModel {
190194

191195
async doKeepAlive() {
192196
if (this.disposed) return;
197+
const connStatus = globalStore.get(this.connStatus);
198+
if (!connStatus?.connected) {
199+
return;
200+
}
193201
const conn = globalStore.get(this.connection);
194202
const route = makeConnRoute(conn);
195203
try {
@@ -871,6 +879,7 @@ export const ProcessViewerView: React.FC<ViewComponentProps<ProcessViewerViewMod
871879
const [selectedPid, setSelectedPid] = jotai.useAtom(model.selectedPidAtom);
872880
const dataStart = jotai.useAtomValue(model.dataStartAtom);
873881
const connection = jotai.useAtomValue(model.connection);
882+
const connStatus = jotai.useAtomValue(model.connStatus);
874883
const bodyScrollRef = React.useRef<HTMLDivElement>(null);
875884
const containerRef = React.useRef<HTMLDivElement>(null);
876885
const [wide, setWide] = React.useState(false);
@@ -976,33 +985,36 @@ export const ProcessViewerView: React.FC<ViewComponentProps<ProcessViewerViewMod
976985

977986
{/* outer h-scroll wrapper */}
978987
<div className="flex-1 overflow-x-auto overflow-y-hidden">
979-
{/* inner column — expands to header's natural width, rows match */}
980-
<div className="flex flex-col h-full min-w-full w-max">
981-
<TableHeader model={model} sortBy={sortBy} sortDesc={sortDesc} platform={platform} />
982-
983-
{/* virtualized rows — same width as header, scrolls vertically */}
984-
<div
985-
ref={bodyScrollRef}
986-
className="flex-1 overflow-y-auto overflow-x-hidden w-full wide-scrollbar"
987-
onScroll={handleScroll}
988-
>
989-
<div style={{ height: totalHeight, position: "relative" }}>
990-
<div style={{ position: "absolute", top: paddingTop, left: 0, right: 0 }}>
991-
{processes.map((proc) => (
992-
<ProcessRow
993-
key={proc.pid}
994-
proc={proc}
995-
hasCpu={hasCpu}
996-
platform={platform}
997-
selected={selectedPid === proc.pid}
998-
onSelect={handleSelectPid}
999-
onContextMenu={handleContextMenu}
1000-
/>
1001-
))}
988+
{!connStatus?.connected ? (
989+
<div className="flex items-center justify-center h-full text-secondary text-sm">
990+
Waiting for connection…
991+
</div>
992+
) : (
993+
<div className="flex flex-col h-full min-w-full w-max">
994+
<TableHeader model={model} sortBy={sortBy} sortDesc={sortDesc} platform={platform} />
995+
<div
996+
ref={bodyScrollRef}
997+
className="flex-1 overflow-y-auto overflow-x-hidden w-full wide-scrollbar"
998+
onScroll={handleScroll}
999+
>
1000+
<div style={{ height: totalHeight, position: "relative" }}>
1001+
<div style={{ position: "absolute", top: paddingTop, left: 0, right: 0 }}>
1002+
{processes.map((proc) => (
1003+
<ProcessRow
1004+
key={proc.pid}
1005+
proc={proc}
1006+
hasCpu={hasCpu}
1007+
platform={platform}
1008+
selected={selectedPid === proc.pid}
1009+
onSelect={handleSelectPid}
1010+
onContextMenu={handleContextMenu}
1011+
/>
1012+
))}
1013+
</div>
10021014
</div>
10031015
</div>
10041016
</div>
1005-
</div>
1017+
)}
10061018
</div>
10071019
<ActionStatusBar model={model} />
10081020
</div>

go.mod

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ require (
2323
github.com/launchdarkly/eventsource v1.11.0
2424
github.com/mattn/go-sqlite3 v1.14.40
2525
github.com/mitchellh/mapstructure v1.5.0
26-
github.com/sashabaranov/go-openai v1.41.2
2726
github.com/sawka/txwrap v0.2.0
2827
github.com/shirou/gopsutil/v4 v4.26.3
2928
github.com/skeema/knownhosts v1.3.1

go.sum

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,6 @@ github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUc
122122
github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ=
123123
github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc=
124124
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
125-
github.com/sashabaranov/go-openai v1.41.2 h1:vfPRBZNMpnqu8ELsclWcAvF19lDNgh1t6TVfFFOPiSM=
126-
github.com/sashabaranov/go-openai v1.41.2/go.mod h1:lj5b/K+zjTSFxVLijLSTDZuP7adOgerWeFyZLUhAKRg=
127125
github.com/sawka/txwrap v0.2.0 h1:V3LfvKVLULxcYSxdMguLwFyQFMEU9nFDJopg0ZkL+94=
128126
github.com/sawka/txwrap v0.2.0/go.mod h1:wwQ2SQiN4U+6DU/iVPhbvr7OzXAtgZlQCIGuvOswEfA=
129127
github.com/shirou/gopsutil/v4 v4.26.3 h1:2ESdQt90yU3oXF/CdOlRCJxrP+Am1aBYubTMTfxJ1qc=

0 commit comments

Comments
 (0)