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 @@ -172,12 +172,12 @@ describe('WorkflowDetailHeader', () => {
expect(result.getByTestId('runWorkflowHeaderButton')).toBeDisabled();
});

it('disables run workflow button when yaml has validation errors', () => {
it('enables run workflow button when yaml has validation errors', () => {
const result = renderWithProviders(<WorkflowDetailHeader {...defaultProps} />, {
isValid: true,
hasYamlSchemaValidationErrors: true,
});
expect(result.getByTestId('runWorkflowHeaderButton')).toBeDisabled();
expect(result.getByTestId('runWorkflowHeaderButton')).toBeEnabled();
});

it('disables enabled toggle when yaml has validation errors', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,15 +139,16 @@ export const WorkflowDetailHeader = React.memo(

// Combined validity: syntax must parse AND no strict validation errors AND server considers it valid.
// workflow?.valid !== false covers the initial page load before Monaco validates.
const isValid = isSyntaxValid && !hasYamlSchemaValidationErrors && workflow?.valid !== false;
const isSchemaValid =
isSyntaxValid && !hasYamlSchemaValidationErrors && workflow?.valid !== false;

const runWorkflowTooltipContent = useMemo(() => {
return getTestRunTooltipContent({
isExecutionsTab,
isValid,
isValid: isSyntaxValid,
canRunWorkflow: canExecuteWorkflow,
});
}, [isValid, canExecuteWorkflow, isExecutionsTab]);
}, [isSyntaxValid, canExecuteWorkflow, isExecutionsTab]);

const saveWorkflowTooltipContent = useMemo(() => {
const isCreate = !workflowId;
Expand Down Expand Up @@ -268,7 +269,7 @@ export const WorkflowDetailHeader = React.memo(
? i18n.translate('workflows.workflowDetailHeader.unsaved', {
defaultMessage: 'Save changes to enable/disable workflow',
})
: !isValid
: !isSchemaValid
? i18n.translate('workflows.workflowDetailHeader.invalid', {
defaultMessage: 'Fix validation errors to enable workflow',
})
Expand All @@ -280,7 +281,7 @@ export const WorkflowDetailHeader = React.memo(
!workflowId ||
isLoading ||
!canUpdateWorkflow ||
!isValid ||
!isSchemaValid ||
hasUnsavedChanges
}
checked={isEnabled}
Expand All @@ -298,7 +299,7 @@ export const WorkflowDetailHeader = React.memo(
iconType="play"
size="s"
onClick={handleRunClickWithUnsavedCheck}
disabled={isExecutionsTab || !canExecuteWorkflow || isLoading || !isValid}
disabled={isExecutionsTab || !canExecuteWorkflow || isLoading || !isSyntaxValid}
aria-label={Translations.runWorkflow}
data-test-subj="runWorkflowHeaderButton"
/>
Expand Down
Loading