174174 <v-card-text>
175175 </v-card-text>
176176 </v-tab-item>
177-
178177 -->
179178 <v-tab-item >
180179 <v-container grid-list-md text-xs-center >
481480 {{ updateStatusText }}
482481 <v-btn @click =" refresh" color =" error" >Aggiorna</v-btn >
483482 </template >
484- <template v-if =" updateStatus == 2 " >
483+ <template v-if =" updateStatus == 2 || updateStatus == 3 " >
484+ <b >Installazione fallita</b >
485+ <br >
486+ {{ updateStatusText }}
487+ <v-btn @click =" refresh" color =" error" >Aggiorna</v-btn >
485488 </template >
486489 <template v-if =" updateStatus == 0 " >
487490 <v-text-field label =" Seleziona il pacchetto da installare" @click =' pickFile' v-model =' fileName' prepend-icon =' attach_file' ></v-text-field >
517520
518521<script >
519522import sidebar from " ../components/Sidebar"
520-
521523function readTextFile (file , callback ) {
522524 var rawFile = new XMLHttpRequest ();
523525 rawFile .overrideMimeType (" application/json" );
@@ -547,9 +549,7 @@ var datapkg = readTextFile( "./static/music_package.json" , function(text){
547549 })
548550 return packageList;
549551});
550-
551552export default {
552-
553553 components: { sidebar },
554554 name: ' Settings' ,
555555 mounted () {
@@ -559,7 +559,6 @@ export default {
559559 }.bind (this ), 1000 )
560560 let axios = this .$axios
561561 let settings = this .settings
562-
563562 this .getInfoAndStatus ();
564563 this .prepopulate ();
565564 },
@@ -575,27 +574,27 @@ export default {
575574 this .formdata .append (' file_to_upload' , files[0 ], files[0 ].name );
576575
577576 },
578-
579577
580578 uploadPackage () {
581579 let qs = this .$qs
582580 var pkgName = qs .stringify ({
583581 ' nameID' : this .fileName ,
584- })
585-
582+ })
586583 this .$axios .post (this .CB + ' /updatePackages' , this .formdata ).then (function (result ) {
587-
588- this .updateStatus = 1
589-
584+ this .updateStatus = result .data ;
590585 this .uploadCompleted = true ;
591586 this .uploadInProgress = false ;
587+ this .updateStatusText = ' Clicca "AGGIORNA" per visualizzare le modifiche.' ;
592588 console .dir (result .data );
593-
594- this .updateStatusText = ' Clicca "AGGIORNA" per visualizzare le modifiche.'
595-
589+ if (this .updateStatus == 2 ){
590+ this .updateStatusText = ' Aggiornamento non avvenuto, il pacchetto è già presente con una versione successiva a quella che vuoi installare.' ;
591+ }
592+ if (this .updateStatus == 3 ){
593+ this .updateStatusText = ' Aggiornamento non avvenuto, pacchetto già presente con stessa versione.' ;
594+ }
596595 }.bind (this ))
597-
598- },
596+ },
597+
599598
600599 upload () {
601600 const config = {
@@ -605,16 +604,12 @@ export default {
605604 }
606605 }
607606 this .updateStatus = 1
608-
609607 this .$axios .post (this .CB + ' /updateFromPackage' , this .formdata , config).then (function (result ) {
610608 this .uploadCompleted = true ;
611609 this .uploadInProgress = false ;
612610 console .dir (result .data );
613-
614611 this .updateStatusText = ' Upload completato. Riavvio in corso.'
615-
616612 }.bind (this ))
617-
618613 },
619614
620615 refresh (){
@@ -629,7 +624,6 @@ export default {
629624 });
630625*/
631626 },
632-
633627 /* readTextFile(file, callback) {
634628 var rawFile = new XMLHttpRequest();
635629 rawFile.overrideMimeType("application/json");
@@ -639,7 +633,6 @@ export default {
639633 callback(rawFile.responseText);
640634 }
641635 }
642-
643636 rawFile.send(null);
644637 },
645638*/
@@ -679,13 +672,11 @@ export default {
679672 this .dialog = false
680673 }.bind (this ))
681674 },
682-
683675 shutdown () {
684676 let axios = this .$axios
685677 let CBv1 = this .CBv1
686678 axios .get (CBv1 + ' /bot' , { params: { cmd: ' halt' } })
687679 .then (function (response ) {
688-
689680 this .snackText = ' Coderbot in spegnimento..'
690681 this .snackbar = true
691682 })
@@ -702,7 +693,6 @@ export default {
702693 getInfoAndStatus () {
703694 // Get bot info and status
704695 let axios = this .$axios
705-
706696 axios .get (this .CB + ' /status' )
707697 .then (function (response ) {
708698 this .cb .status = response .data
@@ -725,23 +715,20 @@ export default {
725715 this .getInfoAndStatus ();
726716 this .prepopulate ();
727717 }
728-
729718 this .statusData = response .data
730719 this .status = response .status
731720 this .cb .logs .log = response .data .log
732721 }.bind (this ))
733722 .catch (function (error ) {
734723 // handle error
735724 console .log (error);
736-
737725 if (this .status ) {
738726 this .snackText = ' CoderBot irrangiungibile'
739727 this .snackbar = true
740728 }
741729 this .status = 0
742730 }.bind (this ))
743731 },
744-
745732 deletePkg (pkgNameID ){
746733 let CBv1 = this .CBv1
747734 let axios = this .$axios
@@ -758,7 +745,6 @@ export default {
758745 window .location .reload ();
759746 }.bind (this ))
760747 },
761-
762748 prepopulate : function () {
763749 let axios = this .$axios
764750 let settings = this .settings
@@ -807,13 +793,11 @@ export default {
807793 sound_start: "$startup.mp3"
808794 sound_stop: "$shutdown.mp3"
809795 */
810-
811796 data .power = [remoteConfig .move_power_angle_1 , remoteConfig .move_power_angle_2 , remoteConfig .move_power_angle_3 ]
812797 data .btnFun = remoteConfig .button_func
813798 // ?
814799 /*
815800 data.wifiMode = remoteConfig.wifi_mode
816-
817801 data.wifiSSID = remoteConfig.wifi_ssid
818802 data.wifiPsw = remoteConfig.wifi_psk
819803 */
@@ -824,29 +808,24 @@ export default {
824808 data .shutterSound = remoteConfig .sound_shutter
825809 data .startupProgram = remoteConfig .load_at_start
826810 data .progLevel = remoteConfig .prog_level
827-
828811 data .moveFwdElapse = remoteConfig .move_fw_elapse
829812 data .moveFwdSpeed = remoteConfig .move_fw_speed
830813 data .moveTurnElapse = remoteConfig .move_tr_elapse
831814 data .moveTurnSpeed = remoteConfig .move_tr_speed
832-
833815 data .ctrlFwdElapse = remoteConfig .ctrl_fw_elapse
834816 data .ctrlFwdSpeed = remoteConfig .ctrl_fw_speed
835817 data .ctrlTurnElapse = remoteConfig .ctrl_tr_elapse
836818 data .ctrlTurnSpeed = remoteConfig .ctrl_tr_speed
837-
838819 data .audioLevel = remoteConfig .audio_volume_level
839820 data .packagesInstalled = remoteConfig .packages_installed
840821 }.bind (this ))
841822 },
842-
843823 save : function () {
844824 let qs = this .$qs
845825 let selectedTab = this .tab
846826 let axios = this .$axios
847827 let CBv1 = this .CBv1
848828 let data = this .settings
849-
850829 if (selectedTab == 10 ) {
851830 var valuesAsString = qs .stringify ({
852831 ' wifi_mode' : this .settings .wifiMode ,
@@ -860,7 +839,6 @@ export default {
860839 this .snackText = " Impostazioni di rete aggiornate"
861840 this .snackbar = true
862841 }.bind (this ))
863-
864842 } else {
865843 let legacySettings = qs .stringify ({
866844 ' wifi_mode' : data .wifiMode ,
@@ -877,17 +855,14 @@ export default {
877855 ' sound_shutter' : data .shutterSound ,
878856 ' load_at_start' : data .startupProgram ,
879857 ' prog_level' : data .progLevel ,
880-
881858 ' move_fw_elapse' : data .moveFwdElapse ,
882859 ' move_fw_speed' : data .moveFwdSpeed ,
883860 ' move_tr_elapse' : data .moveTurnElapse ,
884861 ' move_tr_speed' : data .moveTurnSpeed ,
885-
886862 ' ctrl_fw_elapse' : data .ctrlFwdElapse ,
887863 ' ctrl_fw_speed' : data .ctrlFwdSpeed ,
888864 ' ctrl_tr_elapse' : data .ctrlTurnElapse ,
889865 ' ctrl_tr_speed' : data .ctrlTurnSpeed ,
890-
891866 ' audio_volume_level' : data .audioLevel ,
892867 ' packages_installed' : data .packagesInstalled
893868 })
@@ -945,7 +920,6 @@ export default {
945920 ctrlFwdSpeed: null ,
946921 ctrlTurnElapse: null ,
947922 ctrlTurnSpeed: null ,
948-
949923 motorMode: null ,
950924 trimFactor: null ,
951925 startSound: null ,
@@ -954,7 +928,6 @@ export default {
954928 startupProgram: null ,
955929 progLevel: null ,
956930 },
957-
958931 blocklyToolboxItems: [
959932 { text: ' Movimento' , value: ' basic_move' },
960933 { text: ' Base' , value: ' basic' },
@@ -990,15 +963,13 @@ export default {
990963 }
991964 }
992965}
993-
994966 </script >
995967<style scoped>
996968.cardContent {
997969 text-align : left ;
998970 font-size : 16px ;
999971 padding : 16px ;
1000972}
1001-
1002973.fa ,
1003974.fas ,
1004975.fab {
0 commit comments