Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Link state icons in dashboard to list page with instances filtered by the state for the given duration. #46968

Merged
merged 5 commits into from
Feb 28, 2025

Conversation

tirkarthi
Copy link
Contributor

On visiting the dashboard home page user could see many failed task instances in the last 24 hours. Quickly identifying the task instances involves user going to the dags page, task instances tab and then selecting failed state to sort by start_date/end_date to get recent failures. With this PR by clicking on the state icon in metrics section the respective list page in this case task instance is rendered and the state is filtered by "failed" and start_date/end_date passed as query parameters to get the task instances failed in last 24 hours.

It seems airflow/ui/src/pages/TaskInstances.tsx has become longer than 250 lines. I tried refactoring by moving some query parameter fields to constants but it's still at 253. I have disabled the eslint rule for now to this page. Any suggestions welcome.

@boring-cyborg boring-cyborg bot added the area:UI Related to UI/UX. For Frontend Developers. label Feb 21, 2025
Copy link
Contributor

@bbovenzi bbovenzi left a comment

Choose a reason for hiding this comment

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

Great idea! I've been wanting to make the dashboard link to more parts of the UI

A few comments.

We could probably move all the task instance filters into a separate component. And move TaskInstances into its own folder.

And if we refactor that. We should probably fix the Search Tasks button to not have the same hotkey as search dags since they conflict in the Dag Details page

@tirkarthi tirkarthi force-pushed the dashboard-state-links branch from cc664ed to 73f474b Compare February 23, 2025 06:42
@tirkarthi
Copy link
Contributor Author

Great idea! I've been wanting to make the dashboard link to more parts of the UI

A few comments.

We could probably move all the task instance filters into a separate component. And move TaskInstances into its own folder.

And if we refactor that. We should probably fix the Search Tasks button to not have the same hotkey as search dags since they conflict in the Dag Details page

Thanks, moved the filter and search to a separate component by creating TaskInstances directory. Regarding hotkey issue I guess both "search dags" and "search tasks" have same SearchBar component. Task instances list page inside a dagrun is one of those pages where both "search dags" and "search tasks" are present on same page with same hotkey. I am not sure the refactor might help. I can think of below two solutions.

  1. Have "hotkey" as a parameter that can be passed to SearchBar defaulting to Ctrl+k.
  2. Make "hotkey" to be enabled/disabled as a boolean and not to add hotkey when the task instances page is rendered inside a dagrun by looking for dagId and runId in URL params. To have hotkey only enabled for tasks on global task instances page.

@bbovenzi
Copy link
Contributor

  1. Have "hotkey" as a parameter that can be passed to SearchBar defaulting to Ctrl+k.
  2. Make "hotkey" to be enabled/disabled as a boolean and not to add hotkey when the task instances page is rendered inside a dagrun by looking for dagId and runId in URL params. To have hotkey only enabled for tasks on global task instances page.

Let's do #2 for now.

@bbovenzi
Copy link
Contributor

We can update the search in another PR.

Let's just resolve the conflicts and lgtm

@tirkarthi tirkarthi force-pushed the dashboard-state-links branch from 73f474b to 20043c5 Compare February 28, 2025 04:49
@tirkarthi
Copy link
Contributor Author

I have implemented the second option to disable hotkeys when the task search appears in task instances list inside a dagrun page. On global task instances page the the hotkey will be enabled. Rebased with latest main and fixed conflicts. Thanks.

@bbovenzi bbovenzi merged commit ba6cdc6 into apache:main Feb 28, 2025
34 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:UI Related to UI/UX. For Frontend Developers.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants