Fixed unreachable url

This commit is contained in:
Pünkösd Marcell 2020-12-06 19:42:57 +01:00
parent 73a30e5478
commit ae1754ca1f
2 changed files with 20 additions and 11 deletions

View File

@ -88,7 +88,7 @@
<div class="node-content node-content-long" v-if="type === 'ingest'"> <div class="node-content node-content-long" v-if="type === 'ingest'">
<span v-if="this.apiId === null">Apply first!</span> <span v-if="this.apiId === null">Apply first!</span>
<span v-else><b>URL:</b> {{this.url}}</span> <span v-else><b>URL:</b> {{this.data.url}}</span>
</div> </div>
<div class="node-content" v-else-if="type === 'encoder'"> <div class="node-content" v-else-if="type === 'encoder'">

View File

@ -211,6 +211,12 @@ export default {
this.$api.post(`objects/streamerobjects/${translated_type}`, data).then((resp) => { this.$api.post(`objects/streamerobjects/${translated_type}`, data).then((resp) => {
new_node.apiId = resp.data.id; 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(); return resolve();
}).catch(reject); }).catch(reject);
@ -236,18 +242,21 @@ export default {
} }
// Find neighbors // Find neighbors
// Input first
let input_neighbor = null; let input_neighbor = null;
let output_neighbors = [];
if (modelSnapshot.links.length > 0) {
// Input first
const input_link = modelSnapshot.links.find((link) => link.to === changed_node.id); const input_link = modelSnapshot.links.find((link) => link.to === changed_node.id);
if (input_link) { if (input_link) {
input_neighbor = modelSnapshot.nodes.find((node) => node.id === input_link.from); input_neighbor = modelSnapshot.nodes.find((node) => node.id === input_link.from);
} }
// Then output // Then output
let output_neighbors = [];
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) { if (output_links.length > 0) {
output_neighbors = modelSnapshot.nodes.filter((node) => node.id === input_link.to); output_neighbors = modelSnapshot.nodes.filter((node) => map(output_links,'to').includes(node.id));
}
} }
// Compile type specific attributes // Compile type specific attributes