Ver código fonte

added colour function to integer-to-string type.

Signed-off-by: Nicholas Tan Jerome <nicholas.jerome@kit.edu>
Nicholas Tan Jerome 8 anos atrás
pai
commit
e740178a3f
3 arquivos alterados com 46 adições e 20 exclusões
  1. 8 4
      designer.html
  2. 8 3
      status.html
  3. 30 13
      style.yaml

+ 8 - 4
designer.html

@@ -37,7 +37,9 @@
 {% end %}
 
 {% if data['style'][key]['type'] == "integer-to-string" %}
-<div style='position: absolute; top: {{ data['style'][key]['top'] }}; left:{{ data['style'][key]['left'] }}; width:{{ data['style'][key]['width'] }}px; height:{{ data['style'][key]['height'] }}px;' data-dict="{{ data['style'][key]['dict'] }}" data-type="{{ data['style'][key]['type'] }}" class='varbox' id="{{ key }}">
+<div style='position: absolute; top: {{ data['style'][key]['top'] }}; left:{{
+    data['style'][key]['left'] }}; width:{{ data['style'][key]['width'] }}px;
+    height:{{ data['style'][key]['height'] }}px;' data-cond="{{data['style'][key]['cond']}}"  data-dict="{{ data['style'][key]['dict'] }}" data-type="{{ data['style'][key]['type'] }}" class='varbox' id="{{ key }}">
 <p><span style="color: #000; font-size: {{ data['style'][key]['header']['size'] }}; font-weight: {{ data['style'][key]['header']['weight'] }};" class="title">{{ data['style'][key]['header']['title'] }} </span><br /><span style="color: #000; font-size: {{ data['style'][key]['unit']['size'] }}; font-weight: {{ data['style'][key]['unit']['weight'] }};" class="varval">??? </span></p>
 </div>
 {% else %}
@@ -203,6 +205,7 @@ function add() {
                     "id='" + varname +
                     "' data-type='" + vartype +
                     "' data-dict='" + unit_text +
+                    "' data-cond='" + data_condition +
                     "'>" +
                     "<p>" +
                     "<span style='color: " + title_color + ";" + 
@@ -271,6 +274,7 @@ function mysave(data) {
             	tmp["off"] = $("#"+key).attr("data-off");
             } else if ( $("#"+key).attr("data-type") == "integer-to-string" ) {
             	tmp["dict"] = $("#"+key).attr("data-dict");
+            	tmp["cond"] = $("#"+key).attr("data-cond");
             	header = {};
             	header["title"] = $(".title", "#"+key).text();
             	//header["color"] = $(".title", "#"+key).css("color");
@@ -290,10 +294,10 @@ function mysave(data) {
             position[key] = tmp;
         }
     }
-    //console.log("Check here");
-    //console.log(position);
+    console.log("Check here");
+    console.log(position);
     var dataToSend = JSON.stringify(position);
-    console.log(dataToSend);
+    //console.log(dataToSend);
     $.ajax({
         url: '/save/',
         type: 'POST',

+ 8 - 3
status.html

@@ -41,7 +41,10 @@ data-type="{{ data['style'][key]['type'] }}" data-lesser="{{ data['style'][key][
 {% end %}
 
 {% if data['style'][key]['type'] == "integer-to-string" %}
-<div tooltip="{{ key }}" style='position: absolute; top: {{ data['style'][key]['top'] }}; left:{{ data['style'][key]['left'] }}; width:{{ data['style'][key]['width'] }}px; height:{{ data['style'][key]['height'] }}px;' data-dict="{{ data['style'][key]['dict'] }}" data-type="{{ data['style'][key]['type'] }}" onclick="window.open('http://katrin.kit.edu/adei-katrin/#module=graph&{{ data['varname'][key]}}&experiment=-&window=0&module=graph&virtual=srctree&srctree=&infomod=legend', '_blank');" class='databox' id="{{ key }}">
+<div tooltip="{{ key }}" style='position: absolute; top: {{
+    data['style'][key]['top'] }}; left:{{ data['style'][key]['left'] }};
+    width:{{ data['style'][key]['width'] }}px; height:{{
+    data['style'][key]['height'] }}px;' data-cond="{{ data['style'][key]['cond'] }}" data-dict="{{ data['style'][key]['dict'] }}" data-type="{{ data['style'][key]['type'] }}" onclick="window.open('http://katrin.kit.edu/adei-katrin/#module=graph&{{ data['varname'][key]}}&experiment=-&window=0&module=graph&virtual=srctree&srctree=&infomod=legend', '_blank');" class='databox' id="{{ key }}">
 <p><span style="color: #000; font-size: {{ data['style'][key]['header']['size'] }}; font-weight: {{ data['style'][key]['header']['weight'] }};" class="title">{{ data['style'][key]['header']['title'] }} </span><br /><span style="color: #000; font-size: {{ data['style'][key]['unit']['size'] }}; font-weight: {{ data['style'][key]['unit']['weight'] }};" class="varval">??? </span></p>
 </div>
 {% else %}
@@ -123,9 +126,11 @@ 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]];
                         //console.log("CHECK");
-			//console.log(response[key]);
-			//console.log(dict_attr);
+                        //console.log(response[key]);
+                        $(".varval", "#" + key).css("color", dict_color);
                         $(".varval", "#" + key).text(dict_attr[response[key]]);
 		    }
 		}

+ 30 - 13
style.yaml

@@ -1,26 +1,43 @@
 320-MOD-0-0001:
-  dict: '{"1":"bake out","2":"Cool-Down","3":"Argon-Preparation","4":"Standby","5":"Standard
-    Operation","6":"Regeneration","7":"Warm-Up","8":"CKrS Calibration"}'
+  cond: '{"5": "#ff0", "0": "#0f0"}'
+  dict: '{"5": "Five Mode", "0": "Zero Mode"}'
   header:
     size: 28px
-    title: 'Operation mode    '
+    title: ' '
     weight: '400'
-  height: 211
-  left: 223px
-  top: 98px
+  height: 137.99099999999999
+  left: 409px
+  top: 369px
   type: integer-to-string
   unit:
     size: 28px
     title: ''
     weight: '400'
-  width: 107
+  width: 293.991
+320-RTY-3-2101:
+  condition: ''
+  header:
+    size: 28px
+    title: '  '
+    weight: '400'
+  height: 92.991
+  larger: ''
+  left: 352px
+  lesser: ''
+  top: 189px
+  type: data
+  unit:
+    size: 28px
+    title: ' '
+    weight: '400'
+  width: 50.991
 320-RTY-3-3101:
   condition: ''
   header:
     size: 28px
-    title: '   '
+    title: '       '
     weight: '400'
-  height: 96
+  height: 95.991
   larger: '77'
   left: 182px
   lesser: '77'
@@ -28,14 +45,14 @@
   type: data
   unit:
     size: 28px
-    title: '  K'
+    title: '      K'
     weight: '400'
-  width: 164
+  width: 163.99099999999999
 411-REI-1-1110-0030:
-  height: 51
+  height: 50.991
   left: 517px
   'off': '1'
   'on': '0'
   top: 142px
   type: ventil
-  width: 50
+  width: 50.991