use getter

This commit is contained in:
Mutasem 2021-10-15 17:05:53 +02:00
parent 80705f6bc8
commit edc5390089

View file

@ -267,7 +267,7 @@ export default mixins(
executionWaitingForWebhook (): boolean { executionWaitingForWebhook (): boolean {
return this.$store.getters.executionWaitingForWebhook; return this.$store.getters.executionWaitingForWebhook;
}, },
lastSelectedNode (): INodeUi { lastSelectedNode (): INodeUi | null {
return this.$store.getters.lastSelectedNode; return this.$store.getters.lastSelectedNode;
}, },
nodes (): INodeUi[] { nodes (): INodeUi[] {
@ -656,7 +656,7 @@ export default mixins(
this.callDebounced('saveCurrentWorkflow', 1000); this.callDebounced('saveCurrentWorkflow', 1000);
} else if (e.key === 'Enter') { } else if (e.key === 'Enter') {
// Activate the last selected node // Activate the last selected node
const lastSelectedNode = this.$store.getters.lastSelectedNode; const lastSelectedNode = this.lastSelectedNode;
if (lastSelectedNode !== null) { if (lastSelectedNode !== null) {
this.$store.commit('setActiveNode', lastSelectedNode.name); this.$store.commit('setActiveNode', lastSelectedNode.name);
@ -669,7 +669,7 @@ export default mixins(
this.callDebounced('selectDownstreamNodes', 1000); this.callDebounced('selectDownstreamNodes', 1000);
} else if (e.key === 'ArrowRight') { } else if (e.key === 'ArrowRight') {
// Set child node active // Set child node active
const lastSelectedNode = this.$store.getters.lastSelectedNode; const lastSelectedNode = this.lastSelectedNode;
if (lastSelectedNode === null) { if (lastSelectedNode === null) {
return; return;
} }
@ -689,7 +689,7 @@ export default mixins(
this.callDebounced('selectUpstreamNodes', 1000); this.callDebounced('selectUpstreamNodes', 1000);
} else if (e.key === 'ArrowLeft') { } else if (e.key === 'ArrowLeft') {
// Set parent node active // Set parent node active
const lastSelectedNode = this.$store.getters.lastSelectedNode; const lastSelectedNode = this.lastSelectedNode;
if (lastSelectedNode === null) { if (lastSelectedNode === null) {
return; return;
} }
@ -711,7 +711,7 @@ export default mixins(
// Set sibling node as active // Set sibling node as active
// Check first if it has a parent node // Check first if it has a parent node
const lastSelectedNode = this.$store.getters.lastSelectedNode; const lastSelectedNode = this.lastSelectedNode;
if (lastSelectedNode === null) { if (lastSelectedNode === null) {
return; return;
} }
@ -795,7 +795,7 @@ export default mixins(
}, },
selectUpstreamNodes () { selectUpstreamNodes () {
const lastSelectedNode = this.$store.getters.lastSelectedNode as INodeUi | null; const lastSelectedNode = this.lastSelectedNode;
if (lastSelectedNode === null) { if (lastSelectedNode === null) {
return; return;
} }
@ -812,7 +812,7 @@ export default mixins(
this.nodeSelectedByName(lastSelectedNode.name); this.nodeSelectedByName(lastSelectedNode.name);
}, },
selectDownstreamNodes () { selectDownstreamNodes () {
const lastSelectedNode = this.$store.getters.lastSelectedNode as INodeUi | null; const lastSelectedNode = this.lastSelectedNode;
if (lastSelectedNode === null) { if (lastSelectedNode === null) {
return; return;
} }
@ -1177,7 +1177,7 @@ export default mixins(
}; };
// Check if there is a last selected node // Check if there is a last selected node
const lastSelectedNode = this.$store.getters.lastSelectedNode; const lastSelectedNode = this.lastSelectedNode;
const lastSelectedNodeOutputIndex = this.$store.getters.lastSelectedNodeOutputIndex; const lastSelectedNodeOutputIndex = this.$store.getters.lastSelectedNodeOutputIndex;
if (lastSelectedNode) { if (lastSelectedNode) {
// If a node is active then add the new node directly after the current one // If a node is active then add the new node directly after the current one