Copilot commented on code in PR #54993: URL: https://github.com/apache/airflow/pull/54993#discussion_r2318931082
########## providers/edge3/src/airflow/providers/edge3/plugins/www/src/components/StateBadge.tsx: ########## @@ -0,0 +1,43 @@ +/*! + * 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, type BadgeProps } from "@chakra-ui/react"; +import type { TaskInstanceState } from "openapi/requests/types.gen"; +import * as React from "react"; + +import { StateIcon } from "./StateIcon"; + +export type Props = { + readonly state?: TaskInstanceState | null; +} & BadgeProps; + +export const StateBadge = React.forwardRef<HTMLDivElement, Props>(({ children, state, ...rest }, ref) => ( + <Badge + borderRadius="full" + colorPalette={state === null ? "none" : state} Review Comment: Using the state value directly as the colorPalette may cause issues if the state string doesn't correspond to a valid Chakra UI color palette. Consider implementing a state-to-color mapping function similar to the one used in WorkerStateBadge.tsx. ########## providers/edge3/src/airflow/providers/edge3/plugins/www/src/components/StateIcon.tsx: ########## @@ -0,0 +1,60 @@ +/*! + * 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 type { TaskInstanceState } from "openapi/requests/types.gen"; +import type { IconBaseProps } from "react-icons"; +import { FiActivity, FiCalendar, FiRepeat, FiSkipForward, FiSlash, FiWatch, FiX } from "react-icons/fi"; +import { LuCalendarSync, LuCheck, LuCircleDashed, LuCircleFadingArrowUp, LuRedo2 } from "react-icons/lu"; +import { PiQueue } from "react-icons/pi"; + +type Props = { + readonly state?: TaskInstanceState | null; +} & IconBaseProps; + +export const StateIcon = ({ state, ...rest }: Props) => { + // false positive eslint - we have a default. Review Comment: [nitpick] The comment about "false positive eslint" is unclear and doesn't explain what ESLint rule it's addressing or why it's considered a false positive. Consider removing this comment or making it more specific about the actual ESLint rule being referenced. ```suggestion ``` -- 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]
