Implemented loading of nodes
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
09dd2572f9
commit
c074752b89
@ -56,6 +56,7 @@ export default {
|
||||
},
|
||||
pendingNodeMoves: 0, // count of inflight coord modifications
|
||||
processingNodeChanges: false,
|
||||
processingModelDownload: false,
|
||||
model: {
|
||||
centerX: 0,
|
||||
centerY: 0,
|
||||
@ -317,6 +318,59 @@ export default {
|
||||
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
this.processingModelDownload = true;
|
||||
this.$api.get('objects/streamerobjects').then((resp) => {
|
||||
|
||||
|
||||
resp.data.forEach((apiNode) => {
|
||||
|
||||
const type_map = {
|
||||
1: "ingest",
|
||||
2: "encoder",
|
||||
3: "restreamer"
|
||||
}
|
||||
|
||||
let newNode = {
|
||||
x: apiNode.x,
|
||||
y: apiNode.y,
|
||||
type: type_map[apiNode.resource_type],
|
||||
apiId: apiNode.id
|
||||
}
|
||||
|
||||
switch (newNode.type) {
|
||||
case "ingest":
|
||||
newNode.data = {
|
||||
url: apiNode.url,
|
||||
streamkey: apiNode.stream_key
|
||||
}
|
||||
break;
|
||||
case "encoder":
|
||||
newNode.data = {
|
||||
bitrate: apiNode.bitrate,
|
||||
width: apiNode.width,
|
||||
height: apiNode.height
|
||||
}
|
||||
break;
|
||||
case "restreamer":
|
||||
newNode.data = {
|
||||
url: apiNode.url,
|
||||
streamkey: apiNode.stream_key
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
newNode.id = this.idGenerator;
|
||||
this.idGenerator++;
|
||||
|
||||
this.model.nodes.push(newNode);
|
||||
|
||||
});
|
||||
|
||||
|
||||
this.processingModelDownload = false;
|
||||
});
|
||||
},
|
||||
computed: {
|
||||
modelChanged() {
|
||||
return some(this.pendingChanges, (o) => o.length > 0);
|
||||
|
Loading…
Reference in New Issue
Block a user