guan404ming commented on code in PR #55130:
URL: https://github.com/apache/airflow/pull/55130#discussion_r2313564243


##########
airflow-core/src/airflow/ui/src/layouts/Details/Gantt/Gantt.tsx:
##########
@@ -123,6 +124,20 @@ export const Gantt = ({ limit }: Props) => {
 
   const isLoading = runsLoading || structureLoading || summariesLoading || 
tiLoading;
 
+  useEffect(() => {

Review Comment:
   `taskInstancesData` would auto-refresh here so I think it could work without 
this `useEffect`.
   
https://github.com/apache/airflow/blob/2b91be8e490714b4fef68a6d89a695caa1003745/airflow-core/src/airflow/ui/src/layouts/Details/Gantt/Gantt.tsx#L109-L120



##########
airflow-core/src/airflow/ui/src/layouts/Details/Gantt/utils.ts:
##########
@@ -81,93 +81,98 @@ export const createChartOptions = ({
   selectedRun,
   selectedTimezone,
   translate,
-}: ChartOptionsParams) => ({
-  animation: {
-    duration: 100,
-  },
-  indexAxis: "y" as const,
-  maintainAspectRatio: false,
-  onClick: handleBarClick,
-  onHover: (event: ChartEvent, elements: Array<ActiveElement>) => {
-    const target = event.native?.target as HTMLElement | undefined;
+}: ChartOptionsParams) => {
+  const isRunning = selectedRun?.state === "running";
+  const effectiveEndDate = isRunning ? new Date().toISOString() : 
selectedRun?.end_date;

Review Comment:
   Also here



##########
airflow-core/src/airflow/ui/src/layouts/Details/Gantt/Gantt.tsx:
##########
@@ -123,6 +124,20 @@ export const Gantt = ({ limit }: Props) => {
 
   const isLoading = runsLoading || structureLoading || summariesLoading || 
tiLoading;
 
+  useEffect(() => {
+    const hasRunningTasks = taskInstancesData?.task_instances.some((ti) => 
isStatePending(ti.state));
+
+    if (hasRunningTasks) {
+      const interval = setInterval(() => {
+        setCurrentTime(new Date().toISOString());

Review Comment:
   We could get current time with `selectedTimezone` easily with `dayjs`
   
   ```js
   const { selectedTimezone } = useTimezone();
   
   // Make the value timezone-aware
   setCurrentTime(dayjs().tz(selectedTimezone).format("YYYY-MM-DD HH:mm:ss"))
   ```



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