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 @@ -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


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11548,7 +11548,6 @@ components:
required:
- name
- slots
- description
- include_deferred
- occupied_slots
- running_slots
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
14 changes: 12 additions & 2 deletions airflow-core/src/airflow/ui/src/pages/Pools/PoolForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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>
)}
/>
Expand Down Expand Up @@ -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")}
Expand Down
5 changes: 2 additions & 3 deletions airflow-core/src/airflow/ui/src/queries/useEditPool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"],
Expand Down