Skip to content

Commit 337a17a

Browse files
committed
Only show pagination on an opened workflow node
1 parent 71d03a6 commit 337a17a

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

app/Sauron/UI/Workflow.hs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,9 @@ workflowLine animationCounter currentTime toggled' (WorkflowRun {..}) fetchableS
8686
runTime = diffUTCTime workflowRunUpdatedAt workflowRunStartedAt
8787
timeSinceStart = diffUTCTime currentTime workflowRunStartedAt
8888

89-
hasPagination = totalJobs > workflowJobPageSize
89+
-- Only show the job pagination once the workflow is toggled open; when it's collapsed the
90+
-- jobs aren't visible, so the page keys fall through to the outer workflows list instead.
91+
hasPagination = toggled' && totalJobs > workflowJobPageSize
9092
pageInfo = computeJobPageInfo (workflowNodeStateJobPage wfState) totalJobs
9193

9294
timingWidget = hBox [
@@ -167,17 +169,18 @@ modifyWorkflowState s f = do
167169

168170
-- | Handle a job-pagination key (next/prev/first/last page) by paging the parent workflow's
169171
-- jobs. Works from a selected job or log group, so the key doesn't fall through to the outer
170-
-- workflows list. Returns False (letting the key fall through) when the workflow has only a
171-
-- single page of jobs, matching how the workflow node itself handles these keys.
172+
-- workflows list. Returns False (letting the key fall through) when the workflow is collapsed
173+
-- or has only a single page of jobs, so the key bubbles up to the outer workflows list instead.
172174
handleWorkflowJobPageKey :: AppState -> V.Key -> EventM ClickableName AppState Bool
173175
handleWorkflowJobPageKey s key
174176
| key `notElem` [nextPageKey, prevPageKey, firstPageKey, lastPageKey] = return False
175177
| otherwise = getFixedElemAndParents s >>= \case
176178
Just (_, _, parents)
177-
| Just (SingleWorkflowNode (EntityData {_state=stateVar, _children=childrenVar, _ident=wfIdent})) <- findWorkflowParent parents -> do
179+
| Just (SingleWorkflowNode (EntityData {_state=stateVar, _children=childrenVar, _ident=wfIdent, _toggled=toggledVar})) <- findWorkflowParent parents -> do
178180
didPage <- liftIO $ atomically $ do
181+
wfToggled <- readTVar toggledVar
179182
jobChildren <- readTVar childrenVar
180-
if length jobChildren > workflowJobPageSize
183+
if wfToggled && length jobChildren > workflowJobPageSize
181184
then modifyTVar' stateVar (navigateJobPage key (length jobChildren)) >> return True
182185
else return False
183186
-- Move the selection up to the workflow node, matching how paging other nodes

0 commit comments

Comments
 (0)