This is an automated email from the ASF dual-hosted git repository.

pierrejeambrun pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/main by this push:
     new 7510322789e feat: display logged in within UserSettingsButton (#58981)
7510322789e is described below

commit 7510322789e3344d790d82dc38a9f17d0646989e
Author: Aaron Wolmutt <[email protected]>
AuthorDate: Mon Dec 8 05:25:54 2025 -0600

    feat: display logged in within UserSettingsButton (#58981)
    
    * feat: display logged in as in the UserSettingsButton
    
    * modified translation items and common.json
    
    * use undefined instead of null in conditional render
    
    * changed translation key name to avoid failing existing unit tests
    
    * removed translations key containing settings
    
    * fix ci
    
    * refactor: use Menu.Separator instead of borderBottom props
---
 .../src/airflow/ui/public/i18n/locales/en/common.json     |  1 +
 .../src/airflow/ui/src/layouts/Nav/UserSettingsButton.tsx | 15 +++++++++++++++
 2 files changed, 16 insertions(+)

diff --git a/airflow-core/src/airflow/ui/public/i18n/locales/en/common.json 
b/airflow-core/src/airflow/ui/public/i18n/locales/en/common.json
index 05ecb691221..7a351943abb 100644
--- a/airflow-core/src/airflow/ui/public/i18n/locales/en/common.json
+++ b/airflow-core/src/airflow/ui/public/i18n/locales/en/common.json
@@ -182,6 +182,7 @@
   },
   "selectLanguage": "Select Language",
   "showDetailsPanel": "Show Details Panel",
+  "signedInAs": "Signed in as",
   "source": {
     "hide": "Hide Source",
     "hotkey": "s",
diff --git a/airflow-core/src/airflow/ui/src/layouts/Nav/UserSettingsButton.tsx 
b/airflow-core/src/airflow/ui/src/layouts/Nav/UserSettingsButton.tsx
index 84d8c385fed..22b10f0586e 100644
--- a/airflow-core/src/airflow/ui/src/layouts/Nav/UserSettingsButton.tsx
+++ b/airflow-core/src/airflow/ui/src/layouts/Nav/UserSettingsButton.tsx
@@ -33,6 +33,7 @@ import {
 import { MdOutlineAccountTree } from "react-icons/md";
 import { useLocalStorage } from "usehooks-ts";
 
+import { useAuthLinksServiceGetCurrentUserInfo } from "openapi/queries";
 import { Menu } from "src/components/ui";
 import { useColorMode } from "src/context/colorMode/useColorMode";
 import type { NavItemResponse } from "src/utils/types";
@@ -55,6 +56,7 @@ type ColorMode = (typeof COLOR_MODES)[keyof typeof 
COLOR_MODES];
 export const UserSettingsButton = ({ externalViews }: { readonly 
externalViews: Array<NavItemResponse> }) => {
   const { i18n, t: translate } = useTranslation();
   const { selectedTheme, setColorMode } = useColorMode();
+  const { data: currentUser } = useAuthLinksServiceGetCurrentUserInfo();
 
   const colorModeOptions = [
     {
@@ -91,6 +93,19 @@ export const UserSettingsButton = ({ externalViews }: { 
readonly externalViews:
           <NavButton icon={FiUser} title={translate("user")} />
         </Menu.Trigger>
         <Menu.Content>
+          {currentUser ? (
+            <>
+              <Box p={3}>
+                <Box color="fg.muted" fontSize="sm">
+                  {translate("signedInAs")}
+                </Box>
+                <Box fontSize="md" fontWeight="semibold">
+                  {currentUser.username}
+                </Box>
+              </Box>
+              <Menu.Separator />
+            </>
+          ) : undefined}
           <Menu.Item onClick={onOpenLanguage} value="language">
             <Icon as={FiGlobe} boxSize={4} />
             <Box flex="1">{translate("selectLanguage")}</Box>

Reply via email to