فهرست منبع

prevent select same temp target & pgw fix

Avetisyan Karen 5 سال پیش
والد
کامیت
4844c1d46e

BIN
web_interface/dist/wui-10/history.html


BIN
web_interface/dist/wui-10/index.html


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


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


BIN
web_interface/dist/wui-10/ups_history.html


+ 22 - 4
web_interface/src/wui-10/main.js

@@ -810,13 +810,13 @@ function fillTempRange(id, min, max) {
 }
 function pgwState() {
   if (!$('pgw_en').checked) {
-    $('pgw_port').setAttribute('disabled', 'disabled');
+    $('pgw_port').children[0].setAttribute('disabled', 'disabled');
     $('pgw_baud').setAttribute('disabled', 'disabled');
     $('pgw_par').setAttribute('disabled', 'disabled');
     $('pgw_ndata').setAttribute('disabled', 'disabled');
     $('pgw_nstop').setAttribute('disabled', 'disabled');
   } else {
-    $('pgw_port').removeAttribute('disabled');
+    $('pgw_port').children[0].removeAttribute('disabled');
     $('pgw_baud').removeAttribute('disabled');
     $('pgw_par').removeAttribute('disabled');
     $('pgw_ndata').removeAttribute('disabled');
@@ -832,6 +832,25 @@ function changeNData(e) {
     $(num+'_ndata').children[0].disabled = false;
   }
 }
+
+function tsChange() {
+  var selects = ['type_ts1', 'type_ts2'];
+  for (var s in selects) {
+    var obj = $(selects[s]);
+    for (var j = 1; j < obj.options.length; j++) {
+      if (obj.options[j].value != obj.value && obj.options[j].value !== 0) {
+        obj.options[j].disabled = false;
+        if (obj.options[j].value == $(selects[0]).value)
+          obj.options[j].disabled = true;
+        if (obj.options[j].value == $(selects[1]).value)
+          obj.options[j].disabled = true;
+      } else {
+        obj.options[j].disabled = false;
+      }
+    }
+  }
+}
+
 function settingsGET(){
   getJSON('settings.cgi', function(data) {
     //SNMP params
@@ -848,7 +867,6 @@ function settingsGET(){
     $('di2').value = +data.di2;
     $('type_ts1').value = +data.type_ts1;
     $('type_ts2').value = +data.type_ts2;
-
     // Network params
     $('ipaddr').value   = data.ipaddr;
     $('gw').value       = data.gw;
@@ -910,7 +928,7 @@ function settingsGET(){
     $('pgw_ndata').value = data.pgw_ndata;
     $('pgw_nstop').value = data.pgw_nstop;
     changeNData($('pgw_par'));
-
+    tsChange();
     // DateTime
     if (data.ntpservip != $('ntpservip').options[0].value &&
         data.ntpservip != $('ntpservip').options[1].value &&

+ 2 - 2
web_interface/src/wui-10/settings.html

@@ -147,7 +147,7 @@
           <tr>
             <td>1</td>
             <td>
-              <select name="type_ts1" id="type_ts1" class="form-control">
+              <select name="type_ts1" id="type_ts1" class="form-control" onchange="tsChange();">
                 <option value="0">Нет</option>
                 <option value="1">Шкаф</option>
                 <option value="2">АКБ</option>
@@ -157,7 +157,7 @@
           <tr>
             <td>2</td>
             <td>
-              <select name="type_ts2" id="type_ts2" class="form-control">
+              <select name="type_ts2" id="type_ts2" class="form-control" onchange="tsChange();">
                 <option value="0">Нет</option>
                 <option value="1">Шкаф</option>
                 <option value="2">АКБ</option>