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


##########
airflow-core/src/airflow/ui/src/pages/HITLTaskInstances/HITLTaskInstances.tsx:
##########
@@ -0,0 +1,195 @@
+/*!
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+import { Badge, Link } from "@chakra-ui/react";
+import type { ColumnDef } from "@tanstack/react-table";
+import type { TFunction } from "i18next";
+import { useTranslation } from "react-i18next";
+import { Link as RouterLink, useParams } from "react-router-dom";
+
+import { useHumanInTheLoopServiceGetHitlDetails } from "openapi/queries";
+import type { HITLDetail } from "openapi/requests/types.gen";
+import { DataTable } from "src/components/DataTable";
+import { useTableURLState } from "src/components/DataTable/useTableUrlState";
+import { ErrorAlert } from "src/components/ErrorAlert";
+import { StateBadge } from "src/components/StateBadge";
+import Time from "src/components/Time";
+import { TruncatedText } from "src/components/TruncatedText";
+import { useAutoRefresh } from "src/utils";
+import { getTaskInstanceLink } from "src/utils/links";
+
+type TaskInstanceRow = { row: { original: HITLDetail } };
+
+const statusMapping = (translate: TFunction, operator: string, 
responseReceived: boolean) => {
+  const statusMap = {
+    ApprovalOperator: ["approvalRequired", "approvalReceived"],
+    HITLBranchOperator: ["choiceRequired", "choiceReceived"],
+    HITLEntryOperator: ["inputRequired", "inputReceived"],
+    HITLOperator: ["responseRequired", "responseReceived"],
+  };
+
+  const [required, received] = statusMap[operator as keyof typeof statusMap];
+
+  return translate(`hitl:status.${responseReceived ? received : required}`);
+};

Review Comment:
   > It's not allowed to have no options.
   
   That makes sense to me. I've remove the input related state and update the 
logic based:
   
   - default → "responseRequired" / "responseReceived"
   - If options only contain "Approve" and "Reject" → "approvalRequired" / 
"approvalReceived"
   - If there are options but not purely Approve/Reject → "choiceRequired" / 
"choiceReceived"



-- 
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: commits-unsubscr...@airflow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to