Skip to content

Conversation

@puretension
Copy link
Contributor

@puretension puretension commented Sep 12, 2025

Fixes #14809

Motivation

Sensor details page lacks Previous Runs visibility, making it difficult for users to locate and monitor workflows triggered by sensor events. This creates inconsistent UX compared to CronWorkflow which provides clear Previous Runs section.

Modifications

  • Added Previous Runs section below Sensor editor tabs using workflows.argoproj.io/sensor label filtering
  • Implemented identical UI pattern as CronWorkflow with WorkflowDetailsList component for consistency
  • Fixed empty state handling with proper array length check to display triggered workflows correctly
recoreded_video.mov

Verification

  • Sensor details page now displays Previous Runs section with triggered workflows
  • Workflows are properly filtered by workflows.argoproj.io/sensor=sensor-name label
  • Empty state shows appropriate message when no workflows exist
  • UI matches CronWorkflow Previous Runs behavior for consistent user experience

Documentation

No documentation changes needed as this follows existing CronWorkflow Previous Runs pattern that users are already familiar with.

@@ -0,0 +1,9 @@
Component: UI
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file shouldn't be in this PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Joibel Fixed! I removed the incorrect file from the PR. It was accidentally included from a wrong branch merge.
(I think it came my previous work - #14816)

@Joibel Joibel self-assigned this Nov 4, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds a "Previous Runs" section to the Sensor details page to display workflows triggered by sensors, improving UX consistency with CronWorkflow details page.

  • Added workflow fetching using workflows.argoproj.io/sensor label to retrieve sensor-triggered workflows
  • Implemented Previous Runs UI using WorkflowDetailsList component matching CronWorkflow pattern
  • Added label constant for sensor workflows to shared models

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
ui/src/sensors/sensor-details.tsx Added workflow list fetching and Previous Runs section display with ZeroState handling
ui/src/shared/models/workflows.ts Added sensor label constant for filtering sensor-triggered workflows
ui/src/workflow-templates/workflow-template-list.tsx Unrelated changes: Added label persistence and URL query param handling
.features/pending/14809-sensor-previous-runs.md Feature documentation for the sensor Previous Runs addition

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

/>
)}
<>
{!workflows || workflows.length === 0 ? (
Copy link

Copilot AI Nov 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The condition !workflows will always be false since workflows is initialized to [] on line 36. The check should be workflows.length === 0 only, matching the pattern in cron-workflow-details.tsx which checks !workflows where workflows is initialized to undefined.

Suggested change
{!workflows || workflows.length === 0 ? (
{workflows.length === 0 ? (

Copilot uses AI. Check for mistakes.
Comment on lines +76 to +80
const workflowList = await services.workflows.list(namespace, null, [`${models.labels.sensor}=${name}`], {limit: 50});
const workflowsInfo = await services.info.getInfo();

setWorkflows(workflowList.items);
setColumns(workflowsInfo.columns);
Copy link

Copilot AI Nov 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing error handling for the async workflow fetching. If services.workflows.list() or services.info.getInfo() fails, the error is not caught or displayed to the user. Add .catch(setError) or wrap in try-catch to handle potential errors, similar to the sensor fetching useEffect on line 66-72.

Suggested change
const workflowList = await services.workflows.list(namespace, null, [`${models.labels.sensor}=${name}`], {limit: 50});
const workflowsInfo = await services.info.getInfo();
setWorkflows(workflowList.items);
setColumns(workflowsInfo.columns);
try {
const workflowList = await services.workflows.list(namespace, null, [`${models.labels.sensor}=${name}`], {limit: 50});
const workflowsInfo = await services.info.getInfo();
setWorkflows(workflowList.items);
setColumns(workflowsInfo.columns);
setError(null);
} catch (err) {
setError(err);
}

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

List of previous runs for sensor objects in Argo UI

2 participants