Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/kit-ipe/bora
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolaisi committed Aug 24, 2016
2 parents 50d1df9 + 09ae2bd commit 2383a92
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 45 deletions.
13 changes: 6 additions & 7 deletions designer.html
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -815,6 +815,8 @@
}

function highlight(mydata) {
console.log("highlight");

varname = $("#varname option:selected").text();
vartype = $("#"+varname).attr("data-type");
$("#vartype").val(vartype);
Expand Down Expand Up @@ -947,24 +949,21 @@
}
}


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() {
Expand Down
79 changes: 41 additions & 38 deletions status.html
Original file line number Diff line number Diff line change
Expand Up @@ -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 %}
Expand Down Expand Up @@ -73,11 +73,11 @@

{% 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 %}

Expand Down Expand Up @@ -151,59 +151,62 @@
//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")) {
Expand All @@ -220,8 +223,8 @@
}
$(".varval", "#" + key).css("color", dict_color);
$(".varval", "#" + key).text(dict_attr[response[key]]);
}
}
}
}
}
$('[id^=virtual_]').each(function( index ) {
var key = this.id;
Expand Down

0 comments on commit 2383a92

Please sign in to comment.