Bladeren bron

OP tak #606 | add battery tab

Avetisyan Karen 5 jaren geleden
bovenliggende
commit
219f147269

BIN
web_interface/dist/wui-6/main.js


BIN
web_interface/dist/wui-6/settings.html


BIN
web_interface/dist/wui/main.js


BIN
web_interface/dist/wui/settings.html


+ 25 - 0
web_interface/src/wui-6/main.js

@@ -92,6 +92,7 @@ function fadeIn(el, display){
 
 function formValidation(){
   var read_community,write_community,managerIP,managerIP2,managerIP3,managerIP4,managerIP5,
+    ups_cell_min, ups_cell_max,
     ipaddr, gw, mask, tn_port/*, ntpservip*/;
 
   read_community  = $('read_community'),
@@ -105,6 +106,8 @@ function formValidation(){
   gw              = $('gw'),
   mask            = $('mask'),
   tn_port         = $('tn_port');
+  ups_cell_min    = +$('ups_cell_min').children[0].value;
+  ups_cell_max    = +$('ups_cell_max').children[0].value;
   // ntpservip          = $('ntpservip');
 
   var flag = true;
@@ -116,6 +119,12 @@ function formValidation(){
   if ($('tn_enabled').checked) {
     if(!ValidateNumber(tn_port, ' Порт Telnet')) flag = false;
   }
+  if(ups_cell_min > ups_cell_max) {
+    var warn = document.createElement('li');
+    warn.innerHTML = 'Минимальное напряжение на ячейке не может быть больше максимального!';
+    $('validation-box').appendChild(warn);
+    flag = false;
+  }
   if(!ValidateIPaddress(managerIP, ' Сервер SNMP 1')) flag = false;
   if(!ValidateAlphanumeric(read_community, 'Read Community')) flag = false;
   if(!ValidateAlphanumeric(write_community, 'Write Community')) flag = false;
@@ -814,6 +823,22 @@ function settingsGET(){
     fillTempRange('mainvolt_high', 220, 250);
     $('temp_high').value = data.temp_high;
     $('temp_low').value = data.temp_low;
+    ups_cell_min = new SpinBox('ups_cell_min', {
+      'value': data.ups_cell_min,
+      'name':'ups_cell_min',
+      'minimum':0,
+      'maximum':3.0,
+      'decimals':2,
+      'step':0.01
+    });
+    ups_cell_max = new SpinBox('ups_cell_max', {
+      'value': data.ups_cell_max,
+      'name':'ups_cell_max',
+      'minimum':0,
+      'maximum':3.0,
+      'decimals':2,
+      'step':0.01
+    });
     temp_hist     = new SpinBox('temp_hist', {
       'name':'temp_hist','minimum':0.5,'maximum':2.0,'step':0.1,'decimals':1, 'value': data.temp_hist
     });

+ 17 - 0
web_interface/src/wui-6/settings.html

@@ -170,6 +170,21 @@
     </div>
   </div>
 </div>
+<div id="ups" class="tabpane">
+  <div class="panel-heading">Аккумуляторные батареи</div>
+  <div class="panel-body section group">
+    <div class="col span_1_of_2">
+      <label for="ups_cell_min" class="col span_1_of_2">Мин. напряжение ячейки (В)</label>
+      <div class="col span_1_of_2">
+        <span id="ups_cell_min"></span>
+      </div>
+      <label for="ups_cell_max" class="col span_1_of_2">Макс. напряжение ячейки (В)</label>
+      <div class="col span_1_of_2">
+        <span id="ups_cell_max"></span>
+      </div>
+    </div>
+  </div>
+</div>
 <div id="netw" class="tabpane">
   <div class="panel-heading">Сетевые параметры</div>
   <div class="panel-body section group">
@@ -390,6 +405,8 @@ DYN_WEB.Tabs.setup({
   useCookies: true // optional
 });
 var ntpservipValue;
+var ups_cell_min  = new SpinBox('ups_cell_min', {'name':'ups_cell_min','minimum':0,'maximum':3,'step':0.01});
+var ups_cell_max  = new SpinBox('ups_cell_max', {'name':'ups_cell_max','minimum':0,'maximum':3,'step':0.01});
 var temp_hist     = new SpinBox('temp_hist', {'name':'temp_hist','minimum':0.5,'maximum':2.0,'step':0.1,'decimals':1, 'value': 0.5});
 var loadvolt_hist = new SpinBox('loadvolt_hist', {'name':'loadvolt_hist','minimum':0.5,'maximum':2.0,'step':0.1,'decimals':1, 'value': 0.5});
 var mainvolt_hist = new SpinBox('mainvolt_hist', {'name':'mainvolt_hist','minimum':10,'maximum':30,'step':1});

+ 25 - 0
web_interface/src/wui/main.js

@@ -92,6 +92,7 @@ function fadeIn(el, display){
 
 function formValidation(){
   var read_community,write_community,managerIP,managerIP2,managerIP3,managerIP4,managerIP5,
+    ups_cell_min, ups_cell_max,
     ipaddr, gw, mask,
     rs_server, rs_port, rs_key/*, ntpservip*/;
 
@@ -108,6 +109,8 @@ function formValidation(){
   rs_server       = $('rs_server'),
   rs_port         = $('rs_port'),
   rs_key          = $('rs_key');
+  ups_cell_min    = +$('ups_cell_min').children[0].value;
+  ups_cell_max    = +$('ups_cell_max').children[0].value;
   // ntpservip          = $('ntpservip');
 
   var flag = true;
@@ -121,6 +124,12 @@ function formValidation(){
     if(!ValidateNumber(rs_port, ' Порт RADIUS сервера')) flag = false;
     if(!ValidateAlphanumeric(rs_key, ' Код атрибута access RADIUS сервера')) flag = false;
   }
+  if(ups_cell_min > ups_cell_max) {
+    var warn = document.createElement('li');
+    warn.innerHTML = 'Минимальное напряжение на ячейке не может быть больше максимального!';
+    $('validation-box').appendChild(warn);
+    flag = false;
+  }
   if(!ValidateIPaddress(managerIP, ' Сервер SNMP 1')) flag = false;
   if(!ValidateAlphanumeric(read_community, 'Read Community')) flag = false;
   if(!ValidateAlphanumeric(write_community, 'Write Community')) flag = false;
@@ -827,6 +836,22 @@ function settingsGET(){
     fillTempRange('loadvolt_high', 60, 120);
     $('temp_high').value = data.temp_high;
     $('temp_low').value = data.temp_low;
+    ups_cell_min = new SpinBox('ups_cell_min', {
+      'value': data.ups_cell_min,
+      'name':'ups_cell_min',
+      'minimum':0,
+      'maximum':3.0,
+      'decimals':2,
+      'step':0.01
+    });
+    ups_cell_max = new SpinBox('ups_cell_max', {
+      'value': data.ups_cell_max,
+      'name':'ups_cell_max',
+      'minimum':0,
+      'maximum':3.0,
+      'decimals':2,
+      'step':0.01
+    });
     temp_hist     = new SpinBox('temp_hist', {
       'name':'temp_hist','minimum':0.5,'maximum':2.0,'step':0.1,'decimals':1, 'value': data.temp_hist
     });

+ 17 - 0
web_interface/src/wui/settings.html

@@ -169,6 +169,21 @@
     </div>
   </div>
 </div>
+<div id="ups" class="tabpane">
+  <div class="panel-heading">Аккумуляторные батареи</div>
+  <div class="panel-body section group">
+    <div class="col span_1_of_2">
+      <label for="ups_cell_min" class="col span_1_of_2">Мин. напряжение ячейки (В)</label>
+      <div class="col span_1_of_2">
+        <span id="ups_cell_min"></span>
+      </div>
+      <label for="ups_cell_max" class="col span_1_of_2">Макс. напряжение ячейки (В)</label>
+      <div class="col span_1_of_2">
+        <span id="ups_cell_max"></span>
+      </div>
+    </div>
+  </div>
+</div>
 <div id="netw" class="tabpane">
   <div class="panel-heading">Сетевые параметры</div>
   <div class="panel-body section group">
@@ -401,6 +416,8 @@ DYN_WEB.Tabs.setup({
   useCookies: true // optional
 });
 var ntpservipValue;
+var ups_cell_min  = new SpinBox('ups_cell_min', {'name':'ups_cell_min','minimum':0,'maximum':3,'step':0.01});
+var ups_cell_max  = new SpinBox('ups_cell_max', {'name':'ups_cell_max','minimum':0,'maximum':3,'step':0.01});
 var temp_hist     = new SpinBox('temp_hist', {'name':'temp_hist','minimum':0.5,'maximum':2.0,'step':0.1,'decimals':1, 'value': 0.5});
 var loadvolt_hist = new SpinBox('loadvolt_hist', {'name':'loadvolt_hist','minimum':0.5,'maximum':2.0,'step':0.1,'decimals':1, 'value': 0.5});
 settingsGET();