You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "jscheffl (via GitHub)" <gi...@apache.org> on 2025/08/27 19:52:47 UTC

[PR] Feature/add state badge to edge react UI [airflow]

jscheffl opened a new pull request, #54993:
URL: https://github.com/apache/airflow/pull/54993

   Following https://github.com/apache/airflow/pull/53563 (waiting to have this merged) this PR is the first round of "beautification".
   
   From the 31 commits after merge of https://github.com/apache/airflow/pull/53563 only 1 commit is the content of this PR.
   
   Worker page:
   - Queues are as list
   - Status is using a colored badge
    
   <img width="1645" height="524" alt="image" src="https://github.com/user-attachments/assets/196b6e8b-06cc-401a-8353-d90f0dc62ca3" />
   
   Jobs page:
   - Status is using a colored badge
   
   <img width="1884" height="173" alt="image" src="https://github.com/user-attachments/assets/f67b7317-4238-449e-8bce-a5a372d53b47" />
   


-- 
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-unsubscribe@airflow.apache.org

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


Re: [PR] Feature/add state badge to edge react UI [airflow]

Posted by "jscheffl (via GitHub)" <gi...@apache.org>.
jscheffl merged PR #54993:
URL: https://github.com/apache/airflow/pull/54993


-- 
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-unsubscribe@airflow.apache.org

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


Re: [PR] Feature/add state badge to edge react UI [airflow]

Posted by "Copilot (via GitHub)" <gi...@apache.org>.
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: commits-unsubscribe@airflow.apache.org

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


Re: [PR] Feature/add state badge to edge react UI [airflow]

Posted by "jscheffl (via GitHub)" <gi...@apache.org>.
jscheffl commented on code in PR #54993:
URL: https://github.com/apache/airflow/pull/54993#discussion_r2318997551


##########
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:
   Thanks for the review. I cloned the component from airflow-core and colors for all states are actually existing. So this is OK.



-- 
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-unsubscribe@airflow.apache.org

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