Skip to content

High-performance browser automation bridge and multi-instance orchestrator with advanced stealth injection and real-time dashboard.

fix: use /instances/tabs endpoint for proper tab counts

Bosch1ed9a4c2b2e7
diff --git a/dashboard/src/components/molecules/ProfileDetailsModal.tsx b/dashboard/src/components/molecules/ProfileDetailsModal.tsx
index 9b292f90..ebf8b3d6 100644
--- a/dashboard/src/components/molecules/ProfileDetailsModal.tsx
+++ b/dashboard/src/components/molecules/ProfileDetailsModal.tsx
@@ -53,11 +53,15 @@ export default function ProfileDetailsModal({
if (!instance?.id) return
try {
- const [tabsData, agentsData] = await Promise.all([
- api.fetchInstanceTabs(instance.id).catch(() => []),
+ const [allTabs, agentsData] = await Promise.all([
+ api.fetchAllTabs().catch(() => []),
api.fetchAgents().catch(() => []),
])
- setTabs(Array.isArray(tabsData) ? tabsData : [])
+ // Filter tabs for this instance
+ const instanceTabs = Array.isArray(allTabs)
+ ? allTabs.filter((t) => t.instanceId === instance.id)
+ : []
+ setTabs(instanceTabs)
setAgents(agentsData.filter((a) => a.name === profile?.name))
} catch (e) {
console.error('Failed to load live data', e)
diff --git a/dashboard/src/pages/MonitoringPage.tsx b/dashboard/src/pages/MonitoringPage.tsx
index 6acd56f4..3a5fa8b0 100644
--- a/dashboard/src/pages/MonitoringPage.tsx
+++ b/dashboard/src/pages/MonitoringPage.tsx
@@ -37,27 +37,27 @@ export default function MonitoringPage() {
const runningInstances = instances.filter((i) => i.status === 'running')
if (runningInstances.length === 0) return
- const timestamp = Date.now()
- const dataPoint: Record<string, number> = { timestamp }
- const tabsByInstance: Record<string, InstanceTab[]> = {}
-
- await Promise.all(
- runningInstances.map(async (inst) => {
- try {
- const tabs = await api.fetchInstanceTabs(inst.id)
- const tabsArray = Array.isArray(tabs) ? tabs : []
- dataPoint[inst.id] = tabsArray.length
- tabsByInstance[inst.id] = tabsArray
- } catch (e) {
- console.error(`Failed to fetch tabs for ${inst.id}:`, e)
- dataPoint[inst.id] = 0
- tabsByInstance[inst.id] = []
- }
- })
- )
-
- addChartDataPoint(dataPoint as any)
- setCurrentTabs(tabsByInstance)
+ try {
+ // Use aggregated endpoint that returns proper format
+ const allTabs = await api.fetchAllTabs()
+ const tabsArray = Array.isArray(allTabs) ? allTabs : []
+
+ const timestamp = Date.now()
+ const dataPoint: Record<string, number> = { timestamp }
+ const tabsByInstance: Record<string, InstanceTab[]> = {}
+
+ // Group tabs by instance
+ for (const inst of runningInstances) {
+ const instTabs = tabsArray.filter((t) => t.instanceId === inst.id)
+ dataPoint[inst.id] = instTabs.length
+ tabsByInstance[inst.id] = instTabs
+ }
+
+ addChartDataPoint(dataPoint as any)
+ setCurrentTabs(tabsByInstance)
+ } catch (e) {
+ console.error('Failed to fetch tabs:', e)
+ }
}, [instances, addChartDataPoint, setCurrentTabs])
// Initial load