tirkarthi commented on code in PR #46631:
URL: https://github.com/apache/airflow/pull/46631#discussion_r1953137022


##########
airflow/ui/src/components/DurationChart.tsx:
##########
@@ -91,26 +94,51 @@ export const RunDuration = ({
   return (
     <Box>
       <Heading pb={2} size="sm" textAlign="center">
-        Last {totalEntries} runs
+        Last {pluralize(kind, entries.length)}
       </Heading>
       <Bar
         data={{
           datasets: [
             {
               backgroundColor: 
system.tokens.categoryMap.get("colors")?.get("queued.600")?.value as string,
-              data: runs.map((run: DAGRunResponse) => 
Number(getDuration(run.queued_at, run.start_date))),
+              data: entries.map((entry: RunResponse) => {
+                switch (kind) {
+                  case "Dag Run": {
+                    const obj = entry as DAGRunResponse;

Review Comment:
   Thanks, done and rebased with main.



##########
airflow/ui/src/components/DurationChart.tsx:
##########
@@ -91,26 +94,51 @@ export const RunDuration = ({
   return (
     <Box>
       <Heading pb={2} size="sm" textAlign="center">
-        Last {totalEntries} runs
+        Last {pluralize(kind, entries.length)}
       </Heading>
       <Bar
         data={{
           datasets: [
             {
               backgroundColor: 
system.tokens.categoryMap.get("colors")?.get("queued.600")?.value as string,
-              data: runs.map((run: DAGRunResponse) => 
Number(getDuration(run.queued_at, run.start_date))),
+              data: entries.map((entry: RunResponse) => {
+                switch (kind) {
+                  case "Dag Run": {
+                    const obj = entry as DAGRunResponse;
+
+                    return obj.queued_at !== null && obj.start_date !== null 
&& obj.queued_at < obj.start_date
+                      ? Number(getDuration(obj.queued_at, obj.start_date))
+                      : 0;
+                  }
+                  case "Task Instance": {
+                    const obj = entry as TaskInstanceResponse;

Review Comment:
   Thanks, done.



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