174
174
<v-card-text>
175
175
</v-card-text>
176
176
</v-tab-item>
177
-
178
177
-->
179
178
<v-tab-item >
180
179
<v-container grid-list-md text-xs-center >
481
480
{{ updateStatusText }}
482
481
<v-btn @click =" refresh" color =" error" >Aggiorna</v-btn >
483
482
</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 >
485
488
</template >
486
489
<template v-if =" updateStatus == 0 " >
487
490
<v-text-field label =" Seleziona il pacchetto da installare" @click =' pickFile' v-model =' fileName' prepend-icon =' attach_file' ></v-text-field >
517
520
518
521
<script >
519
522
import sidebar from " ../components/Sidebar"
520
-
521
523
function readTextFile (file , callback ) {
522
524
var rawFile = new XMLHttpRequest ();
523
525
rawFile .overrideMimeType (" application/json" );
@@ -547,9 +549,7 @@ var datapkg = readTextFile( "./static/music_package.json" , function(text){
547
549
})
548
550
return packageList;
549
551
});
550
-
551
552
export default {
552
-
553
553
components: { sidebar },
554
554
name: ' Settings' ,
555
555
mounted () {
@@ -559,7 +559,6 @@ export default {
559
559
}.bind (this ), 1000 )
560
560
let axios = this .$axios
561
561
let settings = this .settings
562
-
563
562
this .getInfoAndStatus ();
564
563
this .prepopulate ();
565
564
},
@@ -575,27 +574,27 @@ export default {
575
574
this .formdata .append (' file_to_upload' , files[0 ], files[0 ].name );
576
575
577
576
},
578
-
579
577
580
578
uploadPackage () {
581
579
let qs = this .$qs
582
580
var pkgName = qs .stringify ({
583
581
' nameID' : this .fileName ,
584
- })
585
-
582
+ })
586
583
this .$axios .post (this .CB + ' /updatePackages' , this .formdata ).then (function (result ) {
587
-
588
- this .updateStatus = 1
589
-
584
+ this .updateStatus = result .data ;
590
585
this .uploadCompleted = true ;
591
586
this .uploadInProgress = false ;
587
+ this .updateStatusText = ' Clicca "AGGIORNA" per visualizzare le modifiche.' ;
592
588
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
+ }
596
595
}.bind (this ))
597
-
598
- },
596
+ },
597
+
599
598
600
599
upload () {
601
600
const config = {
@@ -605,16 +604,12 @@ export default {
605
604
}
606
605
}
607
606
this .updateStatus = 1
608
-
609
607
this .$axios .post (this .CB + ' /updateFromPackage' , this .formdata , config).then (function (result ) {
610
608
this .uploadCompleted = true ;
611
609
this .uploadInProgress = false ;
612
610
console .dir (result .data );
613
-
614
611
this .updateStatusText = ' Upload completato. Riavvio in corso.'
615
-
616
612
}.bind (this ))
617
-
618
613
},
619
614
620
615
refresh (){
@@ -629,7 +624,6 @@ export default {
629
624
});
630
625
*/
631
626
},
632
-
633
627
/* readTextFile(file, callback) {
634
628
var rawFile = new XMLHttpRequest();
635
629
rawFile.overrideMimeType("application/json");
@@ -639,7 +633,6 @@ export default {
639
633
callback(rawFile.responseText);
640
634
}
641
635
}
642
-
643
636
rawFile.send(null);
644
637
},
645
638
*/
@@ -679,13 +672,11 @@ export default {
679
672
this .dialog = false
680
673
}.bind (this ))
681
674
},
682
-
683
675
shutdown () {
684
676
let axios = this .$axios
685
677
let CBv1 = this .CBv1
686
678
axios .get (CBv1 + ' /bot' , { params: { cmd: ' halt' } })
687
679
.then (function (response ) {
688
-
689
680
this .snackText = ' Coderbot in spegnimento..'
690
681
this .snackbar = true
691
682
})
@@ -702,7 +693,6 @@ export default {
702
693
getInfoAndStatus () {
703
694
// Get bot info and status
704
695
let axios = this .$axios
705
-
706
696
axios .get (this .CB + ' /status' )
707
697
.then (function (response ) {
708
698
this .cb .status = response .data
@@ -725,23 +715,20 @@ export default {
725
715
this .getInfoAndStatus ();
726
716
this .prepopulate ();
727
717
}
728
-
729
718
this .statusData = response .data
730
719
this .status = response .status
731
720
this .cb .logs .log = response .data .log
732
721
}.bind (this ))
733
722
.catch (function (error ) {
734
723
// handle error
735
724
console .log (error);
736
-
737
725
if (this .status ) {
738
726
this .snackText = ' CoderBot irrangiungibile'
739
727
this .snackbar = true
740
728
}
741
729
this .status = 0
742
730
}.bind (this ))
743
731
},
744
-
745
732
deletePkg (pkgNameID ){
746
733
let CBv1 = this .CBv1
747
734
let axios = this .$axios
@@ -758,7 +745,6 @@ export default {
758
745
window .location .reload ();
759
746
}.bind (this ))
760
747
},
761
-
762
748
prepopulate : function () {
763
749
let axios = this .$axios
764
750
let settings = this .settings
@@ -807,13 +793,11 @@ export default {
807
793
sound_start: "$startup.mp3"
808
794
sound_stop: "$shutdown.mp3"
809
795
*/
810
-
811
796
data .power = [remoteConfig .move_power_angle_1 , remoteConfig .move_power_angle_2 , remoteConfig .move_power_angle_3 ]
812
797
data .btnFun = remoteConfig .button_func
813
798
// ?
814
799
/*
815
800
data.wifiMode = remoteConfig.wifi_mode
816
-
817
801
data.wifiSSID = remoteConfig.wifi_ssid
818
802
data.wifiPsw = remoteConfig.wifi_psk
819
803
*/
@@ -824,29 +808,24 @@ export default {
824
808
data .shutterSound = remoteConfig .sound_shutter
825
809
data .startupProgram = remoteConfig .load_at_start
826
810
data .progLevel = remoteConfig .prog_level
827
-
828
811
data .moveFwdElapse = remoteConfig .move_fw_elapse
829
812
data .moveFwdSpeed = remoteConfig .move_fw_speed
830
813
data .moveTurnElapse = remoteConfig .move_tr_elapse
831
814
data .moveTurnSpeed = remoteConfig .move_tr_speed
832
-
833
815
data .ctrlFwdElapse = remoteConfig .ctrl_fw_elapse
834
816
data .ctrlFwdSpeed = remoteConfig .ctrl_fw_speed
835
817
data .ctrlTurnElapse = remoteConfig .ctrl_tr_elapse
836
818
data .ctrlTurnSpeed = remoteConfig .ctrl_tr_speed
837
-
838
819
data .audioLevel = remoteConfig .audio_volume_level
839
820
data .packagesInstalled = remoteConfig .packages_installed
840
821
}.bind (this ))
841
822
},
842
-
843
823
save : function () {
844
824
let qs = this .$qs
845
825
let selectedTab = this .tab
846
826
let axios = this .$axios
847
827
let CBv1 = this .CBv1
848
828
let data = this .settings
849
-
850
829
if (selectedTab == 10 ) {
851
830
var valuesAsString = qs .stringify ({
852
831
' wifi_mode' : this .settings .wifiMode ,
@@ -860,7 +839,6 @@ export default {
860
839
this .snackText = " Impostazioni di rete aggiornate"
861
840
this .snackbar = true
862
841
}.bind (this ))
863
-
864
842
} else {
865
843
let legacySettings = qs .stringify ({
866
844
' wifi_mode' : data .wifiMode ,
@@ -877,17 +855,14 @@ export default {
877
855
' sound_shutter' : data .shutterSound ,
878
856
' load_at_start' : data .startupProgram ,
879
857
' prog_level' : data .progLevel ,
880
-
881
858
' move_fw_elapse' : data .moveFwdElapse ,
882
859
' move_fw_speed' : data .moveFwdSpeed ,
883
860
' move_tr_elapse' : data .moveTurnElapse ,
884
861
' move_tr_speed' : data .moveTurnSpeed ,
885
-
886
862
' ctrl_fw_elapse' : data .ctrlFwdElapse ,
887
863
' ctrl_fw_speed' : data .ctrlFwdSpeed ,
888
864
' ctrl_tr_elapse' : data .ctrlTurnElapse ,
889
865
' ctrl_tr_speed' : data .ctrlTurnSpeed ,
890
-
891
866
' audio_volume_level' : data .audioLevel ,
892
867
' packages_installed' : data .packagesInstalled
893
868
})
@@ -945,7 +920,6 @@ export default {
945
920
ctrlFwdSpeed: null ,
946
921
ctrlTurnElapse: null ,
947
922
ctrlTurnSpeed: null ,
948
-
949
923
motorMode: null ,
950
924
trimFactor: null ,
951
925
startSound: null ,
@@ -954,7 +928,6 @@ export default {
954
928
startupProgram: null ,
955
929
progLevel: null ,
956
930
},
957
-
958
931
blocklyToolboxItems: [
959
932
{ text: ' Movimento' , value: ' basic_move' },
960
933
{ text: ' Base' , value: ' basic' },
@@ -990,15 +963,13 @@ export default {
990
963
}
991
964
}
992
965
}
993
-
994
966
</script >
995
967
<style scoped>
996
968
.cardContent {
997
969
text-align : left ;
998
970
font-size : 16px ;
999
971
padding : 16px ;
1000
972
}
1001
-
1002
973
.fa ,
1003
974
.fas ,
1004
975
.fab {
0 commit comments