From: Erik Andresen Date: Sat, 29 Sep 2018 09:10:03 +0000 (+0200) Subject: www: use vue.js-components to avoid duplicates X-Git-Url: https://defiant.homedns.org/gitweb/?p=ros_wild_thumper.git;a=commitdiff_plain;h=c8ec98bdd30f8e533da331fe48742237ccc230d2 www: use vue.js-components to avoid duplicates --- diff --git a/www/assets/javascripts/application.js b/www/assets/javascripts/application.js index eed4a38..3f85f00 100644 --- a/www/assets/javascripts/application.js +++ b/www/assets/javascripts/application.js @@ -114,6 +114,16 @@ function init() { // Set the initial speed. teleop.scale = ($('#speed-slider').slider('value') * 2); + new Vue({ + el: '#lights', + data: { + front_row: ["[0]", "[1]", "[2]", "[3]"], + top_row: ["[7]", "[6]", "[5]", "[4]"], + aft_row: ["[8]", "[9]", "[10]", "[11]"], + bottom_left_row: ["[14]", "[15]"], + bottom_right_row: ["[13]", "[12]"], + } + }) $('.led_color').minicolors({ control: 'wheel', format: 'rgb', @@ -216,4 +226,15 @@ function init() { speed: $('#speed-slider').slider('value'), } }) + } + +Vue.component('input-value', { + template: '#input-value-template', + props: ['value', 'label', 'unit'] +}) + +Vue.component('input-led', { + template: '#input-led-template', + props: ['name', 'label'] +}) diff --git a/www/index.html b/www/index.html index e9e23f6..97428fe 100644 --- a/www/index.html +++ b/www/index.html @@ -36,71 +36,35 @@ Wild Thumper +
-
+

Power

- -
- -
- V -
-
- -
- -
- A -
-
+ +

Sensors

- -
- -
- lx -
-
- -
- -
- -
-
- -
- -
- % -
-
- -
- -
- kPa -
-
- - + + + + +
@@ -110,73 +74,37 @@
Speed: {{speed}} m/s
-
+
- - - - +
- - +
- - - - +
- - +
- - - - +
-
- -
- -
-
-
- -
- -
-
-
- -
- -
-
-
- -
- -
-
-
- -
- -
-
+ + + + +
@@ -186,4 +114,23 @@
+ +