diff --git a/src/views/Dashboard.vue b/src/views/Dashboard.vue index 47aaff2..90fbd23 100644 --- a/src/views/Dashboard.vue +++ b/src/views/Dashboard.vue @@ -239,7 +239,7 @@ export default { Promise.all(creation_promises).then(() => { let update_promises = []; - pendingChangesSnapshot.created.forEach((id) => { + pendingChangesSnapshot.updated.forEach((id) => { const changed_node = modelSnapshot.nodes.find((n) => n.id === id); if (changed_node) { update_promises.push(new Promise((resolve, reject) => { @@ -264,7 +264,7 @@ export default { // 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)); + output_neighbors = modelSnapshot.nodes.filter((node) => map(output_links, 'to').includes(node.id)); } } @@ -322,7 +322,7 @@ export default { this.processingModelDownload = true; this.$api.get('objects/streamerobjects').then((resp) => { - + // Load bare nodes first resp.data.forEach((apiNode) => { const type_map = { @@ -354,7 +354,7 @@ export default { break; case "restreamer": newNode.data = { - url: apiNode.url, + url: apiNode.output_urls[0] || '', streamkey: apiNode.stream_key } break; @@ -367,6 +367,27 @@ export default { }); + // Load links between nodes + let linkIdGenerator = 1; + resp.data.forEach((apiNode) => { + if (apiNode.inputNeighbour) { + const dst_node = this.model.nodes.find((node) => node.apiId === apiNode.id); + const src_node = this.model.nodes.find((node) => node.apiId === apiNode.inputNeighbour); + if (src_node && dst_node) { + + const newLink = { + id: linkIdGenerator, + from: src_node.id, + to: dst_node.id + } + + linkIdGenerator++; + + this.model.links.push(newLink); + + } + } + }); this.processingModelDownload = false; });