High-performance browser automation bridge and multi-instance orchestrator with advanced stealth injection and real-time dashboard.
feat: add poll interval setting (5-120s, default 30s)
Bosch09c5bd5d3b96
diff --git a/dashboard/src/generated/types.ts b/dashboard/src/generated/types.tsindex 2af4502c..6387fb07 100644--- a/dashboard/src/generated/types.ts+++ b/dashboard/src/generated/types.ts@@ -96,6 +96,7 @@ export interface Settings {*/export interface MonitoringSettings {memoryMetrics: boolean; // Enable per-tab memory aggregation (can be heavy)+ pollInterval: number /* int */; // Poll interval in seconds (default 30)}/*** ServerInfo contains health/status information.diff --git a/dashboard/src/pages/MonitoringPage.tsx b/dashboard/src/pages/MonitoringPage.tsxindex a003c1c5..eeb90bc6 100644--- a/dashboard/src/pages/MonitoringPage.tsx+++ b/dashboard/src/pages/MonitoringPage.tsx@@ -5,7 +5,7 @@ import { TabsChart, InstanceListItem, TabItem } from "../components/molecules";import type { InstanceTab } from "../generated/types";import * as api from "../services/api";-const POLL_INTERVAL = 30000; // 30 seconds+const DEFAULT_POLL_INTERVAL = 30; // secondsexport default function MonitoringPage() {const {@@ -39,6 +39,8 @@ export default function MonitoringPage() {// Fetch tabs and optionally memory for all running instancesconst memoryEnabled = settings.monitoring?.memoryMetrics ?? false;+ const pollInterval =+ (settings.monitoring?.pollInterval || DEFAULT_POLL_INTERVAL) * 1000;const fetchAllInstanceData = useCallback(async () => {const runningInstances = instances.filter((i) => i.status === "running");@@ -109,11 +111,11 @@ export default function MonitoringPage() {// Poll tabsuseEffect(() => {fetchAllInstanceData();- pollRef.current = setInterval(fetchAllInstanceData, POLL_INTERVAL);+ pollRef.current = setInterval(fetchAllInstanceData, pollInterval);return () => {if (pollRef.current) clearInterval(pollRef.current);};- }, [fetchAllInstanceData]);+ }, [fetchAllInstanceData, pollInterval]);// Auto-select first running instanceuseEffect(() => {diff --git a/dashboard/src/pages/SettingsPage.tsx b/dashboard/src/pages/SettingsPage.tsxindex 0975e402..1f09647e 100644--- a/dashboard/src/pages/SettingsPage.tsx+++ b/dashboard/src/pages/SettingsPage.tsx@@ -199,6 +199,38 @@ export default function SettingsPage() {className="h-4 w-4"/></label>+ <div className="flex items-center justify-between">+ <div>+ <span className="text-sm text-text-secondary">+ Poll Interval+ </span>+ <p className="text-xs text-text-muted">+ How often to fetch tab/memory data+ </p>+ </div>+ <div className="flex items-center gap-2">+ <input+ type="range"+ min={5}+ max={120}+ step={5}+ value={local.monitoring?.pollInterval ?? 30}+ onChange={(e) =>+ setLocal({+ ...local,+ monitoring: {+ ...local.monitoring,+ pollInterval: +e.target.value,+ },+ })+ }+ className="w-24"+ />+ <span className="w-12 text-right text-sm text-text-muted">+ {local.monitoring?.pollInterval ?? 30}s+ </span>+ </div>+ </div></div></Card>diff --git a/dashboard/src/stores/useAppStore.test.ts b/dashboard/src/stores/useAppStore.test.tsindex 595af1be..7e6fc2a1 100644--- a/dashboard/src/stores/useAppStore.test.ts+++ b/dashboard/src/stores/useAppStore.test.ts@@ -139,7 +139,7 @@ describe("useAppStore", () => {screencast: { fps: 5, quality: 50, maxWidth: 1024 },stealth: "strict" as const,browser: { blockImages: true, blockMedia: true, noAnimations: true },- monitoring: { memoryMetrics: true },+ monitoring: { memoryMetrics: true, pollInterval: 30 },};useAppStore.getState().setSettings(newSettings);expect(useAppStore.getState().settings).toEqual(newSettings);@@ -150,7 +150,7 @@ describe("useAppStore", () => {screencast: { fps: 10, quality: 80, maxWidth: 1280 },stealth: "full" as const,browser: { blockImages: false, blockMedia: false, noAnimations: false },- monitoring: { memoryMetrics: true },+ monitoring: { memoryMetrics: true, pollInterval: 30 },};useAppStore.getState().setSettings(newSettings);diff --git a/dashboard/src/stores/useAppStore.ts b/dashboard/src/stores/useAppStore.tsindex bc1e9f9c..d82020c5 100644--- a/dashboard/src/stores/useAppStore.ts+++ b/dashboard/src/stores/useAppStore.ts@@ -68,7 +68,7 @@ const defaultSettings: Settings = {screencast: { fps: 1, quality: 30, maxWidth: 800 },stealth: "light",browser: { blockImages: false, blockMedia: false, noAnimations: false },- monitoring: { memoryMetrics: false },+ monitoring: { memoryMetrics: false, pollInterval: 30 },};const SETTINGS_KEY = "pinchtab_settings";diff --git a/internal/api/types/types.go b/internal/api/types/types.goindex 05cd6a0f..b9569f36 100644--- a/internal/api/types/types.go+++ b/internal/api/types/types.go@@ -83,7 +83,8 @@ type Settings struct {// MonitoringSettings controls dashboard monitoring features.type MonitoringSettings struct {- MemoryMetrics bool `json:"memoryMetrics"` // Enable per-tab memory aggregation (can be heavy)+ MemoryMetrics bool `json:"memoryMetrics"` // Enable per-tab memory aggregation (can be heavy)+ PollInterval int `json:"pollInterval"` // Poll interval in seconds (default 30)}// ServerInfo contains health/status information.