fix rename bug

This commit is contained in:
Mutasem 2022-04-07 20:27:46 +02:00
parent e583a983f6
commit 555192969b
3 changed files with 20 additions and 3 deletions

View file

@ -1,6 +1,6 @@
<template> <template>
<el-dialog <el-dialog
:visible="!!node" :visible="!!node || renaming"
:before-close="close" :before-close="close"
:show-close="false" :show-close="false"
custom-class="data-display-wrapper" custom-class="data-display-wrapper"
@ -48,6 +48,11 @@ export default mixins(externalHooks, nodeHelpers, workflowHelpers).extend({
NodeSettings, NodeSettings,
RunData, RunData,
}, },
props: {
renaming: {
type: Boolean,
},
},
data () { data () {
return { return {
settingsEventBus: new Vue(), settingsEventBus: new Vue(),

View file

@ -370,7 +370,6 @@ export default mixins(
}; };
this.$emit('valueChanged', sendData); this.$emit('valueChanged', sendData);
this.$store.commit('setActiveNode', newValue);
} else if (parameterData.name.startsWith('parameters.')) { } else if (parameterData.name.startsWith('parameters.')) {
// A node parameter changed // A node parameter changed

View file

@ -33,7 +33,7 @@
></node> ></node>
</div> </div>
</div> </div>
<DataDisplay @valueChanged="valueChanged"/> <DataDisplay :renaming="renamingActive" @valueChanged="valueChanged"/>
<div v-if="!createNodeActive && !isReadOnly" class="node-creator-button" :title="$locale.baseText('nodeView.addNode')" @click="() => openNodeCreator('add_node_button')"> <div v-if="!createNodeActive && !isReadOnly" class="node-creator-button" :title="$locale.baseText('nodeView.addNode')" @click="() => openNodeCreator('add_node_button')">
<n8n-icon-button size="xlarge" icon="plus" /> <n8n-icon-button size="xlarge" icon="plus" />
</div> </div>
@ -348,6 +348,7 @@ export default mixins(
pullConnActiveNodeName: null as string | null, pullConnActiveNodeName: null as string | null,
pullConnActive: false, pullConnActive: false,
dropPrevented: false, dropPrevented: false,
renamingActive: false,
}; };
}, },
beforeDestroy () { beforeDestroy () {
@ -2244,6 +2245,13 @@ export default mixins(
if (currentName === newName) { if (currentName === newName) {
return; return;
} }
const activeNodeName = this.activeNode && this.activeNode.name;
const isActive = activeNodeName === currentName;
if (isActive) {
this.renamingActive = true;
}
// Check if node-name is unique else find one that is // Check if node-name is unique else find one that is
newName = this.getUniqueNodeName({ newName = this.getUniqueNodeName({
originalName: newName, originalName: newName,
@ -2271,6 +2279,11 @@ export default mixins(
// Make sure that the node is selected again // Make sure that the node is selected again
this.deselectAllNodes(); this.deselectAllNodes();
this.nodeSelectedByName(newName); this.nodeSelectedByName(newName);
if (isActive) {
this.$store.commit('setActiveNode', newName);
this.renamingActive = false;
}
}, },
deleteEveryEndpoint () { deleteEveryEndpoint () {
// Check as it does not exist on first load // Check as it does not exist on first load