New tasks properly marked as valid or invalid when added in a stage.
This commit is contained in:
parent
99dfd14ec9
commit
f1da101e4e
@ -16,7 +16,7 @@ import {
|
||||
export const StageOfGeneralTaskEditor: React.FC<CapabilityEditorProps> = (
|
||||
props,
|
||||
) => {
|
||||
const { task, onChange, onValidate, fieldErrors } = props;
|
||||
const { task, onChange, onValidate, onValidateTask, fieldErrors } = props;
|
||||
|
||||
const [tasksMetadata, setTasksMetadata] = React.useState<TaskMetadata[]>([]);
|
||||
|
||||
@ -52,6 +52,9 @@ export const StageOfGeneralTaskEditor: React.FC<CapabilityEditorProps> = (
|
||||
|
||||
const isValid = Object.keys(errors).length === 0;
|
||||
|
||||
// Mark the child task as valid/invalid
|
||||
onValidateTask?.(newTask.config.guid as string, isValid);
|
||||
|
||||
task.config.tasks = updatedTasks;
|
||||
|
||||
onChange(task);
|
||||
|
||||
@ -106,7 +106,8 @@ const TaskEditorComponent: React.FC<TaskEditorProps> = ({
|
||||
task={task}
|
||||
tasks={tasks}
|
||||
onChange={handleTaskChange}
|
||||
fieldErrors={fieldErrors} // ← THIS IS THE MISSING PIECE
|
||||
fieldErrors={fieldErrors}
|
||||
onValidateTask={onValidate}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
|
||||
@ -17,6 +17,7 @@ export interface CapabilityEditorProps {
|
||||
tasks: TaskDefinition[];
|
||||
onChange: (updated: TaskDefinition) => void;
|
||||
onValidate: (result: TaskValidationResult) => void;
|
||||
onValidateTask?: (taskId: string, isValid: boolean) => void;
|
||||
fieldErrors: Record<string, string>;
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user