did good
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Pünkösd Marcell 2020-12-07 02:48:57 +01:00
parent c09079ecae
commit 1d5d3df570

View File

@ -239,7 +239,7 @@ export default {
Promise.all(creation_promises).then(() => { Promise.all(creation_promises).then(() => {
let update_promises = []; let update_promises = [];
pendingChangesSnapshot.created.forEach((id) => { pendingChangesSnapshot.updated.forEach((id) => {
const changed_node = modelSnapshot.nodes.find((n) => n.id === id); const changed_node = modelSnapshot.nodes.find((n) => n.id === id);
if (changed_node) { if (changed_node) {
update_promises.push(new Promise((resolve, reject) => { update_promises.push(new Promise((resolve, reject) => {
@ -264,7 +264,7 @@ export default {
// Then output // Then output
const output_links = modelSnapshot.links.filter((link) => link.from === changed_node.id); const output_links = modelSnapshot.links.filter((link) => link.from === changed_node.id);
if (output_links.length > 0) { 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.processingModelDownload = true;
this.$api.get('objects/streamerobjects').then((resp) => { this.$api.get('objects/streamerobjects').then((resp) => {
// Load bare nodes first
resp.data.forEach((apiNode) => { resp.data.forEach((apiNode) => {
const type_map = { const type_map = {
@ -354,7 +354,7 @@ export default {
break; break;
case "restreamer": case "restreamer":
newNode.data = { newNode.data = {
url: apiNode.url, url: apiNode.output_urls[0] || '',
streamkey: apiNode.stream_key streamkey: apiNode.stream_key
} }
break; 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; this.processingModelDownload = false;
}); });