Bladeren bron

Merge branch 'master' of https://github.com/kit-ipe/bora

Nicholas Jerome 7 jaren geleden
bovenliggende
commit
2383a92789
2 gewijzigde bestanden met toevoegingen van 47 en 45 verwijderingen
  1. 6 7
      designer.html
  2. 41 38
      status.html

+ 6 - 7
designer.html

@@ -173,7 +173,7 @@
 </select>
 <br /><br />
 <button class="button save" onclick="backup()">Backup</button>
-<button style="display:none;" id="buttonHighlight" class="button highlight" onclick="highlight({{ data['style'] }})">Highlight</button>
+<button style="display:none;" id="buttonHighlight" class="button highlight" onclick="highlight({{ data['cache'] }})">Highlight</button>
 <button class="button add" onclick="add()">Add</button>
 <button class="button remove" onclick="myremove()">Remove</button>
 <button class="button save" onclick="mysave({{ data['cache'] }})">Save</button>
@@ -815,6 +815,8 @@ function mysave(data) {
 }
     
 function highlight(mydata) {
+    console.log("highlight");
+
     varname = $("#varname option:selected").text();
     vartype = $("#"+varname).attr("data-type");
     $("#vartype").val(vartype);
@@ -947,24 +949,21 @@ function highlight(mydata) {
     }
 }
 
+
 jQuery(window).load(function () {
     $("#varname > option").each(function() {
         if ($('#'+this.text).length){
             $('#'+this.text).draggable();
             $('#'+this.text).resizable(); 
             $('#'+this.text).click(function() {
-                console.log($(this).attr("id"));
+                //console.log($(this).attr("id")); 
                 $("#varname").val($(this).attr("id"));
                 $("#buttonHighlight").trigger("click"); 
             });
         }
         //console.log(this.text + ' ' + this.value);
     });
-    //$('[id^=header_]').each(function( index ) {
-    //    $(this).draggable();
-    //    $(this).resizable(); 
-    //});
-
+    
     $("#buttonHighlight").trigger("click"); 
 
     $("#varname").change(function() {

+ 41 - 38
status.html

@@ -42,7 +42,7 @@
 {% else %}
 {% end %}
  data-type="{{ data['style'][key]['type'] }}" class='databox' id="{{ key }}">
-<p><span style="color: #000; font-size: {{ data['style'][key]['header']['size'] }}px; font-weight: {{ data['style'][key]['header']['weight'] }};" class="title">{{ data['style'][key]['header']['title'] }} </span><span style="color: #000; font-size: {{ data['style'][key]['unit']['size'] }}px; font-weight: {{ data['style'][key]['unit']['weight'] }};" class="varval"> XXX.XX </span><span class='unit_title' style="color: #000; font-size: {{ data['style'][key]['unit']['size'] }}px; font-weight: {{ data['style'][key]['unit']['weight'] }};" > {{ data['style'][key]['unit']['title'] }}</span></p>
+<p><span style="color: #000; font-size: {{ data['style'][key]['header']['size'] }}px; font-weight: {{ data['style'][key]['header']['weight'] }};" class="title">{{ data['style'][key]['header']['title'] }} </span><span style="color: #000; font-size: {{ data['style'][key]['unit']['size'] }}px; font-weight: {{ data['style'][key]['unit']['weight'] }};" class="varval"> --- </span><span class='unit_title' style="color: #000; font-size: {{ data['style'][key]['unit']['size'] }}px; font-weight: {{ data['style'][key]['unit']['weight'] }};" > {{ data['style'][key]['unit']['title'] }}</span></p>
 </div>
 {% else %}
 {% end %}
@@ -73,11 +73,11 @@ data-larger="{{ data['style'][key]['larger'] }}"
      
 {% if "ref" in data['style'][key] %}
 data-type="{{ data['style'][key]['type'] }}" onclick="window.open('http://katrin.kit.edu/adei-katrin/#module=graph&{{ data['varname'][data['style'][key]['ref']] }}&experiment=-&window=86400&module=graph&virtual=srctree&srctree=&infomod=legend', '_blank');" id="{{ key }}">
-<p><span style="color: #000; font-size: {{ data['style'][key]['header']['size'] }}px; font-weight: {{ data['style'][key]['header']['weight'] }};" class="title">{{ data['style'][key]['header']['title'] }} </span><span style="color: #000; font-size: {{ data['style'][key]['unit']['size'] }}px; font-weight: {{ data['style'][key]['unit']['weight'] }};" class="varval"> XXX.XX </span><span class='unit_title' style="color: #000; font-size: {{ data['style'][key]['unit']['size'] }}px; font-weight: {{ data['style'][key]['unit']['weight'] }};"> {{ data['style'][key]['unit']['title'] }}</span></p>
+<p><span style="color: #000; font-size: {{ data['style'][key]['header']['size'] }}px; font-weight: {{ data['style'][key]['header']['weight'] }};" class="title">{{ data['style'][key]['header']['title'] }} </span><span style="color: #000; font-size: {{ data['style'][key]['unit']['size'] }}px; font-weight: {{ data['style'][key]['unit']['weight'] }};" class="varval"> --- </span><span class='unit_title' style="color: #000; font-size: {{ data['style'][key]['unit']['size'] }}px; font-weight: {{ data['style'][key]['unit']['weight'] }};"> {{ data['style'][key]['unit']['title'] }}</span></p>
 </div>
 {% else %}
 data-type="{{ data['style'][key]['type'] }}" onclick="window.open('http://katrin.kit.edu/adei-katrin/#module=graph&{{ data['varname'][key]}}&experiment=-&window=86400&module=graph&virtual=srctree&srctree=&infomod=legend', '_blank');" id="{{ key }}">
-<p><span style="color: #000; font-size: {{ data['style'][key]['header']['size'] }}px; font-weight: {{ data['style'][key]['header']['weight'] }};" class="title">{{ data['style'][key]['header']['title'] }} </span><span style="color: #000; font-size: {{ data['style'][key]['unit']['size'] }}px; font-weight: {{ data['style'][key]['unit']['weight'] }};" class="varval"> XXX.XX </span><span class='unit_title' style="color: #000; font-size: {{ data['style'][key]['unit']['size'] }}px; font-weight: {{ data['style'][key]['unit']['weight'] }};"> {{ data['style'][key]['unit']['title'] }}</span></p>
+<p><span style="color: #000; font-size: {{ data['style'][key]['header']['size'] }}px; font-weight: {{ data['style'][key]['header']['weight'] }};" class="title">{{ data['style'][key]['header']['title'] }} </span><span style="color: #000; font-size: {{ data['style'][key]['unit']['size'] }}px; font-weight: {{ data['style'][key]['unit']['weight'] }};" class="varval"> --- </span><span class='unit_title' style="color: #000; font-size: {{ data['style'][key]['unit']['size'] }}px; font-weight: {{ data['style'][key]['unit']['weight'] }};"> {{ data['style'][key]['unit']['title'] }}</span></p>
 </div>
 {% end %}
 
@@ -151,59 +151,62 @@ function myTimer() {
             //var objresponse = JSON.parse(response);
             console.log(response);
             for (var key in response) {
-                //console.log(key, response[key]);
+                //console.log(key, response[key]); 
                 data_type = $("#" + key).attr('data-type');
                 if($("#" + key).length > 0) {
                     if (data_type == "data") {
+                        //console.log("data");
                         var datavalue, set_color, formula;
                         var formula_attr = $("#" + key).attr('data-formula');
-			            if (response[key]) {
+			if (response[key]) {
                             if (formula_attr) {
                                 datavalue = parseFloat(response[key]).toFixed(2);
  			        formula = formula_attr.replace("x", datavalue.toString());
                                 datavalue = math.round(math.eval(formula),2);
                                 datavalue = datavalue.toFixed(2);
-		    	            } else {
-			                    datavalue = parseFloat(response[key]).toFixed(2);
+		    	    } else {
+			        datavalue = parseFloat(response[key]).toFixed(2);
                             }
- 		    	            set_color = "green";
-			            } else {
-			                datavalue = "---";
-			                set_color = "black";
-			            }
+ 		    	    set_color = "green";
+		        } else {
+			    datavalue = "---";
+			    set_color = "black";
+		        }
                         $(".varval", "#" + key).text(datavalue);
                         var condition_attr = $("#" + key).attr('data-cond');
                         var lesser_attr = $("#" + key).attr('data-lesser');
                         var larger_attr = $("#" + key).attr('data-larger');
   		    	        //console.log(condition_attr);
                         if (condition_attr) {
- 			                if (response[key] == condition_attr) {
- 			    	            set_color = "red";
-      			            }
-		    	        }
- 		    	        if (lesser_attr) {
- 			                if (parseFloat(response[key]) < parseFloat(lesser_attr)) {
- 			    	            set_color = "red";
-      			            }
-		    	        }
-  		                if (larger_attr) {
- 			                if (parseFloat(response[key]) > parseFloat(larger_attr)) {
- 			    	            set_color = "red";
-      			            }
-		    	        }
-		    	        $(".varval", "#" + key).css("color", set_color);
-		    	        $(".unit_title", "#" + key).css("color", set_color);
+ 			    if (response[key] == condition_attr) {
+ 			        set_color = "red";
+      			    }
+		    	}
+ 		    	if (lesser_attr) {
+ 			    if (parseFloat(response[key]) < parseFloat(lesser_attr)) {
+ 			    	set_color = "red";
+      			    }
+		    	}
+  		        if (larger_attr) {
+ 			    if (parseFloat(response[key]) > parseFloat(larger_attr)) {
+ 			    	set_color = "red";
+      			    }
+		    	}
+		    	$(".varval", "#" + key).css("color", set_color);
+		    	$(".unit_title", "#" + key).css("color", set_color);
                     
-		            } else if (data_type == "ventil") {
+		    } else if (data_type == "ventil") {
+                        //console.log("ventil");
                         var on_attr = $("#" + key).attr('data-on');
                         var off_attr = $("#" + key).attr('data-off');
- 			            if (parseFloat(response[key]) == parseFloat(on_attr)) {
- 			                $("img", "#" + key).attr("src", "{{ static_url('ventil_green.png') }}");
-      			        }
- 			            if (parseFloat(response[key]) == parseFloat(off_attr)) {
- 			                $("img", "#" + key).attr("src", "{{ static_url('ventil_red.png') }}");
-      			        }
-		            } else if (data_type == "integer-to-string") {
+ 			if (parseFloat(response[key]) == parseFloat(on_attr)) {
+ 			    $("img", "#" + key).attr("src", "{{ static_url('ventil_green.png') }}");
+      			}
+ 			if (parseFloat(response[key]) == parseFloat(off_attr)) {
+ 			    $("img", "#" + key).attr("src", "{{ static_url('ventil_red.png') }}");
+      			}
+		    } else if (data_type == "integer-to-string") {
+                        //console.log("integer-to-string");
                         var dict_attr = JSON.parse($("#" + key).attr('data-dict'));
                         var dict_cond;
                         if ($("#"+key).attr("data-cond")) {
@@ -220,8 +223,8 @@ function myTimer() {
                         }
                         $(".varval", "#" + key).css("color", dict_color);
                         $(".varval", "#" + key).text(dict_attr[response[key]]);
-		            }
-		        }
+		    }
+		}
             }
             $('[id^=virtual_]').each(function( index ) {
                 var key = this.id;