@@ -248,7 +248,7 @@ export default {
248248 },
249249 computed: {
250250 statusText : function () {
251- if (this .$data . status ) {
251+ if (this .status ) {
252252 return ' Coderbot risulta online e funzionante. '
253253 } else {
254254 return ' Coderbot risulta offline e rotto'
@@ -258,17 +258,17 @@ export default {
258258 mounted () {
259259
260260 let axios = this .$axios
261- this .$data . status = null
261+ this .status = null
262262 this .pollStatus ();
263263 setInterval (function () {
264264 this .pollStatus ();
265265 }.bind (this ), 1000 )
266266
267267
268- axios .get (this .$data . CBv1 + ' /config' )
268+ axios .get (this .CBv1 + ' /config' )
269269 .then (function (response ) {
270270 var settings = response .data
271- this .$data . settings = settings
271+ this .settings = settings
272272 this .initBlockly (settings)
273273 }.bind (this ))
274274
@@ -287,7 +287,7 @@ export default {
287287 var serializedToolbox = this .$base64 .decode (b64Toolbox)
288288
289289 // Initialise Blockly Instance
290- this .$data . workspace = Blockly .inject (
290+ this .workspace = Blockly .inject (
291291 // Blockly container
292292 this .$refs .blocklyDiv ,
293293 // Options
@@ -312,7 +312,7 @@ export default {
312312
313313 // Initial resize
314314 this .resizeWorkspace ()
315- Blockly .svgResize (this .$data . workspace );
315+ Blockly .svgResize (this .workspace );
316316
317317
318318 },
@@ -322,8 +322,8 @@ export default {
322322 },
323323 getProgramData () {
324324 console .log (" get" )
325- let name = this .$data . programName
326- let workspace = this .$data . workspace
325+ let name = this .programName
326+ let workspace = this .workspace
327327 let xml_code = Blockly .Xml .workspaceToDom (Blockly .mainWorkspace );
328328 let dom_code = Blockly .Xml .domToText (xml_code);
329329
@@ -339,7 +339,7 @@ export default {
339339 const blob = new Blob ([data], { type: ' text/json' })
340340 const e = document .createEvent (' MouseEvents' ),
341341 a = document .createElement (' a' );
342- a .download = this .$data . programName + ' .json' || ' noname.json'
342+ a .download = this .programName + ' .json' || ' noname.json'
343343 a .href = window .URL .createObjectURL (blob);
344344 a .dataset .downloadurl = [' text/json' , a .download , a .href ].join (' :' );
345345 e .initEvent (' click' , true , false , window , 0 , 0 , 0 , 0 , 0 , false , false , false , false , 0 , null );
@@ -352,7 +352,7 @@ export default {
352352 importProgram (e ) {
353353 // Once the file is selected, read it and populate the Blockly
354354 // workspace with the contained program
355- let workspace = this .$data . workspace
355+ let workspace = this .workspace
356356 const files = e .target .files
357357 if (files[0 ] !== undefined ) {
358358 let fileName = files[0 ].name
@@ -371,18 +371,18 @@ export default {
371371 }
372372 },
373373 saveProgramAs : function (e ) {
374- if (this .$data . newProgramName != ' ' ) {
375- this .$data . programName = this . $data .newProgramName
376- this .$data . newProgramName = ' '
374+ if (this .newProgramName != ' ' ) {
375+ this .programName = this .newProgramName
376+ this .newProgramName = ' '
377377 this .saveProgram ()
378378 } else {
379- this .$data . unvalidName = true
379+ this .unvalidName = true
380380 }
381381 },
382382 saveProgram () {
383- if (this .$data . programName != ' ' ) {
383+ if (this .programName != ' ' ) {
384384 let axios = this .$axios
385- let CB = this .$data . CB
385+ let CB = this .CB
386386 console .log (" save" )
387387 let data = this .getProgramData ()
388388 axios .post (CB + ' /save' , {
@@ -394,25 +394,25 @@ export default {
394394 console .log (" salvato" )
395395 })
396396 } else {
397- this .$data . unvalidName = true
397+ this .unvalidName = true
398398 }
399399 },
400400 loadProgramList () {
401401 let axios = this .$axios
402- let CBv1 = this .$data . CBv1
403- // let programList = this.$data. programList
402+ let CBv1 = this .CBv1
403+ // let programList = this.programList
404404 axios .get (CBv1 + ' /program/list' )
405405 .then (function (response ) {
406- this .$data . carica = true ,
407- this .$data . programList = response .data ;
406+ this .carica = true ,
407+ this .programList = response .data ;
408408 }.bind (this ))
409409 },
410410 loadProgram (program ) {
411411 let axios = this .$axios
412- let CBv1 = this .$data . CBv1
413- let workspace = this .$data . workspace
414- this .$data . carica = false ;
415- this .$data . programName = program
412+ let CBv1 = this .CBv1
413+ let workspace = this .workspace
414+ this .carica = false ;
415+ this .programName = program
416416 axios .get (CBv1 + ' /program/load' , {
417417 params: {
418418 name: program,
@@ -425,17 +425,17 @@ export default {
425425 }.bind (this ))
426426 },
427427 deleteProgramDlg (program ) {
428- this .$data . newProgramName = program
429- this .$data . del = true
428+ this .newProgramName = program
429+ this .del = true
430430 },
431431 deleteProgram (program ) {
432- if (this .$data . programName == program) {
433- this .$data . programName = ' '
434- this .$data . code = ' '
435- this .$data . workspace .clear ()
432+ if (this .programName == program) {
433+ this .programName = ' '
434+ this .code = ' '
435+ this .workspace .clear ()
436436 }
437437 let axios = this .$axios
438- let CB = this .$data . CB
438+ let CB = this .CB
439439 console .log (" delete" )
440440 axios .post (CB + ' /delete' , {
441441 name: program
@@ -446,28 +446,28 @@ export default {
446446 },
447447 pollStatus () {
448448 let axios = this .$axios
449- let CB = this .$data . CB
450- let status = this .$data . status
449+ let CB = this .CB
450+ let status = this .status
451451 axios .get (CB + ' /status' )
452452 .then (function (response ) {
453- if (this .$data . status == 0 && response .status ) {
454- this .$data . snackText = ' CoderBot è tornato online'
455- this .$data . snackbar = true
453+ if (this .status == 0 && response .status ) {
454+ this .snackText = ' CoderBot è tornato online'
455+ this .snackbar = true
456456 }
457457
458458 // console.log(response)
459- this .$data . statusData = response .data
460- this .$data . status = response .status
459+ this .statusData = response .data
460+ this .status = response .status
461461 }.bind (this ))
462462 .catch (function (error ) {
463463 // handle error
464464 console .log (error);
465465
466- if (this .$data . status ) {
467- this .$data . snackText = ' CoderBot irrangiungibile'
468- this .$data . snackbar = true
466+ if (this .status ) {
467+ this .snackText = ' CoderBot irrangiungibile'
468+ this .snackbar = true
469469 }
470- this .$data . status = 0
470+ this .status = 0
471471 }.bind (this ))
472472 },
473473 resizeWorkspace () {
@@ -483,25 +483,25 @@ export default {
483483 this .$refs .blocklyDiv .style .height = ` ${ offsetHeight} px` ;
484484 },
485485 getProgramCode () {
486- if (this .$data . experimental ) {
487- this .$data . experimental = false ;
488- this .blocksExtensions (this .$data . settings );
489- this .$data . experimental = true ;
486+ if (this .experimental ) {
487+ this .experimental = false ;
488+ this .blocksExtensions (this .settings );
489+ this .experimental = true ;
490490 }
491491
492492 Blockly .Python .STATEMENT_PREFIX = null ;
493493 Blockly .Python .addReservedWords ();
494494 Blockly .Python .INFINITE_LOOP_TRAP = null ;
495- this .$data . code = Blockly .Python .workspaceToCode (this . $data .workspace );
496- console .log (this .$data . code )
497- this .$data . dialogCode = true
495+ this .code = Blockly .Python .workspaceToCode (this .workspace );
496+ console .log (this .code )
497+ this .dialogCode = true
498498
499- if (this .$data . experimental ) {
500- this .blocksExtensions (this .$data . settings )
499+ if (this .experimental ) {
500+ this .blocksExtensions (this .settings )
501501 }
502502 },
503503 runProgramExperimental () {
504- if (this .$data . status ) {
504+ if (this .status ) {
505505 var xml_code = Blockly .Xml .workspaceToDom (Blockly .mainWorkspace );
506506 var dom_code = Blockly .Xml .domToText (xml_code);
507507 Blockly .Python .INFINITE_LOOP_TRAP = null ;
@@ -514,21 +514,21 @@ export default {
514514 name: ' Hello, World' ,
515515 dom_code,
516516 code: code_modified,
517- mode: this .$data . execMode
517+ mode: this .execMode
518518 })
519519
520520 }
521521 },
522522 runProgram () {
523- if (this .$data . status ) {
523+ if (this .status ) {
524524 let axios = this .$axios
525- let CB = this .$data . CB
525+ let CB = this .CB
526526 // POST /program/save
527- var xml_code = Blockly .Xml .workspaceToDom (this .$data . workspace );
527+ var xml_code = Blockly .Xml .workspaceToDom (this .workspace );
528528 var dom_code = Blockly .Xml .domToText (xml_code);
529529 window .LoopTrap = 1000 ;
530530 Blockly .Python .INFINITE_LOOP_TRAP = ' get_prog_eng().check_end()\n ' ;
531- var code = Blockly .Python .workspaceToCode (this .$data . workspace );
531+ var code = Blockly .Python .workspaceToCode (this .workspace );
532532 Blockly .Python .INFINITE_LOOP_TRAP = null ;
533533
534534 axios .post (CB + ' /exec' , {
@@ -540,23 +540,23 @@ export default {
540540 console .log (response);
541541 })
542542 } else {
543- this .$data . generalDialog = true ;
544- this .$data . generalDialogTitle = ' Errore' ,
545- this .$data . generalDialogText = ' Il coderbot risulta offline, non puoi eseguire il programma.'
543+ this .generalDialog = true ;
544+ this .generalDialogTitle = ' Errore' ,
545+ this .generalDialogText = ' Il coderbot risulta offline, non puoi eseguire il programma.'
546546 }
547547 },
548548 runProgramLegacy () {
549- if (this .$data . status ) {
549+ if (this .status ) {
550550 let axios = this .$axios
551- let CB = this .$data . CB
551+ let CB = this .CB
552552 let qs = this .$qs
553553
554554 // POST /program/save
555- var xml_code = Blockly .Xml .workspaceToDom (this .$data . workspace );
555+ var xml_code = Blockly .Xml .workspaceToDom (this .workspace );
556556 var dom_code = Blockly .Xml .domToText (xml_code);
557557 window .LoopTrap = 1000 ;
558558 Blockly .Python .INFINITE_LOOP_TRAP = ' get_prog_eng().check_end()\n ' ;
559- var code = Blockly .Python .workspaceToCode (this .$data . workspace );
559+ var code = Blockly .Python .workspaceToCode (this .workspace );
560560 Blockly .Python .INFINITE_LOOP_TRAP = null ;
561561
562562 var valuesAsString = qs .stringify ({
@@ -565,15 +565,15 @@ export default {
565565 ' code' : code,
566566 })
567567
568- axios .post (this .$data . CBv1 + ' /program/exec' , valuesAsString)
568+ axios .post (this .CBv1 + ' /program/exec' , valuesAsString)
569569 .then (function (response ) {
570570 console .log (response)
571571 })
572572
573573 }
574574 },
575575 blocksExtensions (settings ) {
576- var settings = this .$data . settings
576+ var settings = this .settings
577577 var cfg = Object ();
578578
579579 // coderbot.cfg data (temp workaround, must be fetched from backend)
@@ -634,7 +634,7 @@ export default {
634634
635635 var sbsPrefix
636636
637- if (this .$data . experimental ) {
637+ if (this .experimental ) {
638638 // Append "Command." to enable stepbystep
639639 sbsPrefix = " Command."
640640 } else {
0 commit comments