pierrejeambrun commented on code in PR #44828: URL: https://github.com/apache/airflow/pull/44828#discussion_r1880187909
########## airflow/ui/src/pages/Task/Instances.tsx: ########## @@ -0,0 +1,141 @@ +/*! + * 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 { Box, Link } from "@chakra-ui/react"; +import type { ColumnDef } from "@tanstack/react-table"; +import dayjs from "dayjs"; +import { Link as RouterLink, useParams } from "react-router-dom"; + +import { + useTaskInstanceServiceGetTaskInstances, + useTaskServiceGetTask, +} from "openapi/queries"; +import type { TaskInstanceResponse } 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 Time from "src/components/Time"; +import { Status } from "src/components/ui"; + +const columns = ( + isMapped?: boolean, +): Array<ColumnDef<TaskInstanceResponse>> => [ + { + accessorKey: "start_date", + cell: ({ row: { original } }) => ( + <Link asChild color="fg.info" fontWeight="bold"> + <RouterLink + to={`/dags/${original.dag_id}/runs/${original.dag_run_id}/tasks/${original.task_id}`} + > + <Time datetime={original.start_date} /> + </RouterLink> + </Link> + ), + header: "Start Date", + }, + { + accessorKey: "end_date", + cell: ({ row: { original } }) => <Time datetime={original.end_date} />, + header: "End Date", + }, + { + accessorKey: "state", + cell: ({ + row: { + original: { state }, + }, + }) => <Status state={state}>{state}</Status>, + header: () => "State", + }, + { + accessorKey: "dag_run_id", Review Comment: dag_run_id is not a sortable key. This will yield an error. -- 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