Skip to content

Commit

Permalink
Remove minimum height on elements in Flexible Form (apache#46591)
Browse files Browse the repository at this point in the history
* Remove minimum height on elements in Flexible Form

* Fix helper description consistency in display
  • Loading branch information
jscheffl authored Feb 12, 2025
1 parent 34261d0 commit f4165fe
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 10 deletions.
18 changes: 11 additions & 7 deletions airflow/ui/src/components/FlexibleForm/FieldRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,17 +40,21 @@ export const FieldRow = ({ name }: FlexibleFormElementProps) => {
return (
<Field.Root orientation="horizontal" required={isRequired(param)}>
<Stack>
<Field.Label fontSize="md">
<Field.Label fontSize="md" style={{ flexBasis: "30%" }}>
{param.schema.title ?? name} <Field.RequiredIndicator />
</Field.Label>
</Stack>
<Stack css={{ "flex-basis": "70%" }}>
<Stack css={{ flexBasis: "70%" }}>
<FieldSelector name={name} />
<Field.HelperText>
{param.description ?? (
<Markdown remarkPlugins={[remarkGfm]}>{param.schema.description_md}</Markdown>
)}
</Field.HelperText>
{param.description === null ? (
param.schema.description_md === undefined ? undefined : (
<Field.HelperText>
<Markdown remarkPlugins={[remarkGfm]}>{param.schema.description_md}</Markdown>
</Field.HelperText>
)
) : (
<Field.HelperText>{param.description}</Field.HelperText>
)}
</Stack>
</Field.Root>
);
Expand Down
6 changes: 4 additions & 2 deletions airflow/ui/src/components/TriggerDag/useParamStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ import { create } from "zustand";
import type { DagParamsSpec, ParamSpec } from "src/queries/useDagParams";

export const paramPlaceholder: ParamSpec = {
description: undefined,
// eslint-disable-next-line unicorn/no-null
description: null,
schema: {
const: undefined,
description_md: undefined,
Expand Down Expand Up @@ -70,7 +71,8 @@ export const useParamStore = create<FormStore>((set) => ({
return [
key,
{
description: existingParam?.description,
// eslint-disable-next-line unicorn/no-null
description: existingParam?.description ?? null,
schema: existingParam?.schema ?? paramPlaceholder.schema,
value: value as unknown,
},
Expand Down
2 changes: 1 addition & 1 deletion airflow/ui/src/queries/useDagParams.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import { toaster } from "src/components/ui";
export type DagParamsSpec = Record<string, ParamSpec>;

export type ParamSpec = {
description: string | undefined;
description: string | null;
schema: ParamSchema;
value: unknown;
};
Expand Down

0 comments on commit f4165fe

Please sign in to comment.