Skip to content

Commit 9c56a61

Browse files
committed
Added test section in Settings
1 parent 6d06297 commit 9c56a61

File tree

1 file changed

+43
-4
lines changed

1 file changed

+43
-4
lines changed

src/components/Settings.vue

Lines changed: 43 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
</v-tabs>
2727
</v-toolbar>
2828
<v-content>
29-
<template v-if="status == 200">
29+
<!--<template v-if="status == 200">-->
3030
<v-tabs-items v-model="tab">
3131
<v-tab-item>
3232
<v-container grid-list-md text-xs-center>
@@ -257,13 +257,40 @@
257257
</v-layout>
258258
</v-container>
259259
</v-tab-item>
260+
<!-- TEST TAB -->
261+
<v-tab-item>
262+
<v-container grid-list-md text-xs-center>
263+
<v-layout row wrap align-center>
264+
<v-flex xs12 md6 offset-md3>
265+
<h3 class="text-xs-left">COMPONENTS TESTS</h3>
266+
<v-card>
267+
268+
<div class="cardContent">
269+
<div id='test_array'>
270+
<v-switch label="Motors" value="motors" v-model="checkedTests"></v-switch>
271+
<v-switch label="Sonar" value="sonar" v-model="checkedTests"></v-switch>
272+
<v-switch label="Speaker" value="speaker" v-model="checkedTests"></v-switch>
273+
<v-switch label="OCR" value="ocr" v-model="checkedTests"></v-switch>
274+
<span>Checked names: {{ checkedTests }}</span>
275+
</div>
276+
<br>
277+
<v-btn @click="runTests" slot="activator" color="error" dark>
278+
<v-icon>fas fa-share-square</v-icon> Run tests
279+
</v-btn>
280+
</div>
281+
282+
</v-card>
283+
</v-flex>
284+
</v-layout>
285+
</v-container>
286+
</v-tab-item>
260287
</v-tabs-items>
261-
</template>
288+
<!--</template>
262289
<template v-else>
263290
<br>
264291
In attesa che CoderBot torni online...<br>
265292
<v-icon large>signal_wifi_off</v-icon>
266-
</template>
293+
</template>-->
267294
</v-content>
268295
<!-- Notification Snackbar -->
269296
<v-snackbar v-model="snackbar">
@@ -275,6 +302,7 @@
275302
</v-app>
276303
</div>
277304
</template>
305+
278306
<script>
279307
import sidebar from "../components/Sidebar"
280308
@@ -332,6 +360,16 @@ export default {
332360
this.prepopulate()
333361
}.bind(this))
334362
},
363+
runTests() {
364+
let axios = this.$axios
365+
let CB = this.CB
366+
axios.post(CB + '/testCoderbot', { params: { varargin: this.checkedTests } })
367+
.then(function(response) {
368+
this.snackText = 'Running tests'
369+
this.snackbar = true
370+
this.prepopulate()
371+
}.bind(this))
372+
},
335373
restore() {
336374
let axios = this.$axios
337375
let CB = this.CB
@@ -564,6 +602,7 @@ export default {
564602
fileUrl: '',
565603
counter: 0,
566604
updateStatusText: '',
605+
checkedTests: [], // checked test array
567606
updateStatus: 0,
568607
// TODO: Prepopulate this
569608
settings: {
@@ -622,7 +661,7 @@ export default {
622661
drawer: null,
623662
tab: null,
624663
//tabs: ['Generali', 'Rete', 'Movimento', 'Suoni', 'Avanzate'],
625-
tabs: ['Generali', 'Movimento', 'Suoni', 'Avanzate'],
664+
tabs: ['Generali', 'Movimento', 'Suoni', 'Avanzate', 'Test'],
626665
}
627666
}
628667
}

0 commit comments

Comments
 (0)