import { type ReactNode } from 'react'; import type { GraphEdit } from '../editing.js'; import { type DialogShellProps, type Json, type OpenOnAdd } from './editorFields.js'; import { type SettingsView } from './settingsViews.js'; export declare const SSH_KEYS: readonly ['remoteHost', 'remoteUser', 'jumpNodeHost', 'jumpNodeUser', 'disconnect-timeout']; /** What the job dialog writes; the schema coverage test holds these to the workflow schema. */ export declare const JOB_FIELDS: readonly ['needs', 'if', 'ssh', 'runs-on', 'working-directory', 'timeout', 'env', 'outputs', 'strategy']; export declare const RUNS_ON_FIELDS: readonly ['environment', 'environment.cluster', 'environment.name', 'params', 'mode', 'targetId', 'environmentId', 'schedulingParams', 'newWorker', 'workerId']; export declare const STRATEGY_FIELDS: readonly ['matrix', 'matrix.include', 'matrix.exclude', 'fail-fast', 'max-parallel']; /** What the step dialog writes. */ export declare const STEP_FIELDS: readonly ['name', 'run', 'shell', 'uses', 'with', 'if', 'working-directory', 'id', 'timeout', 'ignore-errors', 'early-cancel', 'cleanup', 'retry', 'env', 'ssh']; export declare const RETRY_FIELDS: readonly ['max-retries', 'interval', 'timeout', 'clean-on-retry']; interface ViewProps { source?: string | undefined; /** Adds the job or step being edited; applied with the first save, so canceling adds nothing. */ addition?: GraphEdit | undefined; /** The view to open in; YAML unless the host says form. */ view?: SettingsView | undefined; onViewChange?: ((view: SettingsView) => void) | undefined; openOnAdd?: OpenOnAdd | undefined; } interface JobDialogProps { job: string; jobs: Json; inputs: Json | undefined; workflow?: Json | undefined; onEdit: (edit: GraphEdit) => void; onClose: () => void; } interface StepDialogProps { job: string; index: number; steps: unknown[]; inputs: Json | undefined; workflow?: Json | undefined; usesSuggestions: string[]; onEdit: (edit: GraphEdit) => void; onClose: () => void; } /** What a job or step form hands the dialog around it, so the same settings can be edited as YAML. */ export interface SettingsFormHooks { renderShell?: ((props: DialogShellProps) => ReactNode) | undefined; /** Called on each render with the edit Save would send, and whether a field is invalid. */ onDraft?: ((edit: GraphEdit | null, invalid: boolean) => void) | undefined; /** Edits made in the YAML view are waiting to be saved. */ pending?: boolean; /** The step exists only once saved, so deleting it just closes the dialog. */ adding?: boolean; } interface SettingsViewsOptions extends ViewProps { onEdit: (edit: GraphEdit) => void; onClose: () => void; /** What the dialog edits, by the name the job dialog can change. */ name: string; read: (workflow: string, name: string) => string; write: (name: string, yaml: string) => GraphEdit; scope: (name: string) => string[]; /** Keys right under the scope whose problems belong to other editors. */ exclude?: string[]; /** Whether empty text, meaning no settings at all, is fine. */ optional?: boolean; /** The YAML shows a job's settings, not its key, so its view renames through a field. */ rename?: { label: string; description: string; error: (next: string, current: string) => string | undefined; edit: (from: string, to: string) => GraphEdit; /** The name a form draft gives the job. */ from: (draft: GraphEdit | null) => string | undefined; }; } type FormHost = Required>; /** A dialog's settings in a form or as YAML, with the edits carried across a switch. */ export declare function useSettingsViews(o: SettingsViewsOptions): { start: string | undefined; yaml: string | null; name: string; version: number; current: Record | null; yamlDialog: (title: string, path: string, text: string) => import("react").JSX.Element; formDialog: (render: (host: FormHost) => ReactNode) => import("react").JSX.Element; }; /** A job's settings in a form, or as YAML; switching carries the edits across. */ export declare function JobDialog(props: JobDialogProps & ViewProps): import("react").JSX.Element; /** A step's settings in a form, or as YAML; switching carries the edits across. */ export declare function StepDialog(props: StepDialogProps & ViewProps): import("react").JSX.Element; export {};