You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tooling.apache.org by ak...@apache.org on 2026/06/05 07:37:40 UTC

(tooling-gofannon) 16/25: match running jobs card to other home modules, add /runs page

This is an automated email from the ASF dual-hosted git repository.

andrewmusselman pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tooling-gofannon.git

commit 3df0e9bd4ecace31cbfeddefdd49953ec1affc15
Author: Andrew Musselman <ak...@apache.org>
AuthorDate: Thu Jun 4 23:56:49 2026 +0000

    match running jobs card to other home modules, add /runs page
    
    Two related home-page polish items.
    
    RunningJobsModule restyle: the widget was a plain Paper with a flat
    title, sitting in a column next to two modules that use a richer
    header pattern (light grey bg, border-bottom, leading icon + title +
    count chip, optional View-all on the right). Match that pattern --
    PendingActionsIcon as the leading glyph, 'All (N)' chip showing the
    total, and a View-all button that navigates to the new /runs page.
    Same Paper-with-overflow-hidden shell as the Data Stores card so
    borders/headers line up across the row.
    
    All-runs index page: new src/pages/RunsPage.jsx mounted at /runs.
    Layout follows DataStoresPage / SavedAgentsPage / DemoAppsPage
    conventions -- p:3 outer Box at maxWidth 1400 with margin:0 auto,
    header row with back-arrow IconButton + h5 600-weight title with
    flexGrow:1 + size=small Refresh button on the right, error Alert
    with onClose dismissal, Paper-with-overflow-hidden table wrapper
    with a #fafafa header row, empty state with a 40px icon above the
    two-line text. Adds page-specific status filter chips
    (All/Running/Success/Error/Stopped, counts per chip) above the
    table; that's not a convention borrowed from existing pages, it's
    specific to runs where filtering is the obvious primary action.
    
    Single-run detail (/runs/<id>) is still TODO -- the row links in
    RunningJobsModule pointed at it before this change and will
    continue to until a detail page lands. Not blocking; the all-runs
    page gives operators the cross-cutting view they actually need
    first.
---
 .../webui/src/components/RunningJobsModule.jsx     |  96 ++++++---
 webapp/packages/webui/src/config/routesConfig.jsx  |   5 +
 webapp/packages/webui/src/pages/RunsPage.jsx       | 220 +++++++++++++++++++++
 3 files changed, 289 insertions(+), 32 deletions(-)

diff --git a/webapp/packages/webui/src/components/RunningJobsModule.jsx b/webapp/packages/webui/src/components/RunningJobsModule.jsx
index 1c2148e..736bac2 100644
--- a/webapp/packages/webui/src/components/RunningJobsModule.jsx
+++ b/webapp/packages/webui/src/components/RunningJobsModule.jsx
@@ -2,15 +2,17 @@
 //
 // ISSUE-006 — cross-agent view of "what's running" on the home page.
 // Polls GET /runs every 5s and renders each non-terminal run plus the
-// most recent N completed runs. Status chip color encodes terminal state.
+// most recent N completed runs. Status chip color encodes terminal
+// state.
 //
 // Deliberately uses polling rather than per-row SSE — this is an
-// at-a-glance overview, and 30+ concurrent EventSources for users with
-// many agents would be wasteful.
+// at-a-glance overview, and 30+ concurrent EventSources for users
+// with many agents would be wasteful.
 
 import React, { useEffect, useState } from 'react';
-import { Paper, Box, Typography, Chip, CircularProgress, Stack, Link } from '@mui/material';
-import { Link as RouterLink } from 'react-router-dom';
+import { Paper, Box, Typography, Chip, CircularProgress, Stack, Link, Button } from '@mui/material';
+import { Link as RouterLink, useNavigate } from 'react-router-dom';
+import PendingActionsIcon from '@mui/icons-material/PendingActions';
 import { listRuns } from '../services/runService';
 
 const POLL_INTERVAL_MS = 5000;
@@ -24,6 +26,7 @@ const STATUS_CHIP = {
 };
 
 export default function RunningJobsModule() {
+  const navigate = useNavigate();
   const [runs, setRuns] = useState([]);
   const [loading, setLoading] = useState(true);
 
@@ -56,39 +59,68 @@ export default function RunningJobsModule() {
     };
   }, []);
 
-  const running  = runs.filter((r) => r.status === 'running');
-  const recent   = runs.filter((r) => r.status !== 'running').slice(0, MAX_COMPLETED_SHOWN);
+  const running = runs.filter((r) => r.status === 'running');
+  const recent  = runs.filter((r) => r.status !== 'running').slice(0, MAX_COMPLETED_SHOWN);
 
   return (
-    <Paper sx={{ p: 2, mb: 3 }}>
-      <Box sx={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', mb: 1.5 }}>
-        <Typography variant="h6">Running Jobs</Typography>
-        {loading && <CircularProgress size={16} />}
+    <Paper sx={{ overflow: 'hidden' }}>
+      {/* Header matches the Data Stores / Agents pattern on the home
+          page: icon + title + count chip on the left, View all on
+          the right. */}
+      <Box sx={{
+        p: 2,
+        display: 'flex',
+        justifyContent: 'space-between',
+        alignItems: 'center',
+        borderBottom: '1px solid #e4e4e7',
+        bgcolor: '#fafafa',
+      }}>
+        <Box sx={{ display: 'flex', alignItems: 'center', gap: 1 }}>
+          <PendingActionsIcon sx={{ fontSize: 20, color: 'text.secondary' }} />
+          <Typography variant="h6" sx={{ fontWeight: 600, fontSize: '1rem' }}>Running Jobs</Typography>
+          <Chip label={`All (${runs.length})`} size="small" sx={{ height: 22, fontSize: '0.72rem' }} />
+          {loading && <CircularProgress size={14} sx={{ ml: 1 }} />}
+        </Box>
+        <Button
+          variant="outlined"
+          size="small"
+          onClick={() => navigate('/runs')}
+          disabled={runs.length === 0}
+        >
+          View all
+        </Button>
       </Box>
 
-{!loading && running.length === 0 && recent.length === 0 && (
-        <Typography variant="body2" color="text.secondary">
-          No runs yet. Kick off an agent to see live status here.
-        </Typography>
-      )}
+      <Box sx={{ p: 2 }}>
+        {!loading && running.length === 0 && recent.length === 0 && (
+          <Box sx={{ py: 3, textAlign: 'center' }}>
+            <Typography color="text.secondary" variant="body2">
+              No runs yet
+            </Typography>
+            <Typography color="text.secondary" variant="caption" sx={{ display: 'block', mt: 0.5 }}>
+              Kick off an agent to see live status here.
+            </Typography>
+          </Box>
+        )}
 
-      {running.length > 0 && (
-        <Box sx={{ mb: 1.5 }}>
-          <Typography variant="caption" color="text.secondary">In flight</Typography>
-          <Stack spacing={0.5} sx={{ mt: 0.5 }}>
-            {running.map((r) => <RunRow key={r.runId} run={r} />)}
-          </Stack>
-        </Box>
-      )}
+        {running.length > 0 && (
+          <Box sx={{ mb: 1.5 }}>
+            <Typography variant="caption" color="text.secondary">In flight</Typography>
+            <Stack spacing={0.5} sx={{ mt: 0.5 }}>
+              {running.map((r) => <RunRow key={r.runId} run={r} />)}
+            </Stack>
+          </Box>
+        )}
 
-      {recent.length > 0 && (
-        <Box>
-          <Typography variant="caption" color="text.secondary">Recent</Typography>
-          <Stack spacing={0.5} sx={{ mt: 0.5 }}>
-            {recent.map((r) => <RunRow key={r.runId} run={r} />)}
-          </Stack>
-        </Box>
-      )}
+        {recent.length > 0 && (
+          <Box>
+            <Typography variant="caption" color="text.secondary">Recent</Typography>
+            <Stack spacing={0.5} sx={{ mt: 0.5 }}>
+              {recent.map((r) => <RunRow key={r.runId} run={r} />)}
+            </Stack>
+          </Box>
+        )}
+      </Box>
     </Paper>
   );
 }
diff --git a/webapp/packages/webui/src/config/routesConfig.jsx b/webapp/packages/webui/src/config/routesConfig.jsx
index 251bbca..578a4ed 100644
--- a/webapp/packages/webui/src/config/routesConfig.jsx
+++ b/webapp/packages/webui/src/config/routesConfig.jsx
@@ -10,6 +10,7 @@ import DemoAppsPage from '../pages/DemoAppsPage';
 import ViewDemoAppPage from '../pages/ViewDemoAppPage';
 import DataStoresPage from '../pages/DataStoresPage';
 import DataStoreBrowser from '../pages/DataStoreBrowser';
+import RunsPage from '../pages/RunsPage';
 import RunsScreen from '../pages/AgentCreationFlow/RunsScreen';
 import DeployScreen from '../pages/AgentCreationFlow/DeployScreen';
 import SelectApisScreen from '../pages/DemoCreationFlow/SelectApisScreen';
@@ -59,6 +60,10 @@ export const defaultRoutes = [
     path: '/data-stores/:namespace',
     element: <DataStoreBrowser />,
   },
+  {
+    path: '/runs',
+    element: <RunsPage />,
+  },
   {
     path: '/profile/:section?',
     element: <ProfilePage />,
diff --git a/webapp/packages/webui/src/pages/RunsPage.jsx b/webapp/packages/webui/src/pages/RunsPage.jsx
new file mode 100644
index 0000000..2844116
--- /dev/null
+++ b/webapp/packages/webui/src/pages/RunsPage.jsx
@@ -0,0 +1,220 @@
+// webapp/packages/webui/src/pages/RunsPage.jsx
+//
+// All runs index — cross-agent table view of every run currently
+// known to the in-memory RunRegistry (ISSUE-003). Linked from the
+// home page Running Jobs module's "View all" button.
+//
+// Polls GET /runs every 5s like the home page module does, but
+// renders a fuller table with status filter chips, started/completed
+// timestamps, and a runtime column. Layout, header bar, refresh
+// button, empty-state, and table styling follow the conventions
+// established in DataStoresPage / SavedAgentsPage / DemoAppsPage.
+
+import React, { useEffect, useMemo, useState } from 'react';
+import { useNavigate } from 'react-router-dom';
+import {
+  Box, Typography, Paper, Table, TableBody, TableCell, TableContainer,
+  TableHead, TableRow, Chip, CircularProgress, IconButton, Stack, Tooltip,
+  Button, Alert,
+} from '@mui/material';
+import ArrowBackIcon from '@mui/icons-material/ArrowBack';
+import RefreshIcon from '@mui/icons-material/Refresh';
+import PendingActionsIcon from '@mui/icons-material/PendingActions';
+import { listRuns } from '../services/runService';
+
+const POLL_INTERVAL_MS = 5000;
+
+const STATUS_CHIP = {
+  running: { label: 'running', color: 'info' },
+  success: { label: 'success', color: 'success' },
+  error:   { label: 'error',   color: 'error' },
+  stopped: { label: 'stopped', color: 'default' },
+};
+
+const FILTERS = [
+  { id: 'all',     label: 'All' },
+  { id: 'running', label: 'Running' },
+  { id: 'success', label: 'Success' },
+  { id: 'error',   label: 'Error' },
+  { id: 'stopped', label: 'Stopped' },
+];
+
+function relativeTime(iso) {
+  if (!iso) return '';
+  const diff = (Date.now() - new Date(iso).getTime()) / 1000;
+  if (diff < 60) return `${Math.round(diff)}s ago`;
+  if (diff < 3600) return `${Math.round(diff / 60)}m ago`;
+  if (diff < 86400) return `${Math.round(diff / 3600)}h ago`;
+  return `${Math.round(diff / 86400)}d ago`;
+}
+
+function durationOf(run) {
+  if (!run.startedAt) return '';
+  const end = run.completedAt ? new Date(run.completedAt).getTime() : Date.now();
+  const ms = end - new Date(run.startedAt).getTime();
+  if (ms < 1000) return `${ms}ms`;
+  const s = Math.floor(ms / 1000);
+  if (s < 60) return `${s}s`;
+  const m = Math.floor(s / 60);
+  const rs = s % 60;
+  return `${m}m ${rs}s`;
+}
+
+const RunsPage = () => {
+  const navigate = useNavigate();
+  const [runs, setRuns] = useState([]);
+  const [loading, setLoading] = useState(true);
+  const [error, setError] = useState(null);
+  const [filter, setFilter] = useState('all');
+  const [refreshNonce, setRefreshNonce] = useState(0);
+
+  useEffect(() => {
+    let cancelled = false;
+    const fetchOnce = async () => {
+      try {
+        const data = await listRuns();
+        if (cancelled) return;
+        setRuns((data && data.runs) || []);
+        setError(null);
+      } catch (e) {
+        if (!cancelled) {
+          console.warn('RunsPage: unable to fetch /runs:', e.message || e);
+          setError(e.message || String(e));
+          setRuns([]);
+        }
+      } finally {
+        if (!cancelled) setLoading(false);
+      }
+    };
+    fetchOnce();
+    const id = setInterval(fetchOnce, POLL_INTERVAL_MS);
+    return () => {
+      cancelled = true;
+      clearInterval(id);
+    };
+  }, [refreshNonce]);
+
+  const filtered = useMemo(() => {
+    if (filter === 'all') return runs;
+    return runs.filter((r) => r.status === filter);
+  }, [runs, filter]);
+
+  // Counts per status for the filter chips.
+  const counts = useMemo(() => {
+    const c = { all: runs.length };
+    for (const f of FILTERS) {
+      if (f.id === 'all') continue;
+      c[f.id] = runs.filter((r) => r.status === f.id).length;
+    }
+    return c;
+  }, [runs]);
+
+  const load = () => setRefreshNonce(n => n + 1);
+
+  return (
+    <Box sx={{ p: 3, maxWidth: 1400, margin: '0 auto' }}>
+      <Box sx={{ display: 'flex', alignItems: 'center', mb: 3 }}>
+        <IconButton size="small" onClick={() => navigate('/')} sx={{ mr: 1 }}>
+          <ArrowBackIcon sx={{ fontSize: 20 }} />
+        </IconButton>
+        <Typography variant="h5" sx={{ fontWeight: 600, flexGrow: 1 }}>
+          All Runs
+        </Typography>
+        <Button size="small" startIcon={<RefreshIcon />} onClick={load} disabled={loading}>
+          Refresh
+        </Button>
+      </Box>
+
+      {/* Status filter chips — page-specific, no existing convention to match. */}
+      <Stack direction="row" spacing={1} sx={{ mb: 3, flexWrap: 'wrap', gap: 1 }}>
+        {FILTERS.map((f) => (
+          <Chip
+            key={f.id}
+            label={`${f.label} (${counts[f.id] ?? 0})`}
+            size="small"
+            color={filter === f.id ? 'primary' : 'default'}
+            variant={filter === f.id ? 'filled' : 'outlined'}
+            onClick={() => setFilter(f.id)}
+            clickable
+          />
+        ))}
+      </Stack>
+
+      {error && (
+        <Alert severity="error" sx={{ mb: 2 }} onClose={() => setError(null)}>
+          {error}
+        </Alert>
+      )}
+
+      <Paper sx={{ overflow: 'hidden' }}>
+        <TableContainer>
+          {loading && runs.length === 0 ? (
+            <Box sx={{ display: 'flex', justifyContent: 'center', p: 4 }}>
+              <CircularProgress size={28} />
+            </Box>
+          ) : filtered.length === 0 ? (
+            <Box sx={{ p: 4, textAlign: 'center' }}>
+              <PendingActionsIcon sx={{ fontSize: 40, color: 'text.secondary', mb: 1 }} />
+              <Typography color="text.secondary" variant="body2">
+                {filter === 'all'
+                  ? 'No runs yet. Kick off an agent to see runs appear here.'
+                  : `No ${filter} runs. Try a different filter.`}
+              </Typography>
+            </Box>
+          ) : (
+            <Table>
+              <TableHead>
+                <TableRow sx={{ bgcolor: '#fafafa' }}>
+                  <TableCell>Status</TableCell>
+                  <TableCell>Agent</TableCell>
+                  <TableCell>Started</TableCell>
+                  <TableCell>Duration</TableCell>
+                  <TableCell>Run ID</TableCell>
+                </TableRow>
+              </TableHead>
+              <TableBody>
+                {filtered.map((run) => {
+                  const cfg = STATUS_CHIP[run.status] || { label: run.status, color: 'default' };
+                  return (
+                    <TableRow key={run.runId} hover>
+                      <TableCell>
+                        <Chip size="small" label={cfg.label} color={cfg.color} />
+                      </TableCell>
+                      <TableCell>
+                        <Typography variant="body2" sx={{ fontWeight: 500 }}>
+                          {run.agentName}
+                        </Typography>
+                      </TableCell>
+                      <TableCell>
+                        <Tooltip title={run.startedAt || ''} arrow>
+                          <Typography variant="body2" color="text.secondary">
+                            {relativeTime(run.startedAt)}
+                          </Typography>
+                        </Tooltip>
+                      </TableCell>
+                      <TableCell>
+                        <Typography variant="body2" color="text.secondary">
+                          {durationOf(run)}
+                        </Typography>
+                      </TableCell>
+                      <TableCell>
+                        <Typography
+                          variant="body2"
+                          sx={{ fontFamily: 'monospace', fontSize: '0.75rem', color: 'text.secondary' }}
+                        >
+                          {run.runId}
+                        </Typography>
+                      </TableCell>
+                    </TableRow>
+                  );
+                })}
+              </TableBody>
+            </Table>
+          )}
+        </TableContainer>
+      </Paper>
+    </Box>
+  );
+};
+
+export default RunsPage;


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@tooling.apache.org
For additional commands, e-mail: commits-help@tooling.apache.org