@@ -393,7 +393,6 @@ export default {
393393 } else {
394394 toolboxJSON = this .activity .toolbox ;
395395 }
396- console .log (this .settings );
397396 this .toolbox = toolboxJSON;
398397 });
399398
@@ -537,21 +536,8 @@ export default {
537536
538537 saveProgram () {
539538 if (this .programName != ' ' ) {
540- const axios = this .$axios ;
541- const {
542- CB
543- } = this ;
544- const {
545- overwrite
546- } = this .$data ;
547- console .log (' save' );
548539 const data = this .getProgramData ();
549- axios .post (` ${ CB } /saveProgram?overwrite=${ overwrite} ` , {
550- name: data .name ,
551- dom_code: data .dom_code ,
552- code: data .code ,
553- default: ' ' ,
554- }).then ((prog_data ) => {
540+ this .$coderbot .saveProgram (this .$data .overwrite , data .name , data .dom_code , data .code , ' ' ).then ((prog_data ) => {
555541 if (prog_data .data == ' defaultOverwrite' || prog_data .data == ' askOverwrite' ) {
556542 if (prog_data .data == ' askOverwrite' ) {
557543 this .$data .overwriteDialog = true ;
@@ -574,29 +560,17 @@ export default {
574560
575561 loadProgramList () {
576562 // Get the list of available programs and populate the popup
577- const axios = this .$axios ;
578- const {
579- CB
580- } = this .$data ;
581- axios .get (` ${ CB } /list` )
563+ this .$coderbot .listPrograms ()
582564 .then ((response ) => {
583565 this .$data .carica = true ;
584566 this .$data .programList = response .data ;
585567 });
586568 },
587569
588570 loadProgram (program ) {
589- const axios = this .$axios ;
590- const {
591- CB
592- } = this .$data ;
593571 this .$data .carica = false ;
594572 this .$data .programName = program;
595- axios .get (` ${ CB } /load` , {
596- params: {
597- name: program,
598- },
599- }).then ((data ) => {
573+ this .$coderbot .loadProgram (this .$data .programName ).then ((data ) => {
600574 this .$refs .workspace .loadProgram (data .data .dom_code );
601575 this .$data .isDefault = data .data .default ;
602576 });
@@ -625,24 +599,14 @@ export default {
625599 this .$data .code = ' ' ;
626600 this .$data .workspace .clear ();
627601 }
628- const axios = this .$axios ;
629- const {
630- CB
631- } = this .$data ;
632602 console .log (' delete' );
633- axios .post (` ${ CB } /delete` , {
634- name: program,
635- }).then (() => {
603+ this .$coderbot .deleteProgram (program).then (() => {
636604 console .log (' deleted' );
637605 });
638606 },
639607
640608 pollStatus () {
641- const axios = this .$axios ;
642- const {
643- CB
644- } = this ;
645- axios .get (` ${ CB } /status` )
609+ this .$coderbot .status ()
646610 .then ((response ) => {
647611 // If the reconnection happened while in this component, send a notification
648612 if (this .status == 0 && response .status ) {
@@ -652,7 +616,7 @@ export default {
652616 this .statusData = response .data ;
653617 this .status = response .status ;
654618 });
655- axios . get ( ` ${ this . CB } / info` )
619+ this . $coderbot . info ( )
656620 .then ((response ) => {
657621 this .info = response .data ;
658622 })
@@ -668,27 +632,16 @@ export default {
668632 },
669633
670634 getProgramCode () {
671- this .code = this .workspace .getProgramCode ();
635+ this .code = this .$refs . workspace .getProgramCode ();
672636 this .dialogCode = true ;
673637 },
674638
675639 runProgram () {
676640 if (this .status ) {
677- const axios = this .$axios ;
678- const {
679- CB
680- } = this ;
681641 // POST /program/save
682642 const options = this .activity ;
683-
684643 const { dom_code , code } = this .$refs .workspace .getProgramData ();
685-
686- axios .post (` ${ CB } /exec` , {
687- name: ' run program' ,
688- dom_code,
689- code,
690- options,
691- }).then (() => {
644+ this .$coderbot .execProgram (dom_code, code, options).then (() => {
692645 this .runtimeDialog = true ;
693646 setTimeout (() => {
694647 this .updateExecStatus ();
@@ -703,14 +656,12 @@ export default {
703656
704657 stopProgram () {
705658 console .log (' Stopping' );
706- const axios = this .$axios ;
707- axios .post (` ${ this .CBv1 } /program/end` );
659+ this .$coderbot .stopProgram ();
708660 },
709661
710662 updateExecStatus () {
711- const axios = this .$axios ;
712663 console .log (' Updating Execution status' );
713- axios . get ( ` ${ this . CBv1 } /program/status ` )
664+ this . $coderbot . programStatus ( )
714665 .then ((response ) => {
715666 this .program_status = response .data .running ;
716667 if (this .program_status ) {
0 commit comments