Skip to content

Commit 363470d

Browse files
committed
Edit toolbox level
1 parent bdde8b7 commit 363470d

File tree

1 file changed

+43
-14
lines changed

1 file changed

+43
-14
lines changed

src/components/Settings.vue

Lines changed: 43 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,9 @@
3636
<h3 class="text-xs-left">Sistema </h3>
3737
<v-card>
3838
<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>-->
4142
<div v-for="(value, key, index) in cb.info">
4243
{{ key }}: <code>{{ value }}</code>
4344
</div>
@@ -46,21 +47,22 @@
4647
<br>
4748
<h3 class="text-xs-left">Stato </h3>
4849
<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>
5255
</div>
53-
<br>
54-
<br>
5556
</v-card>
5657
<br>
5758
<h3 class="text-xs-left"> Azioni </h3>
5859
<v-card>
5960
<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+
<!--
6264
<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>-->
6466
</div>
6567
</v-card>
6668
<br><br>
@@ -199,6 +201,25 @@ export default {
199201
this.prepopulate();
200202
},
201203
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+
},
202223
getInfoAndStatus() {
203224
// Get bot info and status
204225
let axios = this.$axios
@@ -306,6 +327,7 @@ export default {
306327
data.stopSound = remoteConfig.sound_stop
307328
data.shutterSound = remoteConfig.sound_shutter
308329
data.startupProgram = remoteConfig.load_at_start
330+
data.progLevel = remoteConfig.prog_level
309331
}.bind(this))
310332
},
311333
save: function() {
@@ -315,9 +337,7 @@ export default {
315337
let CBv1 = this.$data.CBv1
316338
let data = this.$data.settings
317339
318-
if (selectedTab == 0) {
319-
// New persistence endpoint
320-
} else if (selectedTab == 1) {
340+
if (selectedTab == 1) {
321341
var valuesAsString = qs.stringify({
322342
'wifi_mode': this.$data.settings.wifiMode,
323343
'wifi_ssid': this.$data.settings.wifiSSID,
@@ -350,6 +370,7 @@ export default {
350370
'sound_stop': data.stopSound,
351371
'sound_shutter': data.shutterSound,
352372
'load_at_start': data.startupProgram,
373+
'prog_level': data.progLevel
353374
})
354375
axios.post(CBv1 + '/config', legacySettings)
355376
.then(function() {
@@ -391,9 +412,15 @@ export default {
391412
stopSound: null,
392413
shutterSound: null,
393414
startupProgram: null,
415+
progLevel: null
394416
},
395417
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+
],
397424
cb: {
398425
info: {
399426
status: null,
@@ -420,6 +447,8 @@ export default {
420447
</script>
421448
<style scoped>
422449
.cardContent {
450+
text-align: left;
451+
font-size: 16px;
423452
padding: 16px;
424453
}
425454

0 commit comments

Comments
 (0)