Ver Fonte

added some key checking on dict.

- some older style does not have the new keywords
  introduced.

Signed-off-by: nicolaisi <nicholas.jerome@kit.edu>
nicolaisi há 7 anos atrás
pai
commit
18772d27d6
2 ficheiros alterados com 516 adições e 36 exclusões
  1. 15 3
      status.html
  2. 501 33
      style.yaml

+ 15 - 3
status.html

@@ -92,7 +92,6 @@ function myTimer() {
                 //console.log(key, response[key]);
                 data_type = $("#" + key).attr('data-type');
                 if($("#" + key).length > 0) {
-
                     if (data_type == "data") {
                         var datavalue, set_color;
 			if (response[key]) {
@@ -136,8 +135,21 @@ function myTimer() {
       			}
 		    } else if (data_type == "integer-to-string") {
                         var dict_attr = JSON.parse($("#" + key).attr('data-dict'));
-                        var dict_cond = JSON.parse($("#" + key).attr('data-cond'));
-                        var dict_color = dict_cond[response[key]];
+                        //var dict_cond = {}; 
+                        var dict_cond;
+                        var attr = $("#" + key).attr('data-cond');
+                        if (typeof attr !== typeof undefined && attr !== false) {
+                            dict_cond = {};
+                        } else {
+                            dict_cond = JSON.parse($("#" + key).attr('data-cond'));
+                        }
+                        var dict_color = "";
+                        if (key in response) {
+                            var token = response[key];
+                            if (token in dict_cond) {
+                                dict_color = dict_cond[token];
+                            }
+                        }
                         //console.log("CHECK");
                         //console.log(response[key]);
                         $(".varval", "#" + key).css("color", dict_color);

+ 501 - 33
style.yaml

@@ -1,58 +1,526 @@
-320-MOD-0-0001:
-  cond: '{"5": "#ff0", "0": "#0f0"}'
-  dict: '{"5": "Five Mode", "0": "Zero Mode"}'
+311-RBY-1-5051:
+  condition: ''
   header:
-    size: 28px
-    title: '       '
+    size: 27.3667px
+    title: 'DPS magnet            '
+    weight: '400'
+  height: 171.11112
+  larger: ''
+  left: 23px
+  lesser: ''
+  top: 521px
+  type: data
+  unit:
+    size: 27.3667px
+    title: '           T'
     weight: '400'
-  height: 137.99099999999999
-  left: 409px
-  top: 369px
+  width: 120.11112
+320-MOD-0-0001:
+  cond: '{"1":"","2":"","3":"","4":"","5":"","6":"", "7": "","8": ""}'
+  dict: '{"1":"Bake-Out","2":"Cool-Down","3":"Argon-Preparation","4":"Standby","5":"Standard
+    Operation","6":" Regeneration", "7": "Warm-Up","8": "CKrS Calibration"}'
+  header:
+    size: 27.3667px
+    title: 'Operation Mode           '
+    weight: bold
+  height: 133.11112
+  left: 192px
+  top: 132px
   type: integer-to-string
   unit:
-    size: 28px
+    size: 27.3667px
     title: ''
     weight: '400'
-  width: 293.991
-320-RTY-3-2101:
+  width: 343.11112
+320-REI-1-5103:
+  condition: ''
+  header:
+    size: 27.3667px
+    title: 'Current:                     '
+    weight: '400'
+  height: 95.11112
+  larger: '200'
+  left: 209px
+  lesser: ''
+  top: 450px
+  type: data
+  unit:
+    size: 27.3667px
+    title: '                    A'
+    weight: '400'
+  width: 275.11112
+320-REU-8-1102:
+  condition: ''
+  header:
+    size: 27.3667px
+    title: '|                        '
+    weight: '400'
+  height: 95.11112
+  larger: '0.1'
+  left: 513px
+  lesser: ''
+  top: 389px
+  type: data
+  unit:
+    size: 27.3667px
+    title: '                       V'
+    weight: '400'
+  width: 134.11112
+320-REU-8-2102:
+  condition: ''
+  header:
+    size: 27.3667px
+    title: '|                      '
+    weight: '400'
+  height: 95.11112
+  larger: '0.1'
+  left: 501px
+  lesser: ''
+  top: 330px
+  type: data
+  unit:
+    size: 27.3667px
+    title: '                     V'
+    weight: '400'
+  width: 131.11112
+320-RLI-2-8116:
+  condition: ''
+  header:
+    size: 27.3667px
+    title: '          '
+    weight: '400'
+  height: 53.11112
+  larger: '90'
+  left: 781px
+  lesser: '10'
+  top: 141px
+  type: data
+  unit:
+    size: 27.3667px
+    title: '         %'
+    weight: '400'
+  width: 190.11112
+320-RLI-2-9111:
+  condition: ''
+  header:
+    size: 27.3667px
+    title: '          '
+    weight: '400'
+  height: 63.11112
+  larger: '90'
+  left: 1158px
+  lesser: '10'
+  top: 347px
+  type: data
+  unit:
+    size: 27.3667px
+    title: '         %'
+    weight: '400'
+  width: 195.11112
+320-RLI-5-0103:
+  condition: ''
+  header:
+    size: 27.3667px
+    title: '          '
+    weight: '400'
+  height: 68.11112
+  larger: '90'
+  left: 1158px
+  lesser: '10'
+  top: 171px
+  type: data
+  unit:
+    size: 27.3667px
+    title: '         %'
+    weight: '400'
+  width: 178.11112
+320-RPI-2-8125:
   condition: ''
   header:
     size: 28px
-    title: '        '
+    title: '     '
     weight: '400'
-  height: 92.991
-  larger: ''
-  left: 352px
+  height: 95.11112
+  larger: '2.5'
+  left: 779px
   lesser: ''
-  top: 189px
+  top: 186px
   type: data
   unit:
     size: 28px
-    title: '       '
+    title: '    bar'
     weight: '400'
-  width: 50.991
-320-RTY-3-3101:
+  width: 142.11112
+320-RPI-9-0121:
   condition: ''
   header:
     size: 28px
-    title: '             '
+    title: '     '
     weight: '400'
-  height: 95.991
-  larger: '77'
-  left: 182px
-  lesser: '77'
-  top: 834px
+  height: 94.11112
+  larger: '2.5'
+  left: 1157px
+  lesser: ''
+  top: 401px
   type: data
   unit:
     size: 28px
+    title: '    bar'
+    weight: '400'
+  width: 148.11112
+320-RTP-3-1101:
+  condition: ''
+  header:
+    size: 27.3667px
+    title: '                                   '
+    weight: '400'
+  height: 95.11112
+  larger: '77'
+  left: 180px
+  lesser: ''
+  top: 820px
+  type: data
+  unit:
+    size: 27.3667px
+    title: '                                  K'
+    weight: '400'
+  width: 124.11112
+320-RTP-3-6101:
+  condition: ''
+  header:
+    size: 27.3667px
+    title: '                                '
+    weight: '400'
+  height: 134.11112
+  larger: '77'
+  left: 1325px
+  lesser: ''
+  top: 820px
+  type: data
+  unit:
+    size: 27.3667px
+    title: '                               K'
+    weight: '400'
+  width: 121.11112
+320-RTP-3-7101:
+  condition: ''
+  header:
+    size: 27.3667px
+    title: '                               '
+    weight: '400'
+  height: 95.11112
+  larger: '77'
+  left: 1625px
+  lesser: ''
+  top: 818px
+  type: data
+  unit:
+    size: 27.3667px
+    title: '                              K'
+    weight: '400'
+  width: 123.11112
+320-RTP-5-0102:
+  condition: ''
+  header:
+    size: 27.3667px
+    title: '             '
+    weight: '400'
+  height: 94.11112
+  larger: '79'
+  left: 1158px
+  lesser: ''
+  top: 121px
+  type: data
+  unit:
+    size: 27.3667px
     title: '            K'
     weight: '400'
-  width: 163.99099999999999
+  width: 131.11112
+320-RTP-5-9107:
+  condition: ''
+  header:
+    size: 27.3667px
+    title: 'Rad. shield                    '
+    weight: '400'
+  height: 95.11112
+  larger: '100'
+  left: 488px
+  lesser: ''
+  top: -21px
+  type: data
+  unit:
+    size: 27.3667px
+    title: '                   K'
+    weight: '400'
+  width: 282.11112
+320-RTP-5-9111:
+  condition: ''
+  header:
+    size: 27.3667px
+    title: 'Rad. shield                   '
+    weight: '400'
+  height: 172.11112
+  larger: '100'
+  left: 1799px
+  lesser: ''
+  top: 237px
+  type: data
+  unit:
+    size: 27.3667px
+    title: '                  K'
+    weight: '400'
+  width: 121.11112
+320-RTP-8-1103:
+  condition: ''
+  header:
+    size: 27.3667px
+    title: 'Negative pole:                         '
+    weight: '400'
+  height: 95.11112
+  larger: '350'
+  left: 207px
+  lesser: ''
+  top: 389px
+  type: data
+  unit:
+    size: 27.3667px
+    title: '                        K'
+    weight: '400'
+  width: 339.11112
+320-RTP-8-2103:
+  condition: ''
+  header:
+    size: 27.3667px
+    title: 'Positive pole:                       '
+    weight: '400'
+  height: 94.11112
+  larger: '350'
+  left: 208px
+  lesser: ''
+  top: 331px
+  type: data
+  unit:
+    size: 27.3667px
+    title: '                      K'
+    weight: '400'
+  width: 311.11112
+320-RTT-1-1107:
+  condition: ''
+  header:
+    size: 27.3667px
+    title: '                              '
+    weight: '400'
+  height: 94.11112
+  larger: '6'
+  left: 183px
+  lesser: ''
+  top: 642px
+  type: data
+  unit:
+    size: 27.3667px
+    title: '                             K'
+    weight: '400'
+  width: 127.11112
+320-RTT-1-2107:
+  condition: ''
+  header:
+    size: 27.3667px
+    title: '                             '
+    weight: '400'
+  height: 94.11112
+  larger: '6'
+  left: 454px
+  lesser: ''
+  top: 643px
+  type: data
+  unit:
+    size: 27.3667px
+    title: '                            K'
+    weight: '400'
+  width: 133.11112
+320-RTT-1-3107:
+  condition: ''
+  header:
+    size: 27.3667px
+    title: '                            '
+    weight: '400'
+  height: 94.11112
+  larger: '6'
+  left: 656px
+  lesser: ''
+  top: 643px
+  type: data
+  unit:
+    size: 27.3667px
+    title: '                           K'
+    weight: '400'
+  width: 121.11112
+320-RTT-1-4107:
+  condition: ''
+  header:
+    size: 27.3667px
+    title: '                           '
+    weight: '400'
+  height: 94.11112
+  larger: '6'
+  left: 843px
+  lesser: ''
+  top: 642px
+  type: data
+  unit:
+    size: 27.3667px
+    title: '                          K'
+    weight: '400'
+  width: 120.11112
+320-RTT-1-5107:
+  condition: ''
+  header:
+    size: 27.3667px
+    title: '                           '
+    weight: '400'
+  height: 94.11112
+  larger: '6'
+  left: 1044px
+  lesser: ''
+  top: 641px
+  type: data
+  unit:
+    size: 27.3667px
+    title: '                          K'
+    weight: '400'
+  width: 140.11112
+320-RTT-1-6108:
+  condition: ''
+  header:
+    size: 28px
+    title: '   '
+    weight: '400'
+  height: 61.11112
+  larger: '6'
+  left: 1336px
+  lesser: ''
+  top: 644px
+  type: data
+  unit:
+    size: 28px
+    title: '  K'
+    weight: '400'
+  width: 120.11112
+320-RTT-1-7107:
+  condition: ''
+  header:
+    size: 27.3667px
+    title: '                          '
+    weight: '400'
+  height: 94.11112
+  larger: '6'
+  left: 1632px
+  lesser: ''
+  top: 643px
+  type: data
+  unit:
+    size: 27.3667px
+    title: '                         K'
+    weight: '400'
+  width: 122.11112
+320-RTT-2-8115:
+  condition: ''
+  header:
+    size: 27.3667px
+    title: '                  '
+    weight: '400'
+  height: 63.11112
+  larger: '6.5'
+  left: 782px
+  lesser: ''
+  top: 95px
+  type: data
+  unit:
+    size: 27.3667px
+    title: '                 K'
+    weight: '400'
+  width: 143.11112
+320-RTY-3-2101:
+  condition: ''
+  header:
+    size: 27.3667px
+    title: '                                   '
+    weight: '400'
+  height: 94.11112
+  larger: '4.5'
+  left: 455px
+  lesser: ''
+  top: 823px
+  type: data
+  unit:
+    size: 27.3667px
+    title: '                                  K'
+    weight: '400'
+  width: 118.11112
+320-RTY-3-3101:
+  condition: ''
+  header:
+    size: 27.3667px
+    title: '                                   '
+    weight: '400'
+  height: 94.11112
+  larger: '4.5'
+  left: 658px
+  lesser: ''
+  top: 823px
+  type: data
+  unit:
+    size: 27.3667px
+    title: '                                  K'
+    weight: '400'
+  width: 121.11112
+320-RTY-3-4101:
+  condition: ''
+  header:
+    size: 27.3667px
+    title: '                                  '
+    weight: '400'
+  height: 134.11112
+  larger: '4.5'
+  left: 854px
+  lesser: ''
+  top: 821px
+  type: data
+  unit:
+    size: 27.3667px
+    title: '                                 K'
+    weight: '400'
+  width: 113.11112
+320-RTY-3-5101:
+  condition: ''
+  header:
+    size: 27.3667px
+    title: '                                 '
+    weight: '400'
+  height: 94.11112
+  larger: '4.5'
+  left: 1045px
+  lesser: ''
+  top: 821px
+  type: data
+  unit:
+    size: 27.3667px
+    title: '                                K'
+    weight: '400'
+  width: 101.11112
 411-REI-1-1110-0030:
-  height: 50.991
-  left: 517px
-  'off': '1'
-  'on': '0'
-  top: 142px
-  type: ventil
-  width: 50.991
+  cond: ''
+  dict: '{"0":"off","1":"on"}'
+  header:
+    size: 27.3667px
+    title: 'PS magnet            '
+    weight: '400'
+  height: 133.11112
+  left: 1800px
+  top: 513px
+  type: integer-to-string
+  unit:
+    size: 27.3667px
+    title: ''
+    weight: '400'
+  width: 154.11112