|
141 | 141 | {% end %}
|
142 | 142 |
|
143 | 143 | {% if data['style'][key]['type'] == "icon" %}
|
144 |
| -<div id='{{ key }}' class='varbox' data-type="{{ data['style'][key]['type'] }}" data-onCondition="{{ data['style'][key]['div']['data-onCondition'] }}" data-link-adei="{{ data['style'][key]['div']['data-link-adei'] }}" data-trend="{{ data['style'][key]['div']['data-trend'] }}" |
145 |
| - style='position: absolute; top:{{ data['style'][key]['top'] }}; left:{{ data['style'][key]['left'] }}; |
146 |
| - icon-type:{{ data['style'][key]['icon-type'] }}; rotate:{{ data['style'][key]['div']['rotate'] }};'> |
147 |
| - <img width='{{ data['style'][key]['width'] }}' height='{{ data['style'][key]['height'] }}' src="{{ static_url( data['style'][key]['icon-type'] + '_inactive.png' ) }}"></img> |
| 144 | +<div id='{{ key }}' class='varbox' data-type="{{ data['style'][key]['type'] }}" data-icon-type="{{ data['style'][key]['div']['data-icon-type'] }}" data-onCondition="{{ data['style'][key]['div']['data-onCondition'] }}" data-link-adei="{{ data['style'][key]['div']['data-link-adei'] }}" data-trend="{{ data['style'][key]['div']['data-trend'] }}" |
| 145 | + style='position: absolute; top:{{ data['style'][key]['top'] }}; left:{{ data['style'][key]['left'] }}; rotate:{{ data['style'][key]['div']['rotate'] }};'> |
| 146 | + <img width='{{ data['style'][key]['width'] }}' height='{{ data['style'][key]['height'] }}' src="{{ static_url( data['style'][key]['div']['data-icon-type'] + '_inactive.png' ) }}"></img> |
148 | 147 | </div>
|
149 | 148 | {% else %}
|
150 | 149 | {% end %}
|
|
1290 | 1289 |
|
1291 | 1290 | if (item_array[item_array.length -1] == "nodata") {
|
1292 | 1291 |
|
1293 |
| - if (["name", "text_name", "unit_name", "int_to_str", "icon_type"].indexOf(item_array[2]) === -1) { |
| 1292 | + if (["name", "text_name", "unit_name", "int_to_str"].indexOf(item_array[2]) === -1) { |
1294 | 1293 | css_property = item_array[2].replace(/_/g, '-');
|
1295 | 1294 | div_style += css_property + ":" + params[item] + "; ";
|
1296 | 1295 | }
|
|
1347 | 1346 | break;
|
1348 | 1347 | case "icon":
|
1349 | 1348 | // TODO: NTJ -> Bug
|
1350 |
| - var icon_src = window.location.origin + "/static/" + params["icon-div-icon_type-must-nodata"] + "_inactive.png"; |
| 1349 | + var icon_src = window.location.origin + "/static/" + params["icon-div-icon_type-must-data"] + "_inactive.png"; |
1351 | 1350 | //var icon_src = "/static/" + params["icon-div-icon_type-must-nodata"] + "_inactive.png";
|
1352 | 1351 | html_element += "<img src='" + icon_src + "' width='100%' height='100%'></img>";
|
1353 | 1352 | break;
|
|
1389 | 1388 | var div_text = "";
|
1390 | 1389 | var div_data = "";
|
1391 | 1390 | var div_style = " style='position: absolute; top:200px; left:200px; ";
|
1392 |
| - |
| 1391 | + |
1393 | 1392 | for (item in params) {
|
1394 | 1393 | if (item.startsWith(prefix)) {
|
1395 | 1394 | if (!verifyRequiredFields(item, prefix)) { return; }
|
|
1732 | 1731 | };
|
1733 | 1732 | }
|
1734 | 1733 |
|
1735 |
| -// Helper Function: gets the css style properties of an element |
1736 |
| -function collectCssStyles(element_id, category) { |
| 1734 | +// Helper Function: gets the div attributes properties of an element |
| 1735 | +function collectDivAttributes(element_id, category) { |
1737 | 1736 | let mydiv = {};
|
1738 | 1737 | mycat = category.replace(/-/g, '_');
|
1739 | 1738 |
|
|
1742 | 1741 | var item_array = item.split("-");
|
1743 | 1742 | var css_property = item_array[2].replace(/_/g, '-');
|
1744 | 1743 |
|
1745 |
| - if (item_array[1] == "div" && item_array[2] !== "icon_type") { |
| 1744 | + if (item_array[1] == "div") { |
1746 | 1745 | switch (item_array[2]) {
|
1747 | 1746 | case "text_name":
|
1748 | 1747 | mydiv[css_property] = $("#" + element_id + "> .text_name").text().trim();
|
|
1795 | 1794 | $('*[data-type="' + mycategory + '"]').each(function() {
|
1796 | 1795 | var element_id = $(this).attr('id');
|
1797 | 1796 | var attributes = extractElementAttributes(element_id);
|
1798 |
| - var styles = collectCssStyles(element_id, mycategory); |
1799 |
| - |
1800 |
| - if (attributes["type"] == "icon") { |
1801 |
| - // TODO: NTJ: This is a hard code, need to be fixed!!! |
1802 |
| - attributes["icon-type"] = "valve"; // hard code |
1803 |
| - } |
| 1797 | + var styles = collectDivAttributes(element_id, mycategory); |
1804 | 1798 |
|
1805 | 1799 | attributes["widget"] = mycategory;
|
1806 | 1800 | attributes["div"] = styles;
|
|
0 commit comments