gdivya6028 commented on code in PR #66017:
URL: https://github.com/apache/airflow/pull/66017#discussion_r3155282935
##########
airflow-core/src/airflow/ui/src/pages/DagRuns.tsx:
##########
@@ -228,15 +233,73 @@ export const DagRuns = () => {
const durationGte = searchParams.get(DURATION_GTE_PARAM);
const durationLte = searchParams.get(DURATION_LTE_PARAM);
const confContains = searchParams.get(CONF_CONTAINS_PARAM);
+ const dagTag = searchParams.get(DAG_TAG);
const partitionKeyPattern = searchParams.get(PARTITION_KEY_PATTERN_PARAM);
const refetchInterval = useAutoRefresh({});
+ 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("|");
+ }
Review 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
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]