77
77
Esecuzione
78
78
</v-card-title >
79
79
<v-card-text >
80
- <v-img :src =" webcamStream" />
80
+ <v-img :src =" webcamStream" />
81
81
</v-card-text >
82
82
<v-divider ></v-divider >
83
+ {{ log }}
83
84
<v-card-actions >
84
85
<v-spacer ></v-spacer >
85
- <v-btn color =" primary" flat @click =" runtimeDialog = false" >
86
+ <v-btn color =" primary" flat @click =" runtimeDialog = false; stopProgram() " >
86
87
Chiudi
87
88
</v-btn >
88
89
</v-card-actions >
@@ -238,6 +239,7 @@ export default {
238
239
},
239
240
data : () => ({
240
241
242
+ log: null ,
241
243
settings: null ,
242
244
snackText: null ,
243
245
snackbar: false ,
@@ -372,7 +374,7 @@ export default {
372
374
this .$refs .file .click ()
373
375
},
374
376
importProgram (e ) {
375
- // Once the file is selected, read it and populate the Blockly
377
+ // Once the file is selected, read it and populate the Blockly
376
378
// workspace with the contained program
377
379
let workspace = this .workspace
378
380
const files = e .target .files
@@ -559,6 +561,7 @@ export default {
559
561
code
560
562
})
561
563
.then (function (response ) {
564
+
562
565
console .log (response);
563
566
})
564
567
} else {
@@ -572,7 +575,7 @@ export default {
572
575
let axios = this .$axios
573
576
let CB = this .CB
574
577
let qs = this .$qs
575
-
578
+ this . log = " "
576
579
// POST /program/save
577
580
var xml_code = Blockly .Xml .workspaceToDom (this .workspace );
578
581
var dom_code = Blockly .Xml .domToText (xml_code);
@@ -591,10 +594,36 @@ export default {
591
594
.then (function (response ) {
592
595
console .log (response)
593
596
this .runtimeDialog = true ;
597
+ setTimeout (function () {
598
+ this .updateExecStatus ();
599
+ }.bind (this ), 1000 )
594
600
}.bind (this ))
595
601
596
602
}
597
603
},
604
+ stopProgram (){
605
+ console .log (" Stopping" )
606
+ let axios = this .$axios
607
+ axios .post (this .CBv1 + ' /program/end' )
608
+ },
609
+ updateExecStatus () {
610
+ let axios = this .$axios
611
+ console .log (" Updating Execution status" )
612
+ axios .get (this .CBv1 + ' /program/status' )
613
+ .then (function (response ) {
614
+ console .log (response .data )
615
+ if (response .data .running ) {
616
+ // Check again in a second
617
+ setTimeout (function () {
618
+ this .updateExecStatus ();
619
+ }.bind (this ), 1000 )
620
+ this .log = response .data .log
621
+ } else {
622
+ this .log = " Esecuzione conclusa"
623
+ }
624
+ }.bind (this ))
625
+
626
+ },
598
627
blocksExtensions (settings ) {
599
628
var settings = this .settings
600
629
var cfg = Object ();
0 commit comments