From ae1754ca1f210dfcb02aef7b6f9379119010f58b Mon Sep 17 00:00:00 2001 From: marcsello Date: Sun, 6 Dec 2020 19:42:57 +0100 Subject: [PATCH] Fixed unreachable url --- .../components/FlowchartNode.vue | 2 +- src/views/Dashboard.vue | 29 ++++++++++++------- 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/src/simple-flowchart/components/FlowchartNode.vue b/src/simple-flowchart/components/FlowchartNode.vue index 09a7778..d885f3c 100644 --- a/src/simple-flowchart/components/FlowchartNode.vue +++ b/src/simple-flowchart/components/FlowchartNode.vue @@ -88,7 +88,7 @@
Apply first! - URL: {{this.url}} + URL: {{this.data.url}}
diff --git a/src/views/Dashboard.vue b/src/views/Dashboard.vue index 4fa76b9..6bed34f 100644 --- a/src/views/Dashboard.vue +++ b/src/views/Dashboard.vue @@ -211,6 +211,12 @@ export default { this.$api.post(`objects/streamerobjects/${translated_type}`, data).then((resp) => { new_node.apiId = resp.data.id; + + const original_node = this.model.nodes.find((n) => n.id === id); + if (original_node) { + original_node.apiId = resp.data.id; + } + return resolve(); }).catch(reject); @@ -236,18 +242,21 @@ export default { } // Find neighbors - // Input first - let input_neighbor = null; - const input_link = modelSnapshot.links.find((link) => link.to === changed_node.id); - if (input_link) { - input_neighbor = modelSnapshot.nodes.find((node) => node.id === input_link.from); - } - // Then output + let input_neighbor = null; let output_neighbors = []; - const output_links = modelSnapshot.links.filter((link) => link.from === changed_node.id); - if (output_links) { - output_neighbors = modelSnapshot.nodes.filter((node) => node.id === input_link.to); + if (modelSnapshot.links.length > 0) { + // Input first + const input_link = modelSnapshot.links.find((link) => link.to === changed_node.id); + if (input_link) { + input_neighbor = modelSnapshot.nodes.find((node) => node.id === input_link.from); + } + + // Then output + const output_links = modelSnapshot.links.filter((link) => link.from === changed_node.id); + if (output_links.length > 0) { + output_neighbors = modelSnapshot.nodes.filter((node) => map(output_links,'to').includes(node.id)); + } } // Compile type specific attributes