From 41fc5370fd9f7b7fe5486f4c35321f28f093720e Mon Sep 17 00:00:00 2001 From: Ben Sima Date: Mon, 1 Dec 2025 12:37:37 -0500 Subject: Fix timeline and metrics HTMX partial issues - Timeline partial now uses getAllEventsForTask instead of getEventsForSession so all events show after HTMX refresh, not just the latest session - Move Execution Details header outside HTMX swap target so it persists Task-Id: t-214, t-215 --- Omni/Jr/Web.hs | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) (limited to 'Omni') diff --git a/Omni/Jr/Web.hs b/Omni/Jr/Web.hs index 2fc2064..ecc851d 100644 --- a/Omni/Jr/Web.hs +++ b/Omni/Jr/Web.hs @@ -1577,12 +1577,12 @@ instance Lucid.ToHtml TaskDetailPage where Lucid.makeAttribute "hx-trigger" "every 5s", Lucid.makeAttribute "hx-swap" "innerHTML" ] - sectionAttrs = - [Lucid.class_ "execution-section", Lucid.id_ "execution-details"] + innerAttrs = + [Lucid.id_ "execution-details-inner"] <> [attr | isInProgress, attr <- htmxAttrs] - Lucid.div_ sectionAttrs <| do + Lucid.div_ [Lucid.class_ "execution-section"] <| do Lucid.h3_ "Execution Details" - renderExecutionDetails (TaskCore.taskId task) activities maybeRetry + Lucid.div_ innerAttrs <| renderExecutionDetails (TaskCore.taskId task) activities maybeRetry when (TaskCore.taskStatus task == TaskCore.Review) <| do Lucid.div_ [Lucid.class_ "review-link-section"] <| do @@ -3057,14 +3057,9 @@ server = pure (TaskMetricsPartial tid activities maybeRetry now) agentEventsPartialHandler :: Text -> Maybe Int -> Servant.Handler AgentEventsPartial - agentEventsPartialHandler tid maybeSince = do + agentEventsPartialHandler tid _maybeSince = do now <- liftIO getCurrentTime - maybeSession <- liftIO (TaskCore.getLatestSessionForTask tid) - events <- case maybeSession of - Nothing -> pure [] - Just sid -> case maybeSince of - Nothing -> liftIO (TaskCore.getEventsForSession sid) - Just lastId -> liftIO (TaskCore.getEventsSince sid lastId) + events <- liftIO (TaskCore.getAllEventsForTask tid) tasks <- liftIO TaskCore.loadTasks let isInProgress = case TaskCore.findTask tid tasks of Nothing -> False -- cgit v1.2.3