You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "bbovenzi (via GitHub)" <gi...@apache.org> on 2025/03/26 17:12:25 UTC
[PR] Allow enter/return button to submit login [airflow]
bbovenzi opened a new pull request, #48409:
URL: https://github.com/apache/airflow/pull/48409
Since we didn't put the login form inside of an actual `<form>` element. We couldn't use common commands like "enter/return" to submit.
Also, fixed some bad formatting.
<!-- Please keep an empty line above the dashes. -->
---
**^ Add meaningful description above**
Read the **[Pull Request Guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#pull-request-guidelines)** for more information.
In case of fundamental code changes, an Airflow Improvement Proposal ([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvement+Proposals)) is needed.
In case of a new dependency, check compliance with the [ASF 3rd Party License Policy](https://www.apache.org/legal/resolved.html#category-x).
In case of backwards incompatible changes please leave a note in a newsfragment file, named `{pr_number}.significant.rst` or `{issue_number}.significant.rst`, in [airflow-core/newsfragments](https://github.com/apache/airflow/tree/main/airflow-core/newsfragments).
--
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] Allow enter/return button to submit login [airflow]
Posted by "bbovenzi (via GitHub)" <gi...@apache.org>.
bbovenzi commented on code in PR #48409:
URL: https://github.com/apache/airflow/pull/48409#discussion_r2014642114
##########
airflow-core/src/airflow/api_fastapi/auth/managers/simple/ui/src/login/LoginForm.tsx:
##########
@@ -18,50 +18,62 @@
*/
import React from "react";
-import {Button, Field, Input, Stack} from "@chakra-ui/react";
-import {Controller, useForm} from "react-hook-form";
-import {LoginBody} from "./Login";
+import { Button, Field, Input, Stack } from "@chakra-ui/react";
+import { Controller, useForm } from "react-hook-form";
+import { LoginBody } from "./Login";
type LoginFormProps = {
- readonly onLogin: (loginBody: LoginBody) => string;
- readonly isPending: boolean;
+ readonly onLogin: (loginBody: LoginBody) => string;
+ readonly isPending: boolean;
};
export const LoginForm = ({ onLogin, isPending }: LoginFormProps) => {
- const {
- control, handleSubmit,
- formState: { isValid },
- } = useForm<LoginBody>({
- defaultValues: {
- username: "", password: "",
- },
- });
+ const {
+ control,
+ handleSubmit,
+ formState: { isValid },
+ } = useForm<LoginBody>({
+ defaultValues: {
+ username: "",
+ password: "",
+ },
+ });
- return <Stack spacing={4}>
+ return (
+ <form onSubmit={() => void handleSubmit(onLogin)()}>
+ <Stack gap={4}>
Review Comment:
Here are the actual changes. Moving `handleSubmit` from the button's onclick to here while adding `type="submit"` to the button.
Also, chakra changed `spacing` to `gap`
--
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] Allow enter/return button to submit login [airflow]
Posted by "bbovenzi (via GitHub)" <gi...@apache.org>.
bbovenzi merged PR #48409:
URL: https://github.com/apache/airflow/pull/48409
--
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