Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
import { Flex, Alert, CloseButton, Container, Heading, Span, Text } from "@chakra-ui/react";
import { Alert, CloseButton, Container, Heading, Span, Text, Box, HStack } from "@chakra-ui/react";
import type { LoginResponse } from "openapi-gen/requests/types.gen";
import { useState } from "react";
import { useCookies } from "react-cookie";
Expand Down Expand Up @@ -78,58 +78,78 @@ export const Login = () => {
};

return (
<Container
border="1px"
borderColor="gray.emphasized"
borderRadius={5}
borderStyle="solid"
borderWidth="1px"
maxW="2xl"
mt={2}
p="4"
<Box
_dark={{
bg: "gray.900",
}}
alignItems="center"
bg="gray.50"
display="flex"
justifyContent="center"
minH="100vh"
p={4}
>
<Flex gap={2} mb={6}>
<AirflowPin height="35px" width="35px" />
<Heading colorPalette="blue" fontWeight="normal" size="xl">
Sign into Airflow
</Heading>
</Flex>

{Boolean(error) && <ErrorAlert error={error} />}

<Text mb={4}>Enter your username and password below:</Text>
<LoginForm isPending={isPending} onLogin={onLogin} />
{isBannerDisabled === null && (
<Alert.Root mt={5} status="info">
<Alert.Indicator />
<Alert.Content>
<Alert.Title>Simple auth manager enabled</Alert.Title>
<Alert.Description>
The Simple auth manager is intended for development and testing. If you&apos;re using it in
production, ensure that access is controlled through other means. Please read{" "}
<Span textDecoration="underline">
<a
href="https://airflow.apache.org/docs/apache-airflow/stable/core-concepts/auth-manager/simple/index.html"
rel="noreferrer"
target="_blank"
>
the documentation
</a>
</Span>{" "}
to learn more about simple auth manager.
</Alert.Description>
</Alert.Content>
<CloseButton
insetEnd="-2"
onClick={() => {
localStorage.setItem(LOCAL_STORAGE_DISABLE_BANNER_KEY, "1");
setIsBannerDisabled("1");
}}
pos="relative"
top="-2"
/>
</Alert.Root>
)}
</Container>
<Container
_dark={{
bg: "gray.800",
}}
bg="white"
borderRadius="lg"
boxShadow="lg"
maxW="md"
p={8}
>
<HStack gap={3} mb={6}>
<AirflowPin height="35px" width="35px" />
<Heading _dark={{ color: "white" }} color="gray.800" fontWeight="normal" size="xl">
Sign into Airflow
</Heading>
</HStack>

{Boolean(error) && (
<Box mb={4}>
<ErrorAlert error={error} />
</Box>
)}

<Text _dark={{ color: "gray.300" }} color="gray.600" mb={4}>
Enter your username and password below:
</Text>

<LoginForm isPending={isPending} onLogin={onLogin} />

{isBannerDisabled === null && (
<Alert.Root mt={5} status="info">
<Alert.Indicator />
<Alert.Content>
<Alert.Title>Simple auth manager enabled</Alert.Title>
<Alert.Description>
The Simple auth manager is intended for development and testing. If you&apos;re using it in
production, ensure that access is controlled through other means. Please read{" "}
<Span textDecoration="underline">
<a
href="https://airflow.apache.org/docs/apache-airflow/stable/core-concepts/auth-manager/simple/index.html"
rel="noreferrer noopener"
target="_blank"
>
the documentation
</a>
</Span>{" "}
to learn more about simple auth manager.
</Alert.Description>
</Alert.Content>
<CloseButton
insetEnd="-2"
onClick={() => {
localStorage.setItem(LOCAL_STORAGE_DISABLE_BANNER_KEY, "1");
setIsBannerDisabled("1");
}}
pos="relative"
top="-2"
/>
</Alert.Root>
)}
</Container>
</Box>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export const LoginForm = ({ isPending, onLogin }: LoginFormProps) => {
<Field.Root invalid={Boolean(fieldState.error)} required>
<Field.Label>Username</Field.Label>
{/* eslint-disable-next-line jsx-a11y/no-autofocus */}
<Input autoFocus {...field} />
<Input autoFocus variant="subtle" {...field} />
</Field.Root>
)}
rules={{ required: true }}
Expand All @@ -66,13 +66,13 @@ export const LoginForm = ({ isPending, onLogin }: LoginFormProps) => {
render={({ field, fieldState }) => (
<Field.Root invalid={Boolean(fieldState.error)} required>
<Field.Label>Password</Field.Label>
<Input {...field} type="password" />
<Input variant="subtle" {...field} type="password" />
</Field.Root>
)}
rules={{ required: true }}
/>

<Button colorPalette="blue" disabled={!isValid || isPending} type="submit">
<Button colorPalette="brand" disabled={!isValid || isPending} type="submit">
Sign in
</Button>
</Stack>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,20 @@
* specific language governing permissions and limitations
* under the License.
*/
import { ChakraProvider, defaultSystem } from "@chakra-ui/react";
import { ChakraProvider } from "@chakra-ui/react";
import { QueryClientProvider } from "@tanstack/react-query";
import { ThemeProvider } from "next-themes";
import { CookiesProvider } from "react-cookie";
import { createRoot } from "react-dom/client";
import { RouterProvider } from "react-router-dom";

import { router } from "src/router";
import { system } from "src/theme";

import { queryClient } from "./queryClient";

createRoot(document.querySelector("#root") as HTMLDivElement).render(
<ChakraProvider value={defaultSystem}>
<ChakraProvider value={system}>
<ThemeProvider attribute="class" disableTransitionOnChange>
<QueryClientProvider client={queryClient}>
<CookiesProvider>
Expand Down
Loading