dheerajturaga commented on code in PR #55547: URL: https://github.com/apache/airflow/pull/55547#discussion_r2345157218
########## providers/edge3/src/airflow/providers/edge3/plugins/www/src/components/MaintenanceEditCommentButton.tsx: ########## @@ -0,0 +1,98 @@ +/*! + * 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 { Button, CloseButton, Dialog, IconButton, Portal, Textarea, useDisclosure } from "@chakra-ui/react"; +import { useUiServiceUpdateWorkerMaintenance } from "openapi/queries"; +import { useState } from "react"; +import { FiEdit } from "react-icons/fi"; + +interface MaintenanceEditCommentButtonProps { + onEditComment: (toast: Record<string, string>) => void; + workerName: string; +} + +export const MaintenanceEditCommentButton = ({ + onEditComment, + workerName, +}: MaintenanceEditCommentButtonProps) => { + const { onClose, onOpen, open } = useDisclosure(); + const [comment, setComment] = useState(""); + + const editCommentMutation = useUiServiceUpdateWorkerMaintenance({ + onError: (error) => { + onEditComment({ + description: `Unable to update comments for worker ${workerName}: ${error}`, + title: "Updating Comments failed", + type: "error", + }); + }, + onSuccess: () => { + onEditComment({ + description: `Worker maintenance comments for ${workerName} were updated.`, + title: "Maintenance Comments updated", + type: "success", + }); Review Comment: ```suggestion }); onClose(); ``` @jscheffl , The issue is that the dialog should be closed when the mutation is successful, but the onSuccess callback (lines 44-50) only calls the onEditComment callback to show a success toast, but doesn't call onClose() to close the dialog. -- 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]
