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

vincbeck 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 7c1b0197389 Add team to list variables and list connections pages 
(#60995)
7c1b0197389 is described below

commit 7c1b0197389ac484bc5bc7383f1d3b24e3fcc782
Author: Vincent <[email protected]>
AuthorDate: Mon Jan 26 12:34:44 2026 -0500

    Add team to list variables and list connections pages (#60995)
---
 .../core_api/openapi/v2-rest-api-generated.yaml    |   8 +-
 .../core_api/routes/public/connections.py          |   2 +-
 .../core_api/routes/public/variables.py            |   2 +-
 .../ui/openapi-gen/queries/ensureQueryData.ts      |   4 +-
 .../src/airflow/ui/openapi-gen/queries/prefetch.ts |   4 +-
 .../src/airflow/ui/openapi-gen/queries/queries.ts  |   4 +-
 .../src/airflow/ui/openapi-gen/queries/suspense.ts |   4 +-
 .../ui/openapi-gen/requests/services.gen.ts        |   4 +-
 .../airflow/ui/openapi-gen/requests/types.gen.ts   |   4 +-
 .../airflow/ui/public/i18n/locales/en/admin.json   |   1 +
 .../ui/src/components/DataTable/useRowSelection.ts |   1 +
 .../src/airflow/ui/src/components/TeamSelector.tsx |   3 +-
 .../ui/src/pages/Connections/Connections.tsx       | 133 ++++++++++++---------
 .../airflow/ui/src/pages/Variables/Variables.tsx   | 129 +++++++++++---------
 .../src/airflow/ui/src/queries/useAddVariable.ts   |   3 +-
 .../src/airflow/ui/src/queries/useEditVariable.ts  |  16 ++-
 16 files changed, 180 insertions(+), 142 deletions(-)

diff --git 
a/airflow-core/src/airflow/api_fastapi/core_api/openapi/v2-rest-api-generated.yaml
 
b/airflow-core/src/airflow/api_fastapi/core_api/openapi/v2-rest-api-generated.yaml
index 9993e05efc6..148f6479871 100644
--- 
a/airflow-core/src/airflow/api_fastapi/core_api/openapi/v2-rest-api-generated.yaml
+++ 
b/airflow-core/src/airflow/api_fastapi/core_api/openapi/v2-rest-api-generated.yaml
@@ -1493,13 +1493,13 @@ paths:
             type: string
           description: 'Attributes to order by, multi criteria sort is 
supported.
             Prefix with `-` for descending order. Supported attributes: 
`conn_id,
-            conn_type, description, host, port, id, connection_id`'
+            conn_type, description, host, port, id, team_name, connection_id`'
           default:
           - id
           title: Order By
         description: 'Attributes to order by, multi criteria sort is 
supported. Prefix
           with `-` for descending order. Supported attributes: `conn_id, 
conn_type,
-          description, host, port, id, connection_id`'
+          description, host, port, id, team_name, connection_id`'
       - name: connection_id_pattern
         in: query
         required: false
@@ -7760,13 +7760,13 @@ paths:
             type: string
           description: 'Attributes to order by, multi criteria sort is 
supported.
             Prefix with `-` for descending order. Supported attributes: `key, 
id,
-            _val, description, is_encrypted`'
+            _val, description, is_encrypted, team_name`'
           default:
           - id
           title: Order By
         description: 'Attributes to order by, multi criteria sort is 
supported. Prefix
           with `-` for descending order. Supported attributes: `key, id, _val, 
description,
-          is_encrypted`'
+          is_encrypted, team_name`'
       - name: variable_key_pattern
         in: query
         required: false
diff --git 
a/airflow-core/src/airflow/api_fastapi/core_api/routes/public/connections.py 
b/airflow-core/src/airflow/api_fastapi/core_api/routes/public/connections.py
index 71d8f13b5fc..744dff444fd 100644
--- a/airflow-core/src/airflow/api_fastapi/core_api/routes/public/connections.py
+++ b/airflow-core/src/airflow/api_fastapi/core_api/routes/public/connections.py
@@ -116,7 +116,7 @@ def get_connections(
         SortParam,
         Depends(
             SortParam(
-                ["conn_id", "conn_type", "description", "host", "port", "id"],
+                ["conn_id", "conn_type", "description", "host", "port", "id", 
"team_name"],
                 Connection,
                 {"connection_id": "conn_id"},
             ).dynamic_depends()
diff --git 
a/airflow-core/src/airflow/api_fastapi/core_api/routes/public/variables.py 
b/airflow-core/src/airflow/api_fastapi/core_api/routes/public/variables.py
index 5f9bcaee4d3..33f0bdca681 100644
--- a/airflow-core/src/airflow/api_fastapi/core_api/routes/public/variables.py
+++ b/airflow-core/src/airflow/api_fastapi/core_api/routes/public/variables.py
@@ -103,7 +103,7 @@ def get_variables(
         SortParam,
         Depends(
             SortParam(
-                ["key", "id", "_val", "description", "is_encrypted"],
+                ["key", "id", "_val", "description", "is_encrypted", 
"team_name"],
                 Variable,
             ).dynamic_depends()
         ),
diff --git a/airflow-core/src/airflow/ui/openapi-gen/queries/ensureQueryData.ts 
b/airflow-core/src/airflow/ui/openapi-gen/queries/ensureQueryData.ts
index 9501e4bb1a1..8851b0be65d 100644
--- a/airflow-core/src/airflow/ui/openapi-gen/queries/ensureQueryData.ts
+++ b/airflow-core/src/airflow/ui/openapi-gen/queries/ensureQueryData.ts
@@ -213,7 +213,7 @@ export const ensureUseConnectionServiceGetConnectionData = 
(queryClient: QueryCl
 * @param data The data for the request.
 * @param data.limit
 * @param data.offset
-* @param data.orderBy Attributes to order by, multi criteria sort is 
supported. Prefix with `-` for descending order. Supported attributes: 
`conn_id, conn_type, description, host, port, id, connection_id`
+* @param data.orderBy Attributes to order by, multi criteria sort is 
supported. Prefix with `-` for descending order. Supported attributes: 
`conn_id, conn_type, description, host, port, id, team_name, connection_id`
 * @param data.connectionIdPattern SQL LIKE expression — use `%` / `_` 
wildcards (e.g. `%customer_%`). or the pipe `|` operator for OR logic (e.g. 
`dag1 | dag2`). Regular expressions are **not** supported.
 * @returns ConnectionCollectionResponse Successful Response
 * @throws ApiError
@@ -1403,7 +1403,7 @@ export const ensureUseVariableServiceGetVariableData = 
(queryClient: QueryClient
 * @param data The data for the request.
 * @param data.limit
 * @param data.offset
-* @param data.orderBy Attributes to order by, multi criteria sort is 
supported. Prefix with `-` for descending order. Supported attributes: `key, 
id, _val, description, is_encrypted`
+* @param data.orderBy Attributes to order by, multi criteria sort is 
supported. Prefix with `-` for descending order. Supported attributes: `key, 
id, _val, description, is_encrypted, team_name`
 * @param data.variableKeyPattern SQL LIKE expression — use `%` / `_` wildcards 
(e.g. `%customer_%`). or the pipe `|` operator for OR logic (e.g. `dag1 | 
dag2`). Regular expressions are **not** supported.
 * @returns VariableCollectionResponse Successful Response
 * @throws ApiError
diff --git a/airflow-core/src/airflow/ui/openapi-gen/queries/prefetch.ts 
b/airflow-core/src/airflow/ui/openapi-gen/queries/prefetch.ts
index bbd67f6be62..e940b64f20d 100644
--- a/airflow-core/src/airflow/ui/openapi-gen/queries/prefetch.ts
+++ b/airflow-core/src/airflow/ui/openapi-gen/queries/prefetch.ts
@@ -213,7 +213,7 @@ export const prefetchUseConnectionServiceGetConnection = 
(queryClient: QueryClie
 * @param data The data for the request.
 * @param data.limit
 * @param data.offset
-* @param data.orderBy Attributes to order by, multi criteria sort is 
supported. Prefix with `-` for descending order. Supported attributes: 
`conn_id, conn_type, description, host, port, id, connection_id`
+* @param data.orderBy Attributes to order by, multi criteria sort is 
supported. Prefix with `-` for descending order. Supported attributes: 
`conn_id, conn_type, description, host, port, id, team_name, connection_id`
 * @param data.connectionIdPattern SQL LIKE expression — use `%` / `_` 
wildcards (e.g. `%customer_%`). or the pipe `|` operator for OR logic (e.g. 
`dag1 | dag2`). Regular expressions are **not** supported.
 * @returns ConnectionCollectionResponse Successful Response
 * @throws ApiError
@@ -1403,7 +1403,7 @@ export const prefetchUseVariableServiceGetVariable = 
(queryClient: QueryClient,
 * @param data The data for the request.
 * @param data.limit
 * @param data.offset
-* @param data.orderBy Attributes to order by, multi criteria sort is 
supported. Prefix with `-` for descending order. Supported attributes: `key, 
id, _val, description, is_encrypted`
+* @param data.orderBy Attributes to order by, multi criteria sort is 
supported. Prefix with `-` for descending order. Supported attributes: `key, 
id, _val, description, is_encrypted, team_name`
 * @param data.variableKeyPattern SQL LIKE expression — use `%` / `_` wildcards 
(e.g. `%customer_%`). or the pipe `|` operator for OR logic (e.g. `dag1 | 
dag2`). Regular expressions are **not** supported.
 * @returns VariableCollectionResponse Successful Response
 * @throws ApiError
diff --git a/airflow-core/src/airflow/ui/openapi-gen/queries/queries.ts 
b/airflow-core/src/airflow/ui/openapi-gen/queries/queries.ts
index f55804064d8..5b56fc439c9 100644
--- a/airflow-core/src/airflow/ui/openapi-gen/queries/queries.ts
+++ b/airflow-core/src/airflow/ui/openapi-gen/queries/queries.ts
@@ -213,7 +213,7 @@ export const useConnectionServiceGetConnection = <TData = 
Common.ConnectionServi
 * @param data The data for the request.
 * @param data.limit
 * @param data.offset
-* @param data.orderBy Attributes to order by, multi criteria sort is 
supported. Prefix with `-` for descending order. Supported attributes: 
`conn_id, conn_type, description, host, port, id, connection_id`
+* @param data.orderBy Attributes to order by, multi criteria sort is 
supported. Prefix with `-` for descending order. Supported attributes: 
`conn_id, conn_type, description, host, port, id, team_name, connection_id`
 * @param data.connectionIdPattern SQL LIKE expression — use `%` / `_` 
wildcards (e.g. `%customer_%`). or the pipe `|` operator for OR logic (e.g. 
`dag1 | dag2`). Regular expressions are **not** supported.
 * @returns ConnectionCollectionResponse Successful Response
 * @throws ApiError
@@ -1403,7 +1403,7 @@ export const useVariableServiceGetVariable = <TData = 
Common.VariableServiceGetV
 * @param data The data for the request.
 * @param data.limit
 * @param data.offset
-* @param data.orderBy Attributes to order by, multi criteria sort is 
supported. Prefix with `-` for descending order. Supported attributes: `key, 
id, _val, description, is_encrypted`
+* @param data.orderBy Attributes to order by, multi criteria sort is 
supported. Prefix with `-` for descending order. Supported attributes: `key, 
id, _val, description, is_encrypted, team_name`
 * @param data.variableKeyPattern SQL LIKE expression — use `%` / `_` wildcards 
(e.g. `%customer_%`). or the pipe `|` operator for OR logic (e.g. `dag1 | 
dag2`). Regular expressions are **not** supported.
 * @returns VariableCollectionResponse Successful Response
 * @throws ApiError
diff --git a/airflow-core/src/airflow/ui/openapi-gen/queries/suspense.ts 
b/airflow-core/src/airflow/ui/openapi-gen/queries/suspense.ts
index 9c38554e4ab..d77bb789863 100644
--- a/airflow-core/src/airflow/ui/openapi-gen/queries/suspense.ts
+++ b/airflow-core/src/airflow/ui/openapi-gen/queries/suspense.ts
@@ -213,7 +213,7 @@ export const useConnectionServiceGetConnectionSuspense = 
<TData = Common.Connect
 * @param data The data for the request.
 * @param data.limit
 * @param data.offset
-* @param data.orderBy Attributes to order by, multi criteria sort is 
supported. Prefix with `-` for descending order. Supported attributes: 
`conn_id, conn_type, description, host, port, id, connection_id`
+* @param data.orderBy Attributes to order by, multi criteria sort is 
supported. Prefix with `-` for descending order. Supported attributes: 
`conn_id, conn_type, description, host, port, id, team_name, connection_id`
 * @param data.connectionIdPattern SQL LIKE expression — use `%` / `_` 
wildcards (e.g. `%customer_%`). or the pipe `|` operator for OR logic (e.g. 
`dag1 | dag2`). Regular expressions are **not** supported.
 * @returns ConnectionCollectionResponse Successful Response
 * @throws ApiError
@@ -1403,7 +1403,7 @@ export const useVariableServiceGetVariableSuspense = 
<TData = Common.VariableSer
 * @param data The data for the request.
 * @param data.limit
 * @param data.offset
-* @param data.orderBy Attributes to order by, multi criteria sort is 
supported. Prefix with `-` for descending order. Supported attributes: `key, 
id, _val, description, is_encrypted`
+* @param data.orderBy Attributes to order by, multi criteria sort is 
supported. Prefix with `-` for descending order. Supported attributes: `key, 
id, _val, description, is_encrypted, team_name`
 * @param data.variableKeyPattern SQL LIKE expression — use `%` / `_` wildcards 
(e.g. `%customer_%`). or the pipe `|` operator for OR logic (e.g. `dag1 | 
dag2`). Regular expressions are **not** supported.
 * @returns VariableCollectionResponse Successful Response
 * @throws ApiError
diff --git a/airflow-core/src/airflow/ui/openapi-gen/requests/services.gen.ts 
b/airflow-core/src/airflow/ui/openapi-gen/requests/services.gen.ts
index 63e0f04f361..5754bcebd16 100644
--- a/airflow-core/src/airflow/ui/openapi-gen/requests/services.gen.ts
+++ b/airflow-core/src/airflow/ui/openapi-gen/requests/services.gen.ts
@@ -699,7 +699,7 @@ export class ConnectionService {
      * @param data The data for the request.
      * @param data.limit
      * @param data.offset
-     * @param data.orderBy Attributes to order by, multi criteria sort is 
supported. Prefix with `-` for descending order. Supported attributes: 
`conn_id, conn_type, description, host, port, id, connection_id`
+     * @param data.orderBy Attributes to order by, multi criteria sort is 
supported. Prefix with `-` for descending order. Supported attributes: 
`conn_id, conn_type, description, host, port, id, team_name, connection_id`
      * @param data.connectionIdPattern SQL LIKE expression — use `%` / `_` 
wildcards (e.g. `%customer_%`). or the pipe `|` operator for OR logic (e.g. 
`dag1 | dag2`). Regular expressions are **not** supported.
      * @returns ConnectionCollectionResponse Successful Response
      * @throws ApiError
@@ -3580,7 +3580,7 @@ export class VariableService {
      * @param data The data for the request.
      * @param data.limit
      * @param data.offset
-     * @param data.orderBy Attributes to order by, multi criteria sort is 
supported. Prefix with `-` for descending order. Supported attributes: `key, 
id, _val, description, is_encrypted`
+     * @param data.orderBy Attributes to order by, multi criteria sort is 
supported. Prefix with `-` for descending order. Supported attributes: `key, 
id, _val, description, is_encrypted, team_name`
      * @param data.variableKeyPattern SQL LIKE expression — use `%` / `_` 
wildcards (e.g. `%customer_%`). or the pipe `|` operator for OR logic (e.g. 
`dag1 | dag2`). Regular expressions are **not** supported.
      * @returns VariableCollectionResponse Successful Response
      * @throws ApiError
diff --git a/airflow-core/src/airflow/ui/openapi-gen/requests/types.gen.ts 
b/airflow-core/src/airflow/ui/openapi-gen/requests/types.gen.ts
index 407e17e3f37..7d679bbff9f 100644
--- a/airflow-core/src/airflow/ui/openapi-gen/requests/types.gen.ts
+++ b/airflow-core/src/airflow/ui/openapi-gen/requests/types.gen.ts
@@ -2315,7 +2315,7 @@ export type GetConnectionsData = {
     limit?: number;
     offset?: number;
     /**
-     * Attributes to order by, multi criteria sort is supported. Prefix with 
`-` for descending order. Supported attributes: `conn_id, conn_type, 
description, host, port, id, connection_id`
+     * Attributes to order by, multi criteria sort is supported. Prefix with 
`-` for descending order. Supported attributes: `conn_id, conn_type, 
description, host, port, id, team_name, connection_id`
      */
     orderBy?: Array<(string)>;
 };
@@ -3330,7 +3330,7 @@ export type GetVariablesData = {
     limit?: number;
     offset?: number;
     /**
-     * Attributes to order by, multi criteria sort is supported. Prefix with 
`-` for descending order. Supported attributes: `key, id, _val, description, 
is_encrypted`
+     * Attributes to order by, multi criteria sort is supported. Prefix with 
`-` for descending order. Supported attributes: `key, id, _val, description, 
is_encrypted, team_name`
      */
     orderBy?: Array<(string)>;
     /**
diff --git a/airflow-core/src/airflow/ui/public/i18n/locales/en/admin.json 
b/airflow-core/src/airflow/ui/public/i18n/locales/en/admin.json
index ad231ceb310..e421b761cc0 100644
--- a/airflow-core/src/airflow/ui/public/i18n/locales/en/admin.json
+++ b/airflow-core/src/airflow/ui/public/i18n/locales/en/admin.json
@@ -3,6 +3,7 @@
     "description": "Description",
     "key": "Key",
     "name": "Name",
+    "team": "Team",
     "value": "Value"
   },
   "config": {
diff --git 
a/airflow-core/src/airflow/ui/src/components/DataTable/useRowSelection.ts 
b/airflow-core/src/airflow/ui/src/components/DataTable/useRowSelection.ts
index 2daf908820f..174aa5548ba 100644
--- a/airflow-core/src/airflow/ui/src/components/DataTable/useRowSelection.ts
+++ b/airflow-core/src/airflow/ui/src/components/DataTable/useRowSelection.ts
@@ -25,6 +25,7 @@ type UseRowSelectionProps<T> = {
 
 export type GetColumnsParams = {
   allRowsSelected: boolean;
+  multiTeam: boolean;
   onRowSelect: (key: string, isChecked: boolean) => void;
   onSelectAll: (isChecked: boolean) => void;
   selectedRows: Map<string, boolean>;
diff --git a/airflow-core/src/airflow/ui/src/components/TeamSelector.tsx 
b/airflow-core/src/airflow/ui/src/components/TeamSelector.tsx
index b5a84e26abd..6d41ef9a98c 100644
--- a/airflow-core/src/airflow/ui/src/components/TeamSelector.tsx
+++ b/airflow-core/src/airflow/ui/src/components/TeamSelector.tsx
@@ -61,7 +61,8 @@ export const TeamSelector = <T extends FieldValues = 
FieldValues>({ control }: P
                 {...Field}
                 isClearable
                 isDisabled={isLoading}
-                onChange={(val) => onChange(val?.value)}
+                // eslint-disable-next-line unicorn/no-null
+                onChange={(val) => onChange(val?.value ?? null)}
                 options={options}
                 placeholder={translate("team.selector.placeHolder")}
                 value={options.find((option) => option.value === value)}
diff --git a/airflow-core/src/airflow/ui/src/pages/Connections/Connections.tsx 
b/airflow-core/src/airflow/ui/src/pages/Connections/Connections.tsx
index 21b57038e1d..069f5e024de 100644
--- a/airflow-core/src/airflow/ui/src/pages/Connections/Connections.tsx
+++ b/airflow-core/src/airflow/ui/src/pages/Connections/Connections.tsx
@@ -34,6 +34,7 @@ import { Tooltip } from "src/components/ui";
 import { ActionBar } from "src/components/ui/ActionBar";
 import { Checkbox } from "src/components/ui/Checkbox";
 import { SearchParamsKeys, type SearchParamsKeysType } from 
"src/constants/searchParams";
+import { useConfig } from "src/queries/useConfig.tsx";
 import { useConnectionTypeMeta } from "src/queries/useConnectionTypeMeta";
 
 import AddConnectionButton from "./AddConnectionButton";
@@ -58,71 +59,83 @@ export type ConnectionBody = {
 
 const getColumns = ({
   allRowsSelected,
+  multiTeam,
   onRowSelect,
   onSelectAll,
   selectedRows,
   translate,
-}: { translate: TFunction } & GetColumnsParams): 
Array<ColumnDef<ConnectionResponse>> => [
-  {
-    accessorKey: "select",
-    cell: ({ row }) => (
-      <Checkbox
-        borderWidth={1}
-        checked={selectedRows.get(row.original.connection_id)}
-        colorPalette="brand"
-        onCheckedChange={(event) => onRowSelect(row.original.connection_id, 
Boolean(event.checked))}
-      />
-    ),
-    enableHiding: false,
-    enableSorting: false,
-    header: () => (
-      <Checkbox
-        borderWidth={1}
-        checked={allRowsSelected}
-        colorPalette="brand"
-        onCheckedChange={(event) => onSelectAll(Boolean(event.checked))}
-      />
-    ),
-    meta: {
-      skeletonWidth: 10,
+}: { translate: TFunction } & GetColumnsParams): 
Array<ColumnDef<ConnectionResponse>> => {
+  const columns: Array<ColumnDef<ConnectionResponse>> = [
+    {
+      accessorKey: "select",
+      cell: ({ row }) => (
+        <Checkbox
+          borderWidth={1}
+          checked={selectedRows.get(row.original.connection_id)}
+          colorPalette="brand"
+          onCheckedChange={(event) => onRowSelect(row.original.connection_id, 
Boolean(event.checked))}
+        />
+      ),
+      enableHiding: false,
+      enableSorting: false,
+      header: () => (
+        <Checkbox
+          borderWidth={1}
+          checked={allRowsSelected}
+          colorPalette="brand"
+          onCheckedChange={(event) => onSelectAll(Boolean(event.checked))}
+        />
+      ),
+      meta: {
+        skeletonWidth: 10,
+      },
+    },
+    {
+      accessorKey: "connection_id",
+      header: translate("connections.columns.connectionId"),
+    },
+    {
+      accessorKey: "conn_type",
+      header: translate("connections.columns.connectionType"),
+    },
+    {
+      accessorKey: "description",
+      header: translate("columns.description"),
+    },
+    {
+      accessorKey: "host",
+      header: translate("connections.columns.host"),
     },
-  },
-  {
-    accessorKey: "connection_id",
-    header: translate("connections.columns.connectionId"),
-  },
-  {
-    accessorKey: "conn_type",
-    header: translate("connections.columns.connectionType"),
-  },
-  {
-    accessorKey: "description",
-    header: translate("columns.description"),
-  },
-  {
-    accessorKey: "host",
-    header: translate("connections.columns.host"),
-  },
-  {
-    accessorKey: "port",
-    header: translate("connections.columns.port"),
-  },
-  {
-    accessorKey: "actions",
-    cell: ({ row: { original } }) => (
-      <Flex justifyContent="end">
-        <TestConnectionButton connection={original} />
-        <EditConnectionButton connection={original} 
disabled={selectedRows.size > 0} />
-        <DeleteConnectionButton connectionId={original.connection_id} 
disabled={selectedRows.size > 0} />
-      </Flex>
-    ),
-    enableSorting: false,
-    header: "",
-    meta: {
-      skeletonWidth: 10,
+    {
+      accessorKey: "port",
+      header: translate("connections.columns.port"),
     },
-  },
-];
+    {
+      accessorKey: "actions",
+      cell: ({ row: { original } }) => (
+        <Flex justifyContent="end">
+          <TestConnectionButton connection={original} />
+          <EditConnectionButton connection={original} 
disabled={selectedRows.size > 0} />
+          <DeleteConnectionButton connectionId={original.connection_id} 
disabled={selectedRows.size > 0} />
+        </Flex>
+      ),
+      enableSorting: false,
+      header: "",
+      meta: {
+        skeletonWidth: 10,
+      },
+    },
+  ];
+
+  if (multiTeam) {
+    columns.splice(6, 0, {
+      accessorKey: "team_name",
+      header: translate("columns.team"),
+    });
+  }
+
+  return columns;
+};
 
 export const Connections = () => {
   const { t: translate } = useTranslation(["admin", "common"]);
@@ -130,6 +143,7 @@ export const Connections = () => {
   const [searchParams, setSearchParams] = useSearchParams();
   const { NAME_PATTERN, OFFSET }: SearchParamsKeysType = SearchParamsKeys;
   const [connectionIdPattern, setConnectionIdPattern] = 
useState(searchParams.get(NAME_PATTERN) ?? undefined);
+  const multiTeamEnabled = Boolean(useConfig("multi_team"));
 
   useConnectionTypeMeta(); // Pre-fetch connection type metadata
   const { pagination, sorting } = tableURLState;
@@ -150,6 +164,7 @@ export const Connections = () => {
 
   const columns = getColumns({
     allRowsSelected,
+    multiTeam: multiTeamEnabled,
     onRowSelect: handleRowSelect,
     onSelectAll: handleSelectAll,
     selectedRows,
diff --git a/airflow-core/src/airflow/ui/src/pages/Variables/Variables.tsx 
b/airflow-core/src/airflow/ui/src/pages/Variables/Variables.tsx
index 2a12cff2805..aa114b1d95f 100644
--- a/airflow-core/src/airflow/ui/src/pages/Variables/Variables.tsx
+++ b/airflow-core/src/airflow/ui/src/pages/Variables/Variables.tsx
@@ -34,6 +34,7 @@ import { Tooltip } from "src/components/ui";
 import { ActionBar } from "src/components/ui/ActionBar";
 import { Checkbox } from "src/components/ui/Checkbox";
 import { SearchParamsKeys, type SearchParamsKeysType } from 
"src/constants/searchParams";
+import { useConfig } from "src/queries/useConfig.tsx";
 import { TrimText } from "src/utils/TrimText";
 
 import DeleteVariablesButton from "./DeleteVariablesButton";
@@ -44,69 +45,81 @@ import EditVariableButton from 
"./ManageVariable/EditVariableButton";
 
 const getColumns = ({
   allRowsSelected,
+  multiTeam,
   onRowSelect,
   onSelectAll,
   selectedRows,
   translate,
-}: { translate: TFunction } & GetColumnsParams): 
Array<ColumnDef<VariableResponse>> => [
-  {
-    accessorKey: "select",
-    cell: ({ row }) => (
-      <Checkbox
-        borderWidth={1}
-        checked={selectedRows.get(row.original.key)}
-        colorPalette="brand"
-        onCheckedChange={(event) => onRowSelect(row.original.key, 
Boolean(event.checked))}
-      />
-    ),
-    enableHiding: false,
-    enableSorting: false,
-    header: () => (
-      <Checkbox
-        borderWidth={1}
-        checked={allRowsSelected}
-        colorPalette="brand"
-        onCheckedChange={(event) => onSelectAll(Boolean(event.checked))}
-      />
-    ),
-    meta: {
-      skeletonWidth: 10,
+}: { translate: TFunction } & GetColumnsParams): 
Array<ColumnDef<VariableResponse>> => {
+  const columns: Array<ColumnDef<VariableResponse>> = [
+    {
+      accessorKey: "select",
+      cell: ({ row }) => (
+        <Checkbox
+          borderWidth={1}
+          checked={selectedRows.get(row.original.key)}
+          colorPalette="brand"
+          onCheckedChange={(event) => onRowSelect(row.original.key, 
Boolean(event.checked))}
+        />
+      ),
+      enableHiding: false,
+      enableSorting: false,
+      header: () => (
+        <Checkbox
+          borderWidth={1}
+          checked={allRowsSelected}
+          colorPalette="brand"
+          onCheckedChange={(event) => onSelectAll(Boolean(event.checked))}
+        />
+      ),
+      meta: {
+        skeletonWidth: 10,
+      },
+    },
+    {
+      accessorKey: "key",
+      cell: ({ row }) => <TrimText isClickable onClickContent={row.original} 
text={row.original.key} />,
+      header: translate("columns.key"),
+    },
+    {
+      accessorKey: "value",
+      cell: ({ row }) => <TrimText showTooltip text={row.original.value} />,
+      header: translate("columns.value"),
+    },
+    {
+      accessorKey: "description",
+      cell: ({ row }) => <TrimText showTooltip text={row.original.description} 
/>,
+      header: translate("columns.description"),
     },
-  },
-  {
-    accessorKey: "key",
-    cell: ({ row }) => <TrimText isClickable onClickContent={row.original} 
text={row.original.key} />,
-    header: translate("columns.key"),
-  },
-  {
-    accessorKey: "value",
-    cell: ({ row }) => <TrimText showTooltip text={row.original.value} />,
-    header: translate("columns.value"),
-  },
-  {
-    accessorKey: "description",
-    cell: ({ row }) => <TrimText showTooltip text={row.original.description} 
/>,
-    header: translate("columns.description"),
-  },
-  {
-    accessorKey: "is_encrypted",
-    header: translate("variables.columns.isEncrypted"),
-  },
-  {
-    accessorKey: "actions",
-    cell: ({ row: { original } }) => (
-      <Flex justifyContent="end">
-        <EditVariableButton disabled={selectedRows.size > 0} 
variable={original} />
-        <DeleteVariableButton deleteKey={original.key} 
disabled={selectedRows.size > 0} />
-      </Flex>
-    ),
-    enableSorting: false,
-    header: "",
-    meta: {
-      skeletonWidth: 10,
+    {
+      accessorKey: "is_encrypted",
+      header: translate("variables.columns.isEncrypted"),
     },
-  },
-];
+    {
+      accessorKey: "actions",
+      cell: ({ row: { original } }) => (
+        <Flex justifyContent="end">
+          <EditVariableButton disabled={selectedRows.size > 0} 
variable={original} />
+          <DeleteVariableButton deleteKey={original.key} 
disabled={selectedRows.size > 0} />
+        </Flex>
+      ),
+      enableSorting: false,
+      header: "",
+      meta: {
+        skeletonWidth: 10,
+      },
+    },
+  ];
+
+  if (multiTeam) {
+    columns.splice(5, 0, {
+      accessorKey: "team_name",
+      header: translate("columns.team"),
+    });
+  }
+
+  return columns;
+};
 
 export const Variables = () => {
   const { t: translate } = useTranslation("admin");
@@ -120,6 +133,7 @@ export const Variables = () => {
   const { pagination, sorting } = tableURLState;
   const [sort] = sorting;
   const orderBy = sort ? [`${sort.desc ? "-" : ""}${sort.id === "value" ? 
"_val" : sort.id}`] : ["-key"];
+  const multiTeamEnabled = Boolean(useConfig("multi_team"));
 
   const { data, error, isFetching, isLoading } = 
useVariableServiceGetVariables({
     limit: pagination.pageSize,
@@ -136,6 +150,7 @@ export const Variables = () => {
 
   const columns = getColumns({
     allRowsSelected,
+    multiTeam: multiTeamEnabled,
     onRowSelect: handleRowSelect,
     onSelectAll: handleSelectAll,
     selectedRows,
diff --git a/airflow-core/src/airflow/ui/src/queries/useAddVariable.ts 
b/airflow-core/src/airflow/ui/src/queries/useAddVariable.ts
index b3b7388608a..24d3b587e13 100644
--- a/airflow-core/src/airflow/ui/src/queries/useAddVariable.ts
+++ b/airflow-core/src/airflow/ui/src/queries/useAddVariable.ts
@@ -58,12 +58,13 @@ export const useAddVariable = ({ onSuccessConfirm }: { 
onSuccessConfirm: () => v
   const addVariable = (variableRequestBody: VariableBody) => {
     const parsedDescription =
       variableRequestBody.description === "" ? undefined : 
variableRequestBody.description;
+    const teamName = variableRequestBody.team_name === "" ? undefined : 
variableRequestBody.team_name;
 
     mutate({
       requestBody: {
         description: parsedDescription,
         key: variableRequestBody.key,
-        team_name: variableRequestBody.team_name,
+        team_name: teamName,
         value: variableRequestBody.value,
       },
     });
diff --git a/airflow-core/src/airflow/ui/src/queries/useEditVariable.ts 
b/airflow-core/src/airflow/ui/src/queries/useEditVariable.ts
index 4262896fe81..73a0fcab7dc 100644
--- a/airflow-core/src/airflow/ui/src/queries/useEditVariable.ts
+++ b/airflow-core/src/airflow/ui/src/queries/useEditVariable.ts
@@ -63,24 +63,28 @@ export const useEditVariable = (
     onSuccess,
   });
 
-  const editVariable = (addVariableRequestBody: VariableBody) => {
+  const editVariable = (editVariableRequestBody: VariableBody) => {
     const updateMask: Array<string> = [];
 
-    if (addVariableRequestBody.value !== initialVariable.value) {
+    if (editVariableRequestBody.value !== initialVariable.value) {
       updateMask.push("value");
     }
-    if (addVariableRequestBody.description !== initialVariable.description) {
+    if (editVariableRequestBody.description !== initialVariable.description) {
       updateMask.push("description");
     }
+    if (editVariableRequestBody.team_name !== initialVariable.team_name) {
+      updateMask.push("team_name");
+    }
 
     const parsedDescription =
-      addVariableRequestBody.description === "" ? undefined : 
addVariableRequestBody.description;
+      editVariableRequestBody.description === "" ? undefined : 
editVariableRequestBody.description;
 
     mutate({
       requestBody: {
         description: parsedDescription,
-        key: addVariableRequestBody.key,
-        value: addVariableRequestBody.value,
+        key: editVariableRequestBody.key,
+        team_name: editVariableRequestBody.team_name,
+        value: editVariableRequestBody.value,
       },
       updateMask,
       variableKey: initialVariable.key,

Reply via email to