This is an automated email from the ASF dual-hosted git repository.
guanmingchiu pushed a commit to branch v3-1-test
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/v3-1-test by this push:
new f929d4eccf7 [v3-1-test] Patch pools should have an optional
description (#58066) (#58169)
f929d4eccf7 is described below
commit f929d4eccf7f88e92a6c7b86c8cecf8ff3c687a2
Author: github-actions[bot]
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Wed Nov 12 16:56:57 2025 +0800
[v3-1-test] Patch pools should have an optional description (#58066)
(#58169)
(cherry picked from commit 3afad4d908d3fd5c8212cda7e6889aa83b74b8d3)
Co-authored-by: Shubham Raj
<[email protected]>
---
.../src/airflow/api_fastapi/core_api/datamodels/pools.py | 2 +-
.../core_api/openapi/v2-rest-api-generated.yaml | 1 -
.../src/airflow/ui/openapi-gen/requests/schemas.gen.ts | 2 +-
.../src/airflow/ui/openapi-gen/requests/types.gen.ts | 2 +-
airflow-core/src/airflow/ui/src/pages/Pools/PoolForm.tsx | 14 ++++++++++++--
airflow-core/src/airflow/ui/src/queries/useEditPool.ts | 5 ++---
.../unit/api_fastapi/core_api/routes/public/test_pools.py | 6 ------
7 files changed, 17 insertions(+), 15 deletions(-)
diff --git a/airflow-core/src/airflow/api_fastapi/core_api/datamodels/pools.py
b/airflow-core/src/airflow/api_fastapi/core_api/datamodels/pools.py
index 4342d04c1e1..34cf4cb9825 100644
--- a/airflow-core/src/airflow/api_fastapi/core_api/datamodels/pools.py
+++ b/airflow-core/src/airflow/api_fastapi/core_api/datamodels/pools.py
@@ -39,7 +39,7 @@ class BasePool(BaseModel):
pool: str = Field(serialization_alias="name")
slots: int
- description: str | None
+ description: str | None = Field(default=None)
include_deferred: bool
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 5298d0d38ba..bef548133c6 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
@@ -11548,7 +11548,6 @@ components:
required:
- name
- slots
- - description
- include_deferred
- occupied_slots
- running_slots
diff --git a/airflow-core/src/airflow/ui/openapi-gen/requests/schemas.gen.ts
b/airflow-core/src/airflow/ui/openapi-gen/requests/schemas.gen.ts
index 02747de08e4..3f0ebb2b821 100644
--- a/airflow-core/src/airflow/ui/openapi-gen/requests/schemas.gen.ts
+++ b/airflow-core/src/airflow/ui/openapi-gen/requests/schemas.gen.ts
@@ -4393,7 +4393,7 @@ export const $PoolResponse = {
}
},
type: 'object',
- required: ['name', 'slots', 'description', 'include_deferred',
'occupied_slots', 'running_slots', 'queued_slots', 'scheduled_slots',
'open_slots', 'deferred_slots'],
+ required: ['name', 'slots', 'include_deferred', 'occupied_slots',
'running_slots', 'queued_slots', 'scheduled_slots', 'open_slots',
'deferred_slots'],
title: 'PoolResponse',
description: 'Pool serializer for responses.'
} as const;
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 834e522fdf0..18efcbc82ba 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
@@ -1157,7 +1157,7 @@ export type PoolPatchBody = {
export type PoolResponse = {
name: string;
slots: number;
- description: string | null;
+ description?: string | null;
include_deferred: boolean;
occupied_slots: number;
running_slots: number;
diff --git a/airflow-core/src/airflow/ui/src/pages/Pools/PoolForm.tsx
b/airflow-core/src/airflow/ui/src/pages/Pools/PoolForm.tsx
index 37260eca66e..38860f453a4 100644
--- a/airflow-core/src/airflow/ui/src/pages/Pools/PoolForm.tsx
+++ b/airflow-core/src/airflow/ui/src/pages/Pools/PoolForm.tsx
@@ -87,7 +87,17 @@ const PoolForm = ({ error, initialPool, isPending,
manageMutate, setError }: Poo
render={({ field }) => (
<Field.Root mt={4}>
<Field.Label
fontSize="md">{translate("pools.form.slots")}</Field.Label>
- <Input {...field} min={initialPool.slots} size="sm" type="number"
/>
+ <Input
+ min={initialPool.slots}
+ onChange={(event) => {
+ const value = event.target.valueAsNumber;
+
+ field.onChange(isNaN(value) ? field.value : value);
+ }}
+ size="sm"
+ type="number"
+ value={field.value}
+ />
</Field.Root>
)}
/>
@@ -128,7 +138,7 @@ const PoolForm = ({ error, initialPool, isPending,
manageMutate, setError }: Poo
<Spacer />
<Button
colorPalette="brand"
- disabled={!isValid || isPending}
+ disabled={!isValid || isPending || !isDirty}
onClick={() => void handleSubmit(onSubmit)()}
>
<FiSave /> {translate("formActions.save")}
diff --git a/airflow-core/src/airflow/ui/src/queries/useEditPool.ts
b/airflow-core/src/airflow/ui/src/queries/useEditPool.ts
index 6cafe2b696e..eb55f2109e7 100644
--- a/airflow-core/src/airflow/ui/src/queries/useEditPool.ts
+++ b/airflow-core/src/airflow/ui/src/queries/useEditPool.ts
@@ -65,20 +65,19 @@ export const useEditPool = (
const editPool = (editPoolRequestBody: PoolBody) => {
const updateMask: Array<string> = [];
+ let parsedDescription = undefined;
if (editPoolRequestBody.slots !== initialPool.slots) {
updateMask.push("slots");
}
if (editPoolRequestBody.description !== initialPool.description) {
+ parsedDescription = editPoolRequestBody.description;
updateMask.push("description");
}
if (editPoolRequestBody.include_deferred !== initialPool.include_deferred)
{
updateMask.push("include_deferred");
}
- const parsedDescription =
- editPoolRequestBody.description === "" ? undefined :
editPoolRequestBody.description;
-
mutate({
poolName: initialPool.name,
requestBody: {
diff --git
a/airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_pools.py
b/airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_pools.py
index 8112ed06d76..a444af70f70 100644
--- a/airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_pools.py
+++ b/airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_pools.py
@@ -250,12 +250,6 @@ class TestPatchPool(TestPoolsEndpoint):
"msg": "Field required",
"type": "missing",
},
- {
- "input": {"pool": POOL1_NAME},
- "loc": ["description"],
- "msg": "Field required",
- "type": "missing",
- },
{
"input": {"pool": POOL1_NAME},
"loc": ["include_deferred"],