Skip to content

Commit da8c36b

Browse files
committed
fix some nits
1 parent 413c82c commit da8c36b

2 files changed

Lines changed: 18 additions & 7 deletions

File tree

frontend/app/view/processviewer/processviewer.tsx

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,6 @@ export class ProcessViewerViewModel implements ViewModel {
147147

148148
const route = makeConnRoute(conn);
149149
try {
150-
console.log("RemoteProcessList", sortBy, sortDesc, start, limit, textSearch);
151150
const resp = await this.env.rpc.RemoteProcessListCommand(
152151
TabRpcClient,
153152
{ sortby: sortBy, sortdesc: sortDesc, start, limit, textsearch: textSearch || undefined },
@@ -223,7 +222,11 @@ export class ProcessViewerViewModel implements ViewModel {
223222

224223
setTextSearch(text: string) {
225224
globalStore.set(this.textSearchAtom, text);
226-
this.triggerRefresh();
225+
if (globalStore.get(this.pausedAtom)) {
226+
this.doOneFetch();
227+
} else {
228+
this.triggerRefresh();
229+
}
227230
}
228231

229232
openSearch() {
@@ -585,7 +588,10 @@ const StatusBar = React.memo(function StatusBar({ model, data, loading, error, w
585588
{hasSummaryCpu && (
586589
<>
587590
<div className="w-px self-stretch bg-white/10 shrink-0" />
588-
<Tooltip content={`100% per core · ${summary.numcpu} cores = ${summary.numcpu * 100}% max`} placement="bottom">
591+
<Tooltip
592+
content={`100% per core · ${summary.numcpu} cores = ${summary.numcpu * 100}% max`}
593+
placement="bottom"
594+
>
589595
<span className="shrink-0 cursor-default whitespace-pre">
590596
CPU<span className="font-mono text-[11px]">x{summary.numcpu}</span>{" "}
591597
<span className="font-mono text-[11px]">{cpuPct}%</span>
@@ -635,7 +641,10 @@ const StatusBar = React.memo(function StatusBar({ model, data, loading, error, w
635641
{hasSummaryMem && <div className="flex-1 max-w-3" />}
636642
{hasSummaryCpu && (
637643
<div className="flex flex-col shrink-0 w-[55px] mr-1">
638-
<Tooltip content={`100% per core · ${summary.numcpu} cores = ${summary.numcpu * 100}% max`} placement="bottom">
644+
<Tooltip
645+
content={`100% per core · ${summary.numcpu} cores = ${summary.numcpu * 100}% max`}
646+
placement="bottom"
647+
>
639648
<div className="cursor-default">
640649
CPU<span className="font-mono text-[11px]">x{summary.numcpu}</span>
641650
</div>
@@ -769,6 +778,7 @@ export const ProcessViewerView: React.FC<ViewComponentProps<ProcessViewerViewMod
769778
const platform = data?.platform ?? "";
770779
const startIdx = Math.max(0, Math.floor(scrollTop / RowHeight) - OverscanRows);
771780
const totalCount = data?.totalcount ?? 0;
781+
const filteredCount = data?.filteredcount ?? totalCount;
772782
const processes = data?.processes ?? [];
773783
const hasCpu = data?.hascpu ?? false;
774784

@@ -793,7 +803,7 @@ export const ProcessViewerView: React.FC<ViewComponentProps<ProcessViewerViewMod
793803
model.setScrollTop(el.scrollTop);
794804
}, [model]);
795805

796-
const totalHeight = totalCount * RowHeight;
806+
const totalHeight = filteredCount * RowHeight;
797807
const paddingTop = startIdx * RowHeight;
798808

799809
return (

pkg/wshrpc/wshremote/processviewer.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import (
2727
const (
2828
ProcCacheIdleTimeout = 10 * time.Second
2929
ProcCachePollInterval = 1 * time.Second
30+
ProcViewerMaxLimit = 500
3031
)
3132

3233
// cpuSample records a single CPU time measurement for a process.
@@ -425,8 +426,8 @@ func (impl *ServerImpl) RemoteProcessListCommand(ctx context.Context, data wshrp
425426
sortBy = "cpu"
426427
}
427428
limit := data.Limit
428-
if limit <= 0 || limit > 500 {
429-
limit = 50
429+
if limit <= 0 || limit > ProcViewerMaxLimit {
430+
limit = ProcViewerMaxLimit
430431
}
431432

432433
totalCount := len(raw.Processes)

0 commit comments

Comments
 (0)