mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-16 17:46:45 +00:00
fix(editor): Workflow diff UX improvements (#19047)
This commit is contained in:
committed by
GitHub
parent
fc094518d6
commit
277685e9e5
@@ -3438,6 +3438,7 @@
|
||||
"workflowDiff.changes": "Changes",
|
||||
"workflowDiff.nodes": "Nodes",
|
||||
"workflowDiff.connectors": "Connectors",
|
||||
"workflowDiff.compare": "Compare versions",
|
||||
"workflowDiff.settings": "Settings",
|
||||
"workflowDiff.local": "Local",
|
||||
"workflowDiff.remote": "Remote ({branchName})",
|
||||
|
||||
@@ -15,7 +15,15 @@ import {
|
||||
notifyUserAboutPullWorkFolderOutcome,
|
||||
} from '@/utils/sourceControlUtils';
|
||||
import { type SourceControlledFile, SOURCE_CONTROL_FILE_TYPE } from '@n8n/api-types';
|
||||
import { N8nBadge, N8nButton, N8nHeading, N8nInfoTip, N8nLink, N8nText } from '@n8n/design-system';
|
||||
import {
|
||||
N8nBadge,
|
||||
N8nButton,
|
||||
N8nHeading,
|
||||
N8nInfoTip,
|
||||
N8nLink,
|
||||
N8nText,
|
||||
N8nTooltip,
|
||||
} from '@n8n/design-system';
|
||||
import { useI18n } from '@n8n/i18n';
|
||||
import type { EventBus } from '@n8n/utils/event-bus';
|
||||
import dateformat from 'dateformat';
|
||||
@@ -355,12 +363,17 @@ onMounted(() => {
|
||||
{{ getStatusText(file.status) }}
|
||||
</N8nBadge>
|
||||
<template v-if="isWorkflowDiffsEnabled">
|
||||
<N8nIconButton
|
||||
<N8nTooltip
|
||||
v-if="file.type === SOURCE_CONTROL_FILE_TYPE.workflow"
|
||||
:content="i18n.baseText('workflowDiff.compare')"
|
||||
placement="top"
|
||||
>
|
||||
<N8nIconButton
|
||||
icon="file-diff"
|
||||
type="secondary"
|
||||
@click="openDiffModal(file.id)"
|
||||
/>
|
||||
</N8nTooltip>
|
||||
</template>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@@ -33,6 +33,7 @@ import {
|
||||
N8nPopover,
|
||||
N8nSelect,
|
||||
N8nText,
|
||||
N8nTooltip,
|
||||
} from '@n8n/design-system';
|
||||
import { useI18n } from '@n8n/i18n';
|
||||
import type { EventBus } from '@n8n/utils/event-bus';
|
||||
@@ -889,12 +890,17 @@ onMounted(async () => {
|
||||
{{ getStatusText(file.status) }}
|
||||
</N8nBadge>
|
||||
<template v-if="isWorkflowDiffsEnabled">
|
||||
<N8nIconButton
|
||||
<N8nTooltip
|
||||
v-if="file.type === SOURCE_CONTROL_FILE_TYPE.workflow"
|
||||
:content="i18n.baseText('workflowDiff.compare')"
|
||||
placement="top"
|
||||
>
|
||||
<N8nIconButton
|
||||
icon="file-diff"
|
||||
type="secondary"
|
||||
@click="openDiffModal(file.id)"
|
||||
/>
|
||||
</N8nTooltip>
|
||||
</template>
|
||||
</span>
|
||||
</N8nCheckbox>
|
||||
|
||||
@@ -40,6 +40,10 @@ const props = withDefaults(
|
||||
border: none;
|
||||
border-radius: 0;
|
||||
|
||||
:global(.blob-num) {
|
||||
display: none;
|
||||
}
|
||||
|
||||
&:global([theme='dark']) {
|
||||
--fgColor-default: var(--color-text-dark);
|
||||
--bgColor-default: var(--color-background-light);
|
||||
|
||||
@@ -133,7 +133,7 @@ describe('WorkflowDiffModal', () => {
|
||||
|
||||
// Component should render with the basic structure
|
||||
expect(container.querySelector('.header')).toBeInTheDocument();
|
||||
expect(container.querySelector('h1')).toBeInTheDocument();
|
||||
expect(container.querySelector('h4')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('should initialize with correct props', () => {
|
||||
|
||||
@@ -267,9 +267,16 @@ const nodeDiffs = computed(() => {
|
||||
const targetNode = targetWorkFlow.value?.state.value?.workflow?.nodes.find(
|
||||
(node) => node.id === selectedDetailId.value,
|
||||
);
|
||||
function replacer(key: string, value: unknown) {
|
||||
if (key === 'position') {
|
||||
return undefined; // exclude this property
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
return {
|
||||
oldString: JSON.stringify(sourceNode, null, 2) ?? '',
|
||||
newString: JSON.stringify(targetNode, null, 2) ?? '',
|
||||
oldString: JSON.stringify(sourceNode, replacer, 2) ?? '',
|
||||
newString: JSON.stringify(targetNode, replacer, 2) ?? '',
|
||||
};
|
||||
});
|
||||
|
||||
@@ -399,7 +406,7 @@ const modifiers = [
|
||||
icon-size="large"
|
||||
@click="handleBeforeClose"
|
||||
></N8nIconButton>
|
||||
<N8nHeading tag="h1" size="xlarge">
|
||||
<N8nHeading tag="h4" size="medium">
|
||||
{{
|
||||
sourceWorkFlow.state.value?.workflow?.name ||
|
||||
targetWorkFlow.state.value?.workflow?.name
|
||||
|
||||
Reference in New Issue
Block a user