Browse Source

enabled cross bora services path.

Signed-off-by: root <root@ipekatrinadei.ipe.kit.edu>
root 7 years ago
parent
commit
ab56c424f1
4 changed files with 43 additions and 69 deletions
  1. 1 1
      .gitignore
  2. 1 1
      core.py
  3. 40 26
      designer.html
  4. 1 41
      status.html

+ 1 - 1
.gitignore

@@ -4,4 +4,4 @@ style.yaml
 .tmp.yaml
 *.yaml
 backup
-static/dataimage/
+images/

+ 1 - 1
core.py

@@ -92,7 +92,7 @@ def fetchDataADEI():
                              auth=(config['username'],
                                    config['password']))
 
-        with open("static/dataimage/" + param + ".png", 'wb') as handle:
+        with open("static/"+config['title'].lower()+"/images/" + param + ".png", 'wb') as handle:
             for chunk in image.iter_content():
                 handle.write(chunk)
 

+ 40 - 26
designer.html

@@ -32,27 +32,33 @@
 <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;
-{% if "background_color" in data['style'][key] %}
-  background-color:{{ data['style'][key]['background_color'] }};' 
-{% else %}
-{% end %}
-{% if "condition" in data['style'][key] %}
- data-cond="{{ data['style'][key]['condition'] }}"
-{% else%}position
-{% end%}
-{% if "formula" in data['style'][key] %}
- data-formula="{{ data['style'][key]['formula'] }}"
-{% else %}
-{% end %}
-{% if "lesser" in data['style'][key] %}
- data-lesser="{{ data['style'][key]['lesser'] }}"
-{% else %}
-{% end %}
-{% if "larger" in data['style'][key] %}
- data-larger="{{ data['style'][key]['larger'] }}"
-{% else %}
-{% end %}
- data-type="{{ data['style'][key]['type'] }}" class='varbox' id="{{ key }}">
+
+    {% if "background_color" in data['style'][key] %}
+        background-color:{{ data['style'][key]['background_color'] }};' 
+    {% else %}
+    {% end %}
+
+    {% if "condition" in data['style'][key] %}
+        data-cond="{{ data['style'][key]['condition'] }}"
+    {% else%}position
+    {% end%}
+
+    {% if "formula" in data['style'][key] %}
+        data-formula="{{ data['style'][key]['formula'] }}"
+    {% else %}
+    {% end %}
+
+    {% if "lesser" in data['style'][key] %}
+        data-lesser="{{ data['style'][key]['lesser'] }}"
+    {% else %}
+    {% end %}
+
+    {% if "larger" in data['style'][key] %}
+        data-larger="{{ data['style'][key]['larger'] }}"
+    {% else %}
+    {% end %}
+
+    data-type="{{ data['style'][key]['type'] }}" class='varbox' 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 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></span></p>
 </div>
 {% else %}
@@ -592,10 +598,13 @@ function add() {
                     "class='title'>" + title_text +
                     " </span>" + 
                     "<span style='color: " + unit_color + "; " + 
-                           "font-size:" + unit_size + "px; " +
-                           "font-weight: " + unit_style + ";' " + 
-                    "class='varval'>XXX.XX </span>" + 
-                    "<span class='unit_title'>" + unit_text + "</span></p>" +
+                        "font-size:" + unit_size + "px; " +
+                        "font-weight: " + unit_style + ";' " + 
+                        "class='varval'>XXX.XX </span>" + 
+                    "<span style='color: " + unit_color + "; " + 
+                        "font-size:" + unit_size + "px; " +
+                        "font-weight: " + unit_style + ";' " + 
+                        "class='unit_title'>" + unit_text + "</span></p>" +
         	    "</div>";
         } else if (vartype == "header") {
             console.log("Header");
@@ -663,7 +672,10 @@ function add() {
                                "font-size:" + unit_size + "px; " +
                                "font-weight: " + unit_style + ";' " + 
                         "class='varval'>XXX.XX </span>" + 
-                        "<span class='unit_title'>" + unit_text + "</span></p>" +
+                        "<span style='color: " + unit_color + "; " + 
+                            "font-size:" + unit_size + "px; " +
+                            "font-weight: " + unit_style + ";' " + 
+                            "class='unit_title'>" + unit_text + "</span></p>" +
         	        "</div>";
             
                 $('#varname').append($('<option>', {
@@ -1319,6 +1331,7 @@ function mysave(data) {
         }
         tmp["header"] = header;
         position[hkey] = tmp;
+        tmp["type"] = header;
         //console.log( index + ": " + $( this ).text() );
     });
     
@@ -1394,6 +1407,7 @@ function mysave(data) {
         data: dataToSend,
         success: function (response) {
             var objresponse = JSON.parse(response);
+            alert("Save success!");
             console.log(objresponse);
         },
         error: function () {

+ 1 - 41
status.html

@@ -505,7 +505,7 @@ jQuery(window).load(function () {
 $(".databox").hover(function(){
     var key = $(this).attr('id');
     if ($("#" + key).attr('data-trend') == "true") {
-        $('#'+ key).append('<span class="popup"><img src="/static/dataimage/'+key+'.png" width="600px" height="400px"/></span>');
+        $('#'+ key).append('<span class="popup"><img src="/static/'+ $("#page_title_cache").text().toLowerCase() +'/images/'+key+'.png" width="600px" height="400px"/></span>');
     }
 });
 
@@ -604,27 +604,6 @@ function myTimer() {
                                 $(".icon img", "#" + key).attr("src", "/static/" + $("#" + key).attr('data-icon') + "_red.svg");
                             }
                         }
-			/*
-                    } else if (data_type == "commbit") {
-                        //console.log("commbit");
-                        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('commbit_green.svg') }}");
-                        }
-                        if (parseFloat(response[key]) == parseFloat(off_attr)) {
-                            $("img", "#" + key).attr("src", "{{ static_url('commbit_red.svg') }}");
-                        }
-                    } else if (data_type == "alarm") {
-                        //console.log("alarm");
-                        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('alarm_active.svg') }}");
-                        }
-                        if (parseFloat(response[key]) == parseFloat(off_attr)) {
-                            $("img", "#" + key).attr("src", "{{ static_url('alarm_inactive.svg') }}");
-                        }*/
 		    } else if (data_type == "integer-to-string") {
                         //console.log("integer-to-string");
                         var dict_attr = JSON.parse($("#" + key).attr('data-dict'));
@@ -728,25 +707,6 @@ function myTimer() {
                                         $("img", "#" + key).attr("src", "/static/" + $("#" + key).attr('data-icon') + "_red.svg");
                                     }
                                 }
-                            /*
-                            } else if (data_type == "commbit") {
-                        var on_attr = $("#" + key).attr('data-on');
-                        var off_attr = $("#" + key).attr('data-off');
-                                    if (parseFloat(response[ref]) == parseFloat(on_attr)) {
-                                        $("img", "#" + key).attr("src", "{{ static_url('commbit_green.svg') }}");
-                                }
-                                    if (parseFloat(response[ref]) == parseFloat(off_attr)) {
-                                        $("img", "#" + key).attr("src", "{{ static_url('commbit_red.svg') }}");
-                                }
-                            } else if (data_type == "alarm") {
-                        var on_attr = $("#" + key).attr('data-on');
-                        var off_attr = $("#" + key).attr('data-off');
-                                    if (parseFloat(response[ref]) == parseFloat(on_attr)) {
-                                        $("img", "#" + key).attr("src", "{{ static_url('alarm_active.svg') }}");
-                                }
-                                    if (parseFloat(response[ref]) == parseFloat(off_attr)) {
-                                        $("img", "#" + key).attr("src", "{{ static_url('alarm_inactive.svg') }}");
-                                }*/
 		            } else if (data_type == "integer-to-string") {
                         var dict_attr = JSON.parse($("#" + key).attr('data-dict'));
                         var dict_cond;