36
36
<h3 class =" text-xs-left" >Sistema </h3 >
37
37
<v-card >
38
38
<div class =" cardContent" >
39
- <v-text-field v-model =" settings.cbName" label =" Nome CoderBot" ></v-text-field >
40
- <br >
39
+ <v-select v-model =" settings.progLevel" :items =" blocklyToolboxItems" label =" Livello Toolbox Blockly" ></v-select >
40
+ <!-- <v-text-field v-model="settings.cbName" label="Nome CoderBot"></v-text-field>
41
+ <br>-->
41
42
<div v-for =" (value, key, index) in cb.info" >
42
43
{{ key }}: <code >{{ value }}</code >
43
44
</div >
46
47
<br >
47
48
<h3 class =" text-xs-left" >Stato </h3 >
48
49
<v-card >
49
- <br >
50
- <div v-for =" (value, key, index) in cb.status" >
51
- {{ key }}: <code >{{ value }}</code >
50
+ <div class =" cardContent" >
51
+ <div v-for =" (value, key, index) in cb.status" >
52
+ {{ key }}: <code >{{ value }}</code >
53
+ </div >
54
+ <br >
52
55
</div >
53
- <br >
54
- <br >
55
56
</v-card >
56
57
<br >
57
58
<h3 class =" text-xs-left" > Azioni </h3 >
58
59
<v-card >
59
60
<div class =" cardContent" >
60
- <v-btn color =" info" >Spegni</v-btn >
61
- <v-btn color =" info" >Riavvia</v-btn >
61
+ <v-btn @click =" shutdown" color =" info" >Spegni</v-btn >
62
+ <v-btn @click =" reboot" color =" info" >Riavvia</v-btn >
63
+ <!--
62
64
<v-btn color="warning">Aggiorna</v-btn>
63
- <v-btn color =" error" >Ripristina ad Impostazioni di fabbrica</v-btn >
65
+ <v-btn color="error">Ripristina ad Impostazioni di fabbrica</v-btn>-->
64
66
</div >
65
67
</v-card >
66
68
<br ><br >
@@ -199,6 +201,25 @@ export default {
199
201
this .prepopulate ();
200
202
},
201
203
methods: {
204
+ shutdown () {
205
+ let axios = this .$axios
206
+ let CBv1 = this .$data .CBv1
207
+ axios .get (CBv1 + ' /bot' , { params: { cmd: ' halt' } })
208
+ .then (function (response ) {
209
+
210
+ this .$data .snackText = ' Coderbot in spegnimento..'
211
+ this .$data .snackbar = true
212
+ })
213
+ },
214
+ reboot () {
215
+ let axios = this .$axios
216
+ let CBv1 = this .$data .CBv1
217
+ axios .get (CBv1 + ' /bot' , { params: { cmd: ' reboot' } })
218
+ .then (function (response ) {
219
+ this .$data .snackText = ' Riavvio iniziato...'
220
+ this .$data .snackbar = true
221
+ })
222
+ },
202
223
getInfoAndStatus () {
203
224
// Get bot info and status
204
225
let axios = this .$axios
@@ -306,6 +327,7 @@ export default {
306
327
data .stopSound = remoteConfig .sound_stop
307
328
data .shutterSound = remoteConfig .sound_shutter
308
329
data .startupProgram = remoteConfig .load_at_start
330
+ data .progLevel = remoteConfig .prog_level
309
331
}.bind (this ))
310
332
},
311
333
save : function () {
@@ -315,9 +337,7 @@ export default {
315
337
let CBv1 = this .$data .CBv1
316
338
let data = this .$data .settings
317
339
318
- if (selectedTab == 0 ) {
319
- // New persistence endpoint
320
- } else if (selectedTab == 1 ) {
340
+ if (selectedTab == 1 ) {
321
341
var valuesAsString = qs .stringify ({
322
342
' wifi_mode' : this .$data .settings .wifiMode ,
323
343
' wifi_ssid' : this .$data .settings .wifiSSID ,
@@ -350,6 +370,7 @@ export default {
350
370
' sound_stop' : data .stopSound ,
351
371
' sound_shutter' : data .shutterSound ,
352
372
' load_at_start' : data .startupProgram ,
373
+ ' prog_level' : data .progLevel
353
374
})
354
375
axios .post (CBv1 + ' /config' , legacySettings)
355
376
.then (function () {
@@ -391,9 +412,15 @@ export default {
391
412
stopSound: null ,
392
413
shutterSound: null ,
393
414
startupProgram: null ,
415
+ progLevel: null
394
416
},
395
417
396
-
418
+ blocklyToolboxItems: [
419
+ {text: ' Movimento' , value: ' basic_move' },
420
+ {text: ' Base' , value: ' basic' },
421
+ {text: ' Standard' , value: ' std' },
422
+ {text: ' Avanzate' , value: ' adv' },
423
+ ],
397
424
cb: {
398
425
info: {
399
426
status: null ,
@@ -420,6 +447,8 @@ export default {
420
447
</script >
421
448
<style scoped>
422
449
.cardContent {
450
+ text-align : left ;
451
+ font-size : 16px ;
423
452
padding : 16px ;
424
453
}
425
454
0 commit comments