Skip to content

Commit 02bd494

Browse files
committed
Moved log card as modal triggered with button
1 parent 0e978a0 commit 02bd494

File tree

1 file changed

+93
-53
lines changed

1 file changed

+93
-53
lines changed

src/components/Settings.vue

Lines changed: 93 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@
5050
<v-card>
5151
<div class="cardContent">
5252
<div v-for="(value, key, index) in cb.status">
53-
<div v-if="key != 'log'">
54-
{{ key }}: <code>{{ value }}</code>
55-
</div>
53+
<div v-if="key != 'log'">
54+
{{ key }}: <code>{{ value }}</code>
55+
</div>
5656
</div>
5757
<br>
5858
</div>
@@ -70,47 +70,87 @@
7070
<v-btn @click="restoreConfig" color="warning">
7171
<v-icon>fas fa-redo</v-icon> Ripristina Impostazioni
7272
</v-btn>
73-
<!-- ** Restore button + dialog box** -->
74-
<v-dialog v-model="dialog" width="500">
75-
<v-btn slot="activator" color="error" dark>
76-
<v-icon>fas fa-wrench</v-icon> Ripristina ad impostazioni di fabbrica
77-
</v-btn>
78-
<v-card>
79-
<v-card-title class="headline grey lighten-2" primary-title>
80-
<h3>Ripristina impostazioni</h3>
81-
</v-card-title>
82-
<v-card-text>
83-
Sei sicuro di voler ripristinare alle impostazioni di fabbrica?
84-
<br>
85-
<h4><b>TUTTI I DATI VERRANNO PERSI</b></h4>
86-
</v-card-text>
87-
<v-divider></v-divider>
88-
<v-card-actions>
89-
<v-spacer></v-spacer>
90-
<v-btn color="primary" @click="dialog = false">
91-
Annulla
92-
</v-btn>
93-
<v-btn color="error" @click="restore">
94-
<b>Ripristina</b>
95-
</v-btn>
96-
</v-card-actions>
97-
</v-card>
98-
</v-dialog>
73+
<!-- ** Restore button + dialog box** -->
74+
<v-dialog
75+
v-model="dialog"
76+
width="500" >
77+
<v-btn
78+
slot="activator"
79+
color="error"dark >
80+
<v-icon>fas fa-wrench</v-icon> Ripristina ad impostazioni di fabbrica
81+
</v-btn>
82+
83+
<v-card>
84+
<v-card-title
85+
class="headline grey lighten-2"
86+
primary-title >
87+
<h3>CoderBot - Restore</h3>
88+
</v-card-title>
89+
90+
<v-card-text>
91+
Sei sicuro di voler ripristinare il CoderBot?
92+
<br>
93+
<h3><b>Tutti i file salvati verranno cancellati</b></h3>
94+
</v-card-text>
95+
96+
<v-divider></v-divider>
97+
98+
<v-card-actions>
99+
<v-spacer></v-spacer>
100+
<v-btn
101+
color="primary"
102+
@click="dialog = false" >
103+
Esci
104+
</v-btn>
105+
<v-btn
106+
color="error"
107+
@click="restore" >
108+
<b>Ripristina</b>
109+
</v-btn>
110+
</v-card-actions>
111+
</v-card>
112+
</v-dialog>
113+
114+
<!-- Logs -->
115+
<v-dialog
116+
v-model="dialog_logs"
117+
width="700" >
118+
<v-btn
119+
slot="activator"
120+
color="warning" dark >
121+
<v-icon>fas fa-file-signature</v-icon> Show logs
122+
</v-btn>
123+
124+
<v-card>
125+
<v-card-title
126+
class="headline grey lighten-2"
127+
primary-title >
128+
<h3>CoderBot - Logs</h3>
129+
</v-card-title>
130+
131+
<div class="cardContent">
132+
<div v-for="value in cb.logs.log">
133+
{{ value }}
134+
</div>
135+
</div>
136+
<v-divider></v-divider>
137+
138+
<v-card-actions>
139+
<v-spacer></v-spacer>
140+
<v-btn
141+
color="primary"
142+
@click="dialog_logs = false" >
143+
Esci
144+
</v-btn>
145+
</v-card-actions>
146+
</v-card>
147+
</v-dialog>
99148
<!--
100149
<v-btn color="warning">Aggiorna</v-btn>
101150
<v-btn color="error">Ripristina ad Impostazioni di fabbrica</v-btn> -->
102151
</div>
103152
</v-card>
104153
<br>
105-
<h3 class="text-xs-left"> Reset Logs </h3>
106-
<v-card>
107-
<div class="cardContent">
108-
<div v-for="value in cb.logs.log">
109-
{{ value }}
110-
</div>
111-
</div>
112-
</v-card>
113-
<br>
114154
<h3 class="text-xs-left"> Aggiornamento </h3>
115155
<v-card>
116156
<div class="cardContent">
@@ -318,20 +358,20 @@ export default {
318358
this.prepopulate()
319359
}.bind(this))
320360
},
321-
restore() {
322-
let axios = this.$axios
323-
let CB = this.CB
324-
axios.post(CB + '/reset')
325-
.then(function(response) {
361+
restore() {
362+
let axios = this.$axios
363+
let CB = this.CB
364+
axios.post(CB + '/reset')
365+
.then(function(response) {
326366
this.snackText = 'Ripristino ad impostazioni di fabbrica \
327367
Reboot in corso...'
328368
this.snackbar = true
329369
this.prepopulate()
330-
setTimeout(() => $(dialog).close(), 5000)
331-
this.dialog = false
370+
setTimeout(() => $(dialog).close(), 5000)
371+
this.dialog = false
332372
}.bind(this))
333-
},
334-
373+
},
374+
335375
shutdown() {
336376
let axios = this.$axios
337377
let CBv1 = this.CBv1
@@ -358,7 +398,7 @@ export default {
358398
axios.get(this.CB + '/status')
359399
.then(function(response) {
360400
this.cb.status = response.data
361-
this.cb.logs.log = response.data.log
401+
this.cb.logs.log = response.data.log
362402
}.bind(this))
363403
axios.get(this.CB + '/info')
364404
.then(function(response) {
@@ -380,7 +420,7 @@ export default {
380420
381421
this.statusData = response.data
382422
this.status = response.status
383-
this.cb.logs.log = response.data.log
423+
this.cb.logs.log = response.data.log
384424
}.bind(this))
385425
.catch(function(error) {
386426
// handle error
@@ -538,7 +578,7 @@ export default {
538578
formdata: null,
539579
files: null,
540580
status: null,
541-
dialog: false,
581+
dialog: false,
542582
lastCommit: process.env.lastCommit,
543583
CB: process.env.CB_ENDPOINT + process.env.APIv2,
544584
CBv1: process.env.CB_ENDPOINT,
@@ -599,9 +639,9 @@ export default {
599639
vueVersion: null,
600640
kernel: null
601641
},
602-
logs: {
603-
log: null
604-
}
642+
logs: {
643+
log: null
644+
}
605645
},
606646
drawer: null,
607647
tab: null,

0 commit comments

Comments
 (0)