bbovenzi commented on code in PR #69559:
URL: https://github.com/apache/airflow/pull/69559#discussion_r3545282473
##########
airflow-core/src/airflow/ui/src/pages/Dag/Calendar/calendarUtils.ts:
##########
@@ -97,6 +98,31 @@ const createHourlyDataMap = (data:
Array<CalendarTimeRangeResponse>, timezone: s
return hourlyDataMap;
};
+export const buildDeadlineDateMap = (
+ deadlines: Array<CalendarDeadlineResponse>,
+ timezone: string,
+ granularity: CalendarGranularity,
+): Map<string, DeadlineCounts> => {
+ const map = new Map<string, DeadlineCounts>();
+
+ deadlines.forEach((deadline) => {
+ const key =
+ granularity === "daily"
+ ? dayjs(deadline.date).tz(timezone).format("YYYY-MM-DD")
+ : dayjs(deadline.date).tz(timezone).format("YYYY-MM-DDTHH");
Review Comment:
We should already have format strings in datetimeUtils. Let's reuse those.
##########
airflow-core/src/airflow/ui/public/i18n/locales/en/dag.json:
##########
@@ -7,6 +7,7 @@
},
"calendar": {
"daily": "Daily",
+ "deadlines": "Deadlines",
Review Comment:
Let's reuse an existing translation key for deadlines instead of adding a
new one
##########
airflow-core/src/airflow/ui/src/pages/Dag/Calendar/calendarUtils.ts:
##########
@@ -97,6 +98,31 @@ const createHourlyDataMap = (data:
Array<CalendarTimeRangeResponse>, timezone: s
return hourlyDataMap;
};
+export const buildDeadlineDateMap = (
Review Comment:
Let's add a test for this to make sure the map correctly handles edge cases
like empty state?
--
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]