mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 10:02:05 +00:00
feat(editor): Handle pin data edge cases and unify validation (no-changelog) (#6685)
Github issue / Community forum post (link here to close automatically):
This commit is contained in:
@@ -241,6 +241,7 @@ import { useUniqueNodeName } from '@/composables/useUniqueNodeName';
|
||||
import { useI18n } from '@/composables/useI18n';
|
||||
import { workflowHelpers } from '@/mixins/workflowHelpers';
|
||||
import { workflowRun } from '@/mixins/workflowRun';
|
||||
import { pinData } from '@/mixins/pinData';
|
||||
|
||||
import NodeDetailsView from '@/components/NodeDetailsView.vue';
|
||||
import Node from '@/components/Node.vue';
|
||||
@@ -367,6 +368,7 @@ export default defineComponent({
|
||||
workflowHelpers,
|
||||
workflowRun,
|
||||
debounceHelper,
|
||||
pinData,
|
||||
],
|
||||
components: {
|
||||
NodeDetailsView,
|
||||
@@ -1719,10 +1721,6 @@ export default defineComponent({
|
||||
});
|
||||
});
|
||||
|
||||
if (workflowData.pinData) {
|
||||
this.workflowsStore.setWorkflowPinData(workflowData.pinData);
|
||||
}
|
||||
|
||||
const tagsEnabled = this.settingsStore.areTagsEnabled;
|
||||
if (importTags && tagsEnabled && Array.isArray(workflowData.tags)) {
|
||||
const allTags = await this.tagsStore.fetchAll();
|
||||
@@ -3234,12 +3232,13 @@ export default defineComponent({
|
||||
|
||||
await this.addNodes([newNodeData], [], true);
|
||||
|
||||
const pinData = this.workflowsStore.pinDataByNodeName(nodeName);
|
||||
if (pinData) {
|
||||
this.workflowsStore.pinData({
|
||||
node: newNodeData,
|
||||
data: pinData,
|
||||
});
|
||||
const pinDataForNode = this.workflowsStore.pinDataByNodeName(nodeName);
|
||||
if (pinDataForNode?.length) {
|
||||
try {
|
||||
this.setPinData(newNodeData, pinDataForNode, 'duplicate-node');
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
}
|
||||
|
||||
this.uiStore.stateIsDirty = true;
|
||||
@@ -3963,6 +3962,29 @@ export default defineComponent({
|
||||
tempWorkflow.renameNode(oldName, nodeNameTable[oldName]);
|
||||
}
|
||||
|
||||
if (data.pinData) {
|
||||
let pinDataSuccess = true;
|
||||
for (const nodeName of Object.keys(data.pinData)) {
|
||||
// Pin data limit reached
|
||||
if (!pinDataSuccess) {
|
||||
this.showError(
|
||||
new Error(this.$locale.baseText('ndv.pinData.error.tooLarge.description')),
|
||||
this.$locale.baseText('ndv.pinData.error.tooLarge.title'),
|
||||
);
|
||||
continue;
|
||||
}
|
||||
|
||||
const node = tempWorkflow.nodes[nodeNameTable[nodeName]];
|
||||
try {
|
||||
this.setPinData(node, data.pinData![nodeName], 'add-nodes');
|
||||
pinDataSuccess = true;
|
||||
} catch (error) {
|
||||
pinDataSuccess = false;
|
||||
console.error(error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Add the nodes with the changed node names, expressions and connections
|
||||
this.historyStore.startRecordingUndo();
|
||||
await this.addNodes(
|
||||
|
||||
Reference in New Issue
Block a user