Added add

This commit is contained in:
Pünkösd Marcell 2020-12-04 04:46:37 +01:00
parent 5676ec38d2
commit 5c9ced0423

View File

@ -91,7 +91,7 @@
<script> <script>
import SimpleFlowchart from '@/simple-flowchart'; import SimpleFlowchart from '@/simple-flowchart';
import maxBy from 'lodash';
export default { export default {
name: 'Dashboard', name: 'Dashboard',
@ -140,8 +140,42 @@ export default {
this.showNewElementChooser = true; this.showNewElementChooser = true;
}, },
newElement(type) { newElement(type) {
console.log(type);
this.showNewElementChooser = false; this.showNewElementChooser = false;
let newNode = {
x: 10,
y: 10,
type
}
switch (type) {
case "ingest":
newNode.data = {
"url": "https://videon.test.kmlabz.com/live"
}
break;
case "encoder":
newNode.data = {
"bitrate": 8000,
"width": 600,
"height": 800
}
break;
case "restreamer":
newNode.data = {
"url": "https://youtube.com/live",
"streamkey": "testkey"
}
break;
}
const max_id = maxBy(this.diagram.nodes, (o) => {o.id})
newNode.id = max_id + 1;
this.diagram.nodes.push(newNode)
} }
} }
@ -156,11 +190,4 @@ export default {
#diagram-container { #diagram-container {
height: calc(100% - 64px); height: calc(100% - 64px);
} }
#fab-holder {
position: absolute;
z-index: 5;
right: 2rem;
bottom: 2rem;
}
</style> </style>