Allow search and filter by tags in dag run table #19197#66017
Allow search and filter by tags in dag run table #19197#66017gdivya6028 wants to merge 11 commits into
Conversation
|
Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contributors' Guide
|
| const { data: dagsData } = useQuery({ | ||
| enabled: dagTag !== null && dagTag !== "", | ||
| queryFn: () => | ||
| DagService.getDags({ | ||
| excludeStale: true, | ||
| lastDagRunState: "success", | ||
| limit: 50, | ||
| tags: dagTag !== null && dagTag !== "" ? [dagTag] : undefined, | ||
| tagsMatchMode: "any", | ||
| }), | ||
| queryKey: ["dags", dagTag], | ||
| }); | ||
|
|
||
| // ... (Keep your existing search param extractions here) | ||
| const filteredDagIds = React.useMemo(() => { | ||
| if (!dagsData?.dags) { | ||
| return []; | ||
| } | ||
|
|
||
| return dagsData.dags.map((dag: { dag_id: string }) => dag.dag_id); | ||
| }, [dagsData]); | ||
|
|
||
| // 2. Logic to calculate targetDagId | ||
| const targetDagId = React.useMemo(() => { | ||
| if (dagId !== "") { | ||
| return dagId; // Specific DAG page | ||
| } | ||
|
|
||
| if (dagTag !== null && dagTag !== "" && filteredDagIds.length === 0) { | ||
| return "~"; // No matches found | ||
| } | ||
|
|
||
| // If multiple IDs, use global wildcard "~" | ||
| if (filteredDagIds.length > 1) { | ||
| return "~"; | ||
| } | ||
|
|
||
| // If exactly one, use it directly | ||
| if (filteredDagIds.length === 1) { | ||
| return filteredDagIds[0]; | ||
| } | ||
|
|
||
| // No tag filter active | ||
| return "~"; | ||
| }, [dagId, dagTag, filteredDagIds]); | ||
|
|
||
| // Create the regex pattern | ||
| const multiDagPattern = React.useMemo(() => { | ||
| // Only use pattern if we have multiple IDs and no explicit dagId | ||
| if (dagId === "" && filteredDagIds.length > 1) { | ||
| return filteredDagIds.join("|"); | ||
| } |
There was a problem hiding this comment.
Thanks for the PR but that will probably not work.
The getDags endpoint is paginated so this can't work. (only the first 50 dags will be retained)
We need a new backend filter to implement that.
There was a problem hiding this comment.
hi @pierrejeambrun , could you please tell which backend api we can use or enhance? I've verified swagger apis for DagRuns earlier and they don't have DagTag field. So, I'm fetching DagIDs from Dags with selected DagTag from dropdown whose DagRuns are success and then passing these DagIDs result I got to DagRun Api to get the details for listing on page
There was a problem hiding this comment.
Yes, the API docs are based on our fastapi_api so we need to update the API itself here
|
@gdivya6028 This PR has been converted to draft because it has merge conflicts with Issues found:
What to do next:
Converting a PR to draft is not a rejection — it is an invitation to bring the PR up to the project's standards. No rush — take your time. If you have questions, feel free to ask on the Airflow Slack. Note: This comment was drafted by an AI-assisted triage tool and may contain mistakes. Once you have addressed the points above, an Apache Airflow maintainer — a real person — will take the next look at your PR. We use this two-stage triage process so that our maintainers' limited time is spent where it matters most: the conversation with you. |
|
sure @potiuk |
Was generative AI tooling used to co-author this PR?
{pr_number}.significant.rst, in airflow-core/newsfragments. You can add this file in a follow-up commit after the PR is created so you know the PR number.