bbovenzi commented on code in PR #75608:
URL: https://github.com/apache/airflow/pull/75608#discussion_r4620505765


##########
airflow-core/src/airflow/ui/src/utils/deadlines.ts:
##########
@@ -18,10 +18,18 @@
  */
 import type { TFunction } from "i18next";
 
-import type { DeadlineAlertResponse } from "openapi/requests/types.gen";
+import type { DAGRunResponse, DeadlineAlertResponse } from 
"openapi/requests/types.gen";
 
 import { humanizeSeconds } from "src/utils/datetimeUtils";
 
+export const isDeadlineAlertApplicable = (
+  alert: DeadlineAlertResponse,
+  runType: DAGRunResponse["run_type"],
+): boolean =>
+  alert.run_type_filter === null ||
+  alert.run_type_filter === undefined ||
+  alert.run_type_filter.includes(runType);
+

Review Comment:
   Can we send the applicable rules from the backend instead of redefining it 
in the UI? I can see a future maintainer changing one and forgetting about the 
other.



##########
airflow-core/src/airflow/serialization/encoders.py:
##########
@@ -256,6 +256,7 @@ def encode_deadline_alert(d: DeadlineAlert | 
SerializedDeadlineAlert) -> dict[st
 
     return {
         "name": d.name,
+        "run_type_filter": sorted(d.run_type_filter) if d.run_type_filter is 
not None else None,

Review Comment:
   Let's only set `run_type_filter` if it exists instead of appending `null` 
onto every alert and causing dag versioning to change.



-- 
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]

Reply via email to