267267
268268 <div class =" cardContent" >
269269 <div id =' test_array' >
270- <v-switch label =" Motors" value =" motors" v-model =" checkedTests" color =" #f45525" ></v-switch >
271- <v-switch label =" Sonar" value =" sonar" v-model =" checkedTests" color =" #f45525" ></v-switch >
272- <v-switch label =" Speaker" value =" speaker" v-model =" checkedTests" color =" #f45525" ></v-switch >
273- <v-switch label =" OCR" value =" ocr" v-model =" checkedTests" color =" #f45525" ></v-switch >
274- <span >Checked names: {{ checkedTests }}</span >
270+ <!-- SONAR -->
271+ <v-layout row wrap justify-center >
272+ <!-- switch -->
273+ <v-flex xs12 offset-md2 md5 >
274+ <v-switch label =" Sonar" value =" sonar" v-model =" checkedTests" color =" #f45525" ></v-switch >
275+ </v-flex >
276+ <!-- button state -->
277+ <v-flex xs12 md4 >
278+ <span v-if =" cb.logs.test != null && cb.logs.test.sonar != 0" >
279+ <!-- passed -->
280+ <span v-if =" cb.logs.test.sonar == 1" >
281+ <v-btn @click =" runTests" slot =" activator" color =" green" dark >
282+ <v-icon >fas fa-check</v-icon > Passed
283+ </v-btn >
284+ </span >
285+ <!-- failed -->
286+ <span v-else >
287+ <v-btn @click =" runTests" slot =" activator" color =" red" dark >
288+ <v-icon >fas fa-times</v-icon > Failed
289+ </v-btn >
290+ </span >
291+ </span >
292+ <!-- not tested -->
293+ <span v-else >
294+ <v-btn @click =" runTests" slot =" activator" color =" grey" dark >
295+ <v-icon >fas fa-question</v-icon > Not tested
296+ </v-btn >
297+ </span >
298+ </v-flex >
299+ </v-layout >
300+
301+ <!-- MOTORS -->
302+ <v-layout row wrap justify-center >
303+ <!-- switch -->
304+ <v-flex xs12 offset-md2 md5 >
305+ <v-switch label =" Motors" value =" motors" v-model =" checkedTests" color =" #f45525" >
306+ </v-switch >
307+ </v-flex >
308+ <!-- button state -->
309+ <v-flex xs12 md4 >
310+ <span v-if =" cb.logs.test != null && cb.logs.test.motors != 0" >
311+ <!-- passed -->
312+ <span v-if =" cb.logs.test.motor== 1" >
313+ <v-btn @click =" runTests" slot =" activator" color =" green" dark >
314+ <v-icon >fas fa-check</v-icon > Passed
315+ </v-btn >
316+ </span >
317+ <!-- failed -->
318+ <span v-else >
319+ <v-btn @click =" runTests" slot =" activator" color =" red" dark >
320+ <v-icon >fas fa-times</v-icon > Failed
321+ </v-btn >
322+ </span >
323+ </span >
324+ <!-- not tested -->
325+ <span v-else >
326+ <v-btn @click =" runTests" slot =" activator" color =" grey" dark >
327+ <v-icon >fas fa-question</v-icon > Not tested
328+ </v-btn >
329+ </span >
330+ </v-flex >
331+ </v-layout >
332+
333+ <!-- SPEAKER -->
334+ <v-layout row wrap justify-center >
335+ <!-- switch -->
336+ <v-flex xs12 offset-md2 md5 >
337+ <v-switch label =" Speaker" value =" speaker" v-model =" checkedTests" color =" #f45525" >
338+ </v-switch >
339+ </v-flex >
340+ <!-- button state -->
341+ <v-flex xs12 md4 >
342+ <span v-if =" cb.logs.test != null && cb.logs.test.speaker != 0" >
343+ <!-- passed -->
344+ <span v-if =" cb.logs.test.speaker== 1" >
345+ <v-btn @click =" runTests" slot =" activator" color =" green" dark >
346+ <v-icon >fas fa-check</v-icon > Passed
347+ </v-btn >
348+ </span >
349+ <!-- failed -->
350+ <span v-else >
351+ <v-btn @click =" runTests" slot =" activator" color =" red" dark >
352+ <v-icon >fas fa-times</v-icon > Failed
353+ </v-btn >
354+ </span >
355+ </span >
356+ <!-- not tested -->
357+ <span v-else >
358+ <v-btn @click =" runTests" slot =" activator" color =" grey" dark >
359+ <v-icon >fas fa-question</v-icon > Not tested
360+ </v-btn >
361+ </span >
362+ </v-flex >
363+ </v-layout >
364+
365+ <!-- OCR -->
366+ <v-layout row wrap justify-center >
367+ <!-- switch -->
368+ <v-flex xs12 offset-md2 md5 >
369+ <v-switch label =" OCR" value =" ocr" v-model =" checkedTests" color =" #f45525" >
370+ </v-switch >
371+ </v-flex >
372+ <!-- button state -->
373+ <v-flex xs12 md4 >
374+ <span v-if =" cb.logs.test != null && cb.logs.test.ocr != 0" >
375+ <!-- passed -->
376+ <span v-if =" cb.logs.test.ocr== 1" >
377+ <v-btn @click =" runTests" slot =" activator" color =" green" dark >
378+ <v-icon >fas fa-check</v-icon > Passed
379+ </v-btn >
380+ </span >
381+ <!-- failed -->
382+ <span v-else >
383+ <v-btn @click =" runTests" slot =" activator" color =" red" dark >
384+ <v-icon >fas fa-times</v-icon > Failed
385+ </v-btn >
386+ </span >
387+ </span >
388+ <!-- not tested -->
389+ <span v-else >
390+ <v-btn @click =" runTests" slot =" activator" color =" grey" dark >
391+ <v-icon >fas fa-question</v-icon > Not tested
392+ </v-btn >
393+ </span >
394+ </v-flex >
395+ </v-layout >
396+
397+ <!-- DEBUG
398+ <span>Checked names: {{ checkedTests }}</span>
399+ -->
275400 </div >
276401 <br >
277402 <div class =" text-xs-center" >
278- <v-btn @click =" runTests" slot =" activator" color =" error" dark >
403+
404+ <v-btn v-if =" !cb.logs.runningTest"
405+ block
406+ @click =" runTests"
407+ slot =" activator"
408+ color =" error"
409+ dark >
279410 <v-icon >fas fa-share-square</v-icon > Run tests
280411 </v-btn >
412+ <v-btn v-else
413+ block
414+ disabled >
415+ <v-icon >fas fa-share-square</v-icon > Running tests...
416+ </v-btn >
417+ <!-- DEBUG
418+ Running test: {{ cb.logs.runningTest }}
419+ -->
281420 </div >
282421 </div >
283422
@@ -365,11 +504,14 @@ export default {
365504 runTests () {
366505 let axios = this .$axios
367506 let CB = this .CB
368- axios .post (CB + ' /testCoderbot' , { params: { varargin: this .checkedTests } })
507+ this .cb .logs .runningTest = true
508+ axios .post (CB + ' /testCoderbot' , { params: this .checkedTests })
369509 .then (function (response ) {
510+ this .cb .logs .test = response .data
370511 this .snackText = ' Running tests'
371512 this .snackbar = true
372513 this .prepopulate ()
514+ this .cb .logs .runningTest = false
373515 }.bind (this ))
374516 },
375517 restore () {
@@ -657,13 +799,15 @@ export default {
657799 motors: null
658800 },
659801 logs: {
660- log: null
802+ log: null ,
803+ test: null ,
804+ runningTest: false
661805 }
662806 },
663807 drawer: null ,
664808 tab: null ,
665809 // tabs: ['Generali', 'Rete', 'Movimento', 'Suoni', 'Avanzate'],
666- tabs: [' Generali' , ' Movimento' , ' Suoni' , ' Avanzate' , ' Test' ],
810+ tabs: [' Generali' , ' Movimento' , ' Suoni' , ' Avanzate' , ' Test' ]
667811 }
668812 }
669813}
@@ -683,5 +827,4 @@ export default {
683827 margin-right : 7px ;
684828 text-size : 10px ;
685829}
686-
687830 </style >
0 commit comments