Переглянути джерело

fiddling with width for `ui_main`

clementinecomputing 5 роки тому
батько
коміт
54cefb084b

+ 1 - 0
busunit/DIUv2/html/css/diustyles.css

@@ -142,6 +142,7 @@ body { letter-spacing: 0.25em; }
 .bkeyFull   { width: 96vw; height: 96vh; }
 .bkeyNarrow { width: 12vw; height: 25vh; }
 .bkeyTime { width:16vw; height:10vh; }
+.bkeyTimeBig { width:16vw; height:10vh; }
 
 .bkeyw      { width: 25vw; height: 17vh; }
 .bkeym      { width: 20vw; height: 17vh; }

+ 17 - 16
busunit/DIUv2/html/js/diu_ui-ORG.js

@@ -229,6 +229,8 @@ function _switch_ui(to) {
     var _x = _calculate_ui_main_status_width_height();
     g_ctx.status_text_h = _x.n_height;
     g_ctx.status_text_w = _x.n_width;
+
+    console.log(g_ctx.status_text_h, g_ctx.status_text_w);
   }
 
   if ((to == "ui_main") ||
@@ -848,8 +850,9 @@ function _main_message_replace(msg, bg_color, text_color) {
     var n = lines.length;
     lines = lines.slice(n - g_ctx.status_text_h);
   }
+
   for (var i=0; i<lines.length; i++) {
-    lines[i] = lines[i].slice(0,g_ctx.status_text_w);
+    lines[i] = lines[i].slice(0,g_ctx.status_text_w-1);
   }
 
   var idx = lines.length-1;
@@ -859,7 +862,7 @@ function _main_message_replace(msg, bg_color, text_color) {
 
   var html_lines = [];
   for (var i=0; i<lines.length; i++) {
-    html_lines.push(lines[i].slice(0,g_ctx.status_text_w));
+    html_lines.push(lines[i].slice(0,g_ctx.status_text_w-1));
 
     if (html_lines[i].match(/ACCEPT/)) {
       html_lines[i] = "<div class='textrow accept'>" + html_lines[i] + "</div>";
@@ -882,8 +885,6 @@ function _main_message_replace(msg, bg_color, text_color) {
 
   }
 
-  g_ctx.status_text = lines.join("\n");
-
   g_ctx.status_text = lines.join("\n");
   g_ctx.status_html_text = html_lines.join("<br>");
   ele.innerHTML = g_ctx.status_html_text;
@@ -923,6 +924,11 @@ function _main_message_add(msg, bg_color, text_color) {
     var n = lines.length;
     lines = lines.slice(n - g_ctx.status_text_h);
   }
+
+  for (var i=0; i<lines.length; i++) {
+    lines[i] = lines[i].slice(0,g_ctx.status_text_w-1);
+  }
+
   for (var i=0; i<lines.length; i++) {
     html_lines.push(lines[i].slice(0,g_ctx.status_text_w-1));
 
@@ -1165,6 +1171,9 @@ function _reset() {
 }
 
 function _reboot() {
+
+  _api_request("custom", {"function":"reboot"});
+
   _switch_ui('ui_login');
   g_ctx.driver_login_state = "driver";
   _clear_ui_driver();
@@ -1172,11 +1181,11 @@ function _reboot() {
 }
 
 function _custom0() {
-  _api_request("interfaceupdown", {"interface":"eth0", "state":"up"}, function(inp) { console.log("custom0 ok:", inp); }, function(inp) { console.log("custom0 error:", inp); });
+  _api_request("interfaceupdown", {"interface":"eth0", "state":"up"});
 }
 
 function _custom1() {
-  _api_request("interfaceupdown", {"interface":"eth0", "state":"down"}, function(inp) { console.log("custom1 ok:", inp); }, function(inp) { console.log("custom1 error:", inp); });
+  _api_request("interfaceupdown", {"interface":"eth0", "state":"down"});
 }
 
 function _update_diagnostic_window(_msg) {
@@ -1185,25 +1194,17 @@ function _update_diagnostic_window(_msg) {
 }
 
 function _custom2() {
-  _api_request("interfaceinfo", {"interface":"eth0"}, _update_diagnostic_window, function(inp) { console.log("custom2 error:", inp); });
+  _api_request("interfaceinfo", {"interface":"eth0"}, _update_diagnostic_window);
 }
 
 function _custom3() {
-  _api_request("say", {"message":"speech test"}, function(inp) { console.log("custom3 ok:", inp); }, function(inp) { console.log("custom3 error:", inp); });
+  _api_request("say", {"message":"speech test"});
 }
 
 function _custom4() {
-  //_switch_ui('ui_login');
-  //g_ctx.driver_login_state = "driver";
-  //_clear_ui_driver();
-  //_clear_ui_paddle();
 }
 
 function _custom5() {
-  //_switch_ui('ui_login');
-  //g_ctx.driver_login_state = "driver";
-  //_clear_ui_driver();
-  //_clear_ui_paddle();
 }
 
 //------------