6
6
<v-app-bar-nav-icon @click.stop =" toggleSidebar()" ></v-app-bar-nav-icon >
7
7
<v-app-bar-title class =" title" ><div >{{ $t("message.settings_title") }}</div ></v-app-bar-title >
8
8
<v-spacer ></v-spacer >
9
- <template v-if =" status == 200 " >
10
- <v-btn text @click =" save" >
11
- <v-icon icon =" mdi-content-save" ></v-icon >
12
- {{ $t('message.save') }}
13
- </v-btn >
14
- </template >
15
- <template v-else >
16
- <v-btn text >
17
- <v-progress-circular :size =" 30" :width =" 2" indeterminate ></v-progress-circular >
18
- </v-btn >
19
- </template >
9
+ <v-btn text @click =" save" >
10
+ <v-icon icon =" mdi-content-save" ></v-icon >
11
+ {{ $t('message.save') }}
12
+ </v-btn >
20
13
<template v-slot :extension >
21
14
<v-tabs slot =" extension" v-model =" tab" centered slider-color =" white" >
22
15
<v-tab v-for =" item in tabs" :key =" item" >
360
353
</v-card-title >
361
354
<div class =" cardContent" >
362
355
<v-select
363
- :disabled =" settings.wifiMode!='client'"
364
356
v-model =" settings.startupProgram"
365
357
@change =" v$.settings.startupProgram.$touch"
366
358
:items =" programList"
393
385
>
394
386
<v-radio v-bind:label =" $t('message.settings_network_mode_ap')" value =" ap" ></v-radio >
395
387
<v-radio v-bind:label =" $t('message.settings_network_mode_client')" value =" client" ></v-radio >
396
-
397
388
</v-radio-group >
398
389
<div v-if =" settings.wifiMode=='client'" >
399
390
<v-select
@@ -777,10 +768,8 @@ export default {
777
768
};
778
769
},
779
770
mounted () {
780
- this .pollStatus ();
781
- setInterval (() => {
782
- this .pollStatus ();
783
- }, 1000 );
771
+ this .pollWifiStatus ()
772
+ setInterval (() => { this .pollWifiStatus (); }, 1000 );
784
773
this .getInfoAndStatus ();
785
774
this .prepopulate ();
786
775
this .settings .packagesInstalled = this .$store .getters .musicPackages ;
@@ -789,7 +778,7 @@ export default {
789
778
this .cb .status = this .$store .getters .status ;
790
779
this .adminPassword_dialog = this .settings .adminPassword != null && this .settings .adminPassword != ' ' ;
791
780
this .$wifi_connect .networks ().then ((result ) => {
792
- this .networks = result .data .ssids ;
781
+ this .networks = result .data .ssids ;
793
782
});
794
783
this .$coderbot .listPrograms ()
795
784
.then ((response ) => {
@@ -882,6 +871,11 @@ export default {
882
871
rawFile.send(null);
883
872
*/
884
873
},
874
+ pollWifiStatus () {
875
+ this .$wifi_connect .status ().then ((result ) => {
876
+ this .wifi_status = result .data ;
877
+ });
878
+ },
885
879
restoreSettings () {
886
880
this .$coderbot .restoreSettings ()
887
881
.then (() => {
@@ -926,31 +920,6 @@ export default {
926
920
// Get bot info and status
927
921
return this .$coderbot .getInfoAndStatus ();
928
922
},
929
- pollStatus () {
930
- this .getInfoAndStatus ()
931
- .then ((response ) => {
932
- if (this .status == 0 && response .status ) {
933
- this .snackText = this .$i18n .t (' message.coderbot_status_online' );
934
- this .snackbar = true ;
935
- this .getInfoAndStatus ();
936
- this .prepopulate ();
937
- }
938
- this .status = this .$store .getters .status != null ? 200 : 500 ;
939
- this .cb .logs .log = this .$store .getters .status .log ;
940
- })
941
- .catch ((error ) => {
942
- // handle error
943
- console .log (error);
944
- if (this .status ) {
945
- this .snackText = this .$i18n .t (' message.coderbot_status_offline' );
946
- this .snackbar = true ;
947
- }
948
- this .status = 0 ;
949
- });
950
- this .$wifi_connect .status ().then ((result ) => {
951
- this .wifi_status = result .data ;
952
- });
953
- },
954
923
deletePkg (pkgNameID ) {
955
924
this .$coderbot .deleteMusicPackage (pkgNameID).then (() => {
956
925
console .log (' Pacchetto rimosso' );
@@ -988,28 +957,23 @@ export default {
988
957
const network = this .networks .find (item => { return item .ssid == this .settings .wifiSSID });
989
958
if (network != null ) {
990
959
this .wifi_overlay = true ;
991
- this .$wifi_connect .disconnect ().then ((result ) => {
992
- setTimeout (() => {
993
- this .$wifi_connect .connect (network .ssid , network .conn_type , this .settings .wifiUser , this .settings .wifiPsw )
994
- .then ((result ) => {
995
- this .snackText = this .$i18n .t (' message.settings_network_updated' );
996
- this .snackbar = true ;
997
- this .wifi_overlay = false ;
998
- })
999
- .catch ((error ) => {
1000
- console .error (error);
1001
- this .wifi_overlay = false ;
1002
- });
1003
- }, 10000 );
1004
- })
1005
- .catch ((error ) => {
1006
- console .error (error);
1007
- this .wifi_overlay = false ;
1008
- });
960
+ this .$wifi_connect .connect (network .ssid , network .conn_type , this .settings .wifiUser , this .settings .wifiPsw )
961
+ .then ((result ) => {
962
+ this .snackText = this .$i18n .t (' message.settings_network_updated' );
963
+ this .snackbar = true ;
964
+ this .wifi_overlay = false ;
965
+ })
966
+ .catch ((error ) => {
967
+ console .error (error);
968
+ this .wifi_overlay = false ;
969
+ });
1009
970
}
971
+ } else {
972
+ console .log (" disconnecting" )
973
+ this .$wifi_connect .disconnect ().then ((result ) => {
974
+ console .log (result);
975
+ });
1010
976
}
1011
- } else {
1012
- this .$wifi_connect .disconnect ().then ((result ) => {});
1013
977
}
1014
978
}
1015
979
},
@@ -1062,7 +1026,6 @@ export default {
1062
1026
return {
1063
1027
formdata: null ,
1064
1028
files: null ,
1065
- status: null ,
1066
1029
dialog_reset: false ,
1067
1030
dialog_logs: false ,
1068
1031
lastCommit: ' N/A' ,
@@ -1128,7 +1091,7 @@ export default {
1128
1091
confirm_exit_dialog: null ,
1129
1092
router_next: null ,
1130
1093
adminPassword: null ,
1131
- adminPassword_dialog: true ,
1094
+ adminPassword_dialog: false ,
1132
1095
tabs: [
1133
1096
this .$i18n .t (' message.settings_tabs_general' ),
1134
1097
this .$i18n .t (' message.settings_tabs_movement' ),
0 commit comments