mirror of
https://github.com/n8n-io/n8n.git
synced 2026-10-22 04:21:32 +02:00
fix(editor): Disable WF version menu only when all actions are unavailable (backport to release-candidate/2.18.x) (#29326)
Co-authored-by: Daria <daria.staferova@n8n.io>
This commit is contained in:
parent
6508bce89b
commit
263f0b723e
|
|
@ -494,6 +494,21 @@ describe('WorkflowHeaderDraftPublishActions', () => {
|
|||
expect(queryByTestId('workflow-open-publish-modal-button')).toBeDisabled();
|
||||
});
|
||||
|
||||
it('should keep the version menu enabled when workflow is published with no changes', () => {
|
||||
workflowsStore.workflowTriggerNodes = [triggerNode];
|
||||
workflowsStore.workflow.versionId = 'version-1';
|
||||
workflowDocumentStore.setActiveState({
|
||||
activeVersionId: 'version-1',
|
||||
activeVersion: createMockActiveVersion('version-1'),
|
||||
});
|
||||
uiStore.markStateClean();
|
||||
|
||||
const { getByTestId } = renderComponent();
|
||||
|
||||
expect(getByTestId('workflow-open-publish-modal-button')).toBeDisabled();
|
||||
expect(getByTestId('version-menu-button')).not.toBeDisabled();
|
||||
});
|
||||
|
||||
it('should show publish button enabled when workflow has never been published (no active version)', () => {
|
||||
workflowsStore.workflowTriggerNodes = [triggerNode];
|
||||
workflowsStore.workflow.versionId = 'version-1';
|
||||
|
|
|
|||
|
|
@ -352,6 +352,10 @@ const versionMenuActions = computed<Array<ActionDropdownItem<VERSION_ACTIONS>>>(
|
|||
return actions;
|
||||
});
|
||||
|
||||
const shouldDisableActionDropdown = computed(() => {
|
||||
return versionMenuActions.value.every((action) => action.disabled);
|
||||
});
|
||||
|
||||
const onNameVersion = async () => {
|
||||
// If there are unsaved changes, save the workflow first
|
||||
if (uiStore.stateIsDirty || props.isNewWorkflow) {
|
||||
|
|
@ -560,7 +564,7 @@ defineExpose({
|
|||
:class="$style.groupButtonRight"
|
||||
variant="ghost"
|
||||
icon="chevron-down"
|
||||
:disabled="!publishButtonConfig.enabled || shouldDisablePublishButton"
|
||||
:disabled="shouldDisableActionDropdown"
|
||||
:aria-label="i18n.baseText('node.moreActions')"
|
||||
data-test-id="version-menu-button"
|
||||
/>
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user