status.html 37 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>{{ data['title'] }} Status display</title>
  6. <meta name="description"
  7. content="Status display generated by BORA.">
  8. <link rel="stylesheet" href="{{ static_url("style.css") }}">
  9. <link rel="stylesheet" href="{{ static_url("jquery-ui.min.css") }}">
  10. <!--[if IE]>
  11. <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
  12. <![endif]-->
  13. </head>
  14. <body>
  15. <div id="page_info">{{ data['title'] }} data monitoring. Last refreshed</div>
  16. <div id="page_title_cache" style="display:none;">{{ data['title'] }}</div>
  17. {% if data['style'] %}
  18. {% for key in data['style'] %}
  19. {% if data['style'][key]['type'] == "calc" %}
  20. <div style='position: absolute; top: {{ data['style'][key]['top'] }}; left:{{
  21. data['style'][key]['left'] }}; width:{{ data['style'][key]['width'] }}px;
  22. height:{{ data['style'][key]['height'] }}px; transform: {{ data['style'][key]['rotate'] }};
  23. {% if "background_color" in data['style'][key] %}
  24. background-color="{{ data['style'][key]['background_color'] }}"
  25. {% else%}
  26. {% end %}
  27. {% if "condition" in data['style'][key] %}
  28. data-cond="{{ data['style'][key]['condition'] }}"
  29. {% else%}position
  30. {% end%}
  31. {% if "formula" in data['style'][key] %}
  32. data-formula="{{ data['style'][key]['formula'] }}" tooltip="{{ data['style'][key]['formula'] }}"
  33. {% else %}
  34. {% end %}
  35. {% if "lesser" in data['style'][key] %}
  36. data-lesser="{{ data['style'][key]['lesser'] }}"
  37. {% else %}
  38. {% end %}
  39. {% if "larger" in data['style'][key] %}
  40. data-larger="{{ data['style'][key]['larger'] }}"
  41. {% else %}
  42. {% end %}
  43. data-type="{{ data['style'][key]['type'] }}" class='databox' id="{{ key }}">
  44. <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>
  45. </div>
  46. {% else %}
  47. {% end %}
  48. {% if data['style'][key]['type'] == "data" %}
  49. {% if "ref" in data['style'][key] %}
  50. <div tooltip="{{ data['style'][key]['ref'] }}"
  51. {% else %}
  52. <div tooltip="{{ key }}"
  53. {% end %}
  54. class="databox" 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; transform: {{ data['style'][key]['rotate'] }};
  55. {% if "background_color" in data['style'][key] %}
  56. background-color:{{ data['style'][key]['background_color'] }};'
  57. {% else%}
  58. {% end%}
  59. {% if "condition" in data['style'][key] %}
  60. data-cond="{{ data['style'][key]['condition'] }}"
  61. {% else%}
  62. {% end%}
  63. {% if "formula" in data['style'][key] %}
  64. data-formula="{{ data['style'][key]['formula'] }}"
  65. {% else %}
  66. {% end %}
  67. {% if "lesser" in data['style'][key] %}
  68. data-lesser="{{ data['style'][key]['lesser'] }}"
  69. {% else %}
  70. {% end %}
  71. {% if "larger" in data['style'][key] %}
  72. data-larger="{{ data['style'][key]['larger'] }}"
  73. {% else %}
  74. {% end %}
  75. {% if "exponential" in data['style'][key] %}
  76. data-exponential="{{ data['style'][key]['exponential'] }}"
  77. {% else %}
  78. {% end %}
  79. {% if "trend" in data['style'][key] %}
  80. data-trend="{{ data['style'][key]['trend'] }}"
  81. {% else %}
  82. {% end %}
  83. {% if "linkhtml" in data['style'][key] %}
  84. {% if data['style'][key]['linkhtml'] == 'true' %}
  85. {% if "server" in data %}
  86. onclick="window.open( '{{ data["server"] }}#module=graph&{{ data['varname'][data['style'][key]['ref']] }}&experiment=-&window=86400&module=graph&virtual=srctree&srctree=&infomod=legend', '_blank');"
  87. {% else %}
  88. {% end %}
  89. {% else %}
  90. {% end %}
  91. {% else %}
  92. {% end %}
  93. {% if "ref" in data['style'][key] %}
  94. data-type="{{ data['style'][key]['type'] }}" id="{{ key }}">
  95. <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>
  96. {% if "trend" in data['style'][key] %}
  97. {% if data['style'][key]['trend'] == 'true' %}
  98. </p>
  99. {% else %}
  100. {% end %}
  101. {% else %}
  102. {% end %}
  103. </div>
  104. {% else %}
  105. data-type="{{ data['style'][key]['type'] }}" id="{{ key }}">
  106. <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>
  107. {% if "trend" in data['style'][key] %}
  108. {% if data['style'][key]['trend'] == 'true' %}
  109. </p>
  110. {% else %}
  111. {% end %}
  112. {% else %}
  113. {% end %}
  114. </div>
  115. {% end %}
  116. {% else %}
  117. {% end %}
  118. {% if data['style'][key]['type'] == "icon" %}
  119. {% if data['style'][key]['icon'] == "valve" %}
  120. {% if "ref" in data['style'][key] %}
  121. <div tooltip="{{ data['style'][key]['ref'] }}"
  122. {% else %}
  123. <div tooltip="{{ key }}"
  124. {% end %}
  125. 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; transform: {{ data['style'][key]['rotate'] }};'
  126. {% if "trend" in data['style'][key] %}
  127. data-trend="{{ data['style'][key]['trend'] }}"
  128. {% else %}
  129. {% end %}
  130. {% if data['style'][key]['linkhtml'] == 'true' %}
  131. {% if "server" in data %}
  132. onclick="window.open( '{{ data["server"] }}#module=graph&{{ data['varname'][data['style'][key]['ref']] }}&experiment=-&window=86400&module=graph&virtual=srctree&srctree=&infomod=legend', '_blank');"
  133. {% else %}
  134. {% end %}
  135. {% else %}
  136. {% end %}
  137. {% if "ref" in data['style'][key] %}
  138. data-type="{{ data['style'][key]['type'] }}" data-icon="{{ data['style'][key]['icon'] }}" data-off="{{ data['style'][key]['off'] }}" data-offexpression="{{ data['style'][key]['off_condition'] }}" data-on="{{ data['style'][key]['on'] }}" data-onexpression="{{ data['style'][key]['on_condition'] }}" class='databox' id="{{ key }}">
  139. {% if "trend" in data['style'][key] %}
  140. {% if data['style'][key]['trend'] == 'true' %}
  141. {% else %}
  142. {% end %}
  143. {% else %}
  144. {% end %}
  145. <div class="icon">
  146. <img width="{{ data['style'][key]['width'] }}px" height="{{ data['style'][key]['height'] }}px" src='{{ static_url("valve_inactive.png") }}'></img>
  147. </div>
  148. </div>
  149. {% else %}
  150. data-type="{{ data['style'][key]['type'] }}" data-icon="{{ data['style'][key]['icon'] }}" data-off="{{ data['style'][key]['off'] }}" data-offexpression="{{ data['style'][key]['off_condition'] }}" data-on="{{ data['style'][key]['on'] }}" data-onexpression="{{ data['style'][key]['on_condition'] }}" class='databox' id="{{ key }}">
  151. {% if data['style'][key]['trend'] == 'true' %}
  152. {% else %}
  153. {% end %}
  154. <div class="icon">
  155. <img width="{{ data['style'][key]['width'] }}px" height="{{ data['style'][key]['height'] }}px" src='{{ static_url("valve_inactive.png") }}'></img>
  156. </div>
  157. </div>
  158. {% end %}
  159. {% else %}
  160. {% end %}
  161. {% if data['style'][key]['icon'] == "commbit" %}
  162. {% if "ref" in data['style'][key] %}
  163. <div tooltip="{{ data['style'][key]['ref'] }}"
  164. {% else %}
  165. <div tooltip="{{ key }}"
  166. {% end %}
  167. 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; transform: {{ data['style'][key]['rotate'] }};'
  168. {% if "trend" in data['style'][key] %}
  169. data-trend="{{ data['style'][key]['trend'] }}"
  170. {% else %}
  171. {% end %}
  172. {% if data['style'][key]['linkhtml'] == 'true' %}
  173. {% if "server" in data %}
  174. onclick="window.open( '{{ data["server"] }}#module=graph&{{ data['varname'][data['style'][key]['ref']] }}&experiment=-&window=86400&module=graph&virtual=srctree&srctree=&infomod=legend', '_blank');"
  175. {% else %}
  176. {% end %}
  177. {% else %}
  178. {% end %}
  179. {% if "ref" in data['style'][key] %}
  180. data-type="{{ data['style'][key]['type'] }}" data-icon="{{ data['style'][key]['icon'] }}" data-off="{{ data['style'][key]['off'] }}" data-offexpression="{{ data['style'][key]['off_condition'] }}" data-on="{{ data['style'][key]['on'] }}" data-onexpression="{{ data['style'][key]['on_condition'] }}" class='databox' id="{{ key }}">
  181. {% if data['style'][key]['trend'] == 'true' %}
  182. {% else %}
  183. {% end %}
  184. <div class="icon">
  185. <img width="{{ data['style'][key]['width'] }}px" height="{{ data['style'][key]['height'] }}px" src='{{ static_url("commbit_inactive.svg") }}'></img>
  186. </div>
  187. </div>
  188. {% else %}
  189. data-type="{{ data['style'][key]['type'] }}" data-icon="{{ data['style'][key]['icon'] }}" data-off="{{ data['style'][key]['off'] }}" data-offexpression="{{ data['style'][key]['off_condition'] }}" data-on="{{ data['style'][key]['on'] }}" data-onexpression="{{ data['style'][key]['on_condition'] }}" class='databox' id="{{ key }}">
  190. {% if data['style'][key]['trend'] == 'true' %}
  191. {% else %}
  192. {% end %}
  193. <div class="icon">
  194. <img width="{{ data['style'][key]['width'] }}px" height="{{ data['style'][key]['height'] }}px" src='{{ static_url("commbit_inactive.svg") }}'></img>
  195. </div>
  196. </div>
  197. {% end %}
  198. {% else %}
  199. {% end %}
  200. {% if data['style'][key]['icon'] == "alarm" %}
  201. {% if "ref" in data['style'][key] %}
  202. <div tooltip="{{ data['style'][key]['ref'] }}"
  203. {% else %}
  204. <div tooltip="{{ key }}"
  205. {% end %}
  206. 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; transform: {{ data['style'][key]['rotate'] }};'
  207. {% if "trend" in data['style'][key] %}
  208. data-trend="{{ data['style'][key]['trend'] }}"
  209. {% else %}
  210. {% end %}
  211. {% if data['style'][key]['linkhtml'] == 'true' %}
  212. {% if "server" in data %}
  213. onclick="window.open( '{{ data["server"] }}#module=graph&{{ data['varname'][data['style'][key]['ref']] }}&experiment=-&window=86400&module=graph&virtual=srctree&srctree=&infomod=legend', '_blank');"
  214. {% else %}
  215. {% end %}
  216. {% else %}
  217. {% end %}
  218. {% if "ref" in data['style'][key] %}
  219. data-type="{{ data['style'][key]['type'] }}" data-icon="{{ data['style'][key]['icon'] }}" data-off="{{ data['style'][key]['off'] }}" data-offexpression="{{ data['style'][key]['off_condition'] }}" data-on="{{ data['style'][key]['on'] }}" data-onexpression="{{ data['style'][key]['on_condition'] }}" class='databox' id="{{ key }}">
  220. {% if data['style'][key]['trend'] == 'true' %}
  221. {% else %}
  222. {% end %}
  223. <div class="icon">
  224. <img width="{{ data['style'][key]['width'] }}px" height="{{ data['style'][key]['height'] }}px" src='{{ static_url("alarm_inactive.svg") }}'></img>
  225. </div>
  226. </div>
  227. {% else %}
  228. data-type="{{ data['style'][key]['type'] }}" data-icon="{{ data['style'][key]['icon'] }}" data-off="{{ data['style'][key]['off'] }}" data-offexpression="{{ data['style'][key]['off_condition'] }}" data-on="{{ data['style'][key]['on'] }}" data-onexpression="{{ data['style'][key]['on_condition'] }}" class='databox' id="{{ key }}">
  229. {% if data['style'][key]['trend'] == 'true' %}
  230. {% else %}
  231. {% end %}
  232. <div class="icon">
  233. <img width="{{ data['style'][key]['width'] }}px" height="{{ data['style'][key]['height'] }}px" src='{{ static_url("alarm_inactive.svg") }}'></img>
  234. </div>
  235. </div>
  236. {% end %}
  237. {% else %}
  238. {% end %}
  239. {% if data['style'][key]['icon'] == "TMP" %}
  240. {% if "ref" in data['style'][key] %}
  241. <div tooltip="{{ data['style'][key]['ref'] }}"
  242. {% else %}
  243. <div tooltip="{{ key }}"
  244. {% end %}
  245. 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; transform: {{ data['style'][key]['rotate'] }};'
  246. {% if "trend" in data['style'][key] %}
  247. data-trend="{{ data['style'][key]['trend'] }}"
  248. {% else %}
  249. {% end %}
  250. {% if data['style'][key]['linkhtml'] == 'true' %}
  251. {% if "server" in data %}
  252. onclick="window.open( '{{ data["server"] }}#module=graph&{{ data['varname'][data['style'][key]['ref']] }}&experiment=-&window=86400&module=graph&virtual=srctree&srctree=&infomod=legend', '_blank');"
  253. {% else %}
  254. {% end %}
  255. {% else %}
  256. {% end %}
  257. {% if "ref" in data['style'][key] %}
  258. data-type="{{ data['style'][key]['type'] }}" data-icon="{{ data['style'][key]['icon'] }}" data-off="{{ data['style'][key]['off'] }}" data-offexpression="{{ data['style'][key]['off_condition'] }}" data-on="{{ data['style'][key]['on'] }}" data-onexpression="{{ data['style'][key]['on_condition'] }}" class='databox' id="{{ key }}">
  259. {% if data['style'][key]['trend'] == 'true' %}
  260. {% else %}
  261. {% end %}
  262. <div class="icon">
  263. <img width="{{ data['style'][key]['width'] }}px" height="{{ data['style'][key]['height'] }}px" src='{{ static_url("TMP_inactive.svg") }}'></img>
  264. </div>
  265. </div>
  266. {% else %}
  267. data-type="{{ data['style'][key]['type'] }}" data-icon="{{ data['style'][key]['icon'] }}" data-off="{{ data['style'][key]['off'] }}" data-offexpression="{{ data['style'][key]['off_condition'] }}" data-on="{{ data['style'][key]['on'] }}" data-onexpression="{{ data['style'][key]['on_condition'] }}" class='databox' id="{{ key }}">
  268. {% if data['style'][key]['trend'] == 'true' %}
  269. {% else %}
  270. {% end %}
  271. <div class="icon">
  272. <img width="{{ data['style'][key]['width'] }}px" height="{{ data['style'][key]['height'] }}px" src='{{ static_url("TMP_inactive.svg") }}'></img>
  273. </div>
  274. </div>
  275. {% end %}
  276. {% else %}
  277. {% end %}
  278. {% if data['style'][key]['icon'] == "relay" %}
  279. {% if "ref" in data['style'][key] %}
  280. <div tooltip="{{ data['style'][key]['ref'] }}"
  281. {% else %}
  282. <div tooltip="{{ key }}"
  283. {% end %}
  284. 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; transform: {{ data['style'][key]['rotate'] }};'
  285. {% if "trend" in data['style'][key] %}
  286. data-trend="{{ data['style'][key]['trend'] }}"
  287. {% else %}
  288. {% end %}
  289. {% if data['style'][key]['linkhtml'] == 'true' %}
  290. {% if "server" in data %}
  291. onclick="window.open( '{{ data["server"] }}#module=graph&{{ data['varname'][data['style'][key]['ref']] }}&experiment=-&window=86400&module=graph&virtual=srctree&srctree=&infomod=legend', '_blank');"
  292. {% else %}
  293. {% end %}
  294. {% else %}
  295. {% end %}
  296. {% if "ref" in data['style'][key] %}
  297. data-type="{{ data['style'][key]['type'] }}" data-icon="{{ data['style'][key]['icon'] }}" data-off="{{ data['style'][key]['off'] }}" data-offexpression="{{ data['style'][key]['off_condition'] }}" data-on="{{ data['style'][key]['on'] }}" data-onexpression="{{ data['style'][key]['on_condition'] }}" class='databox' id="{{ key }}">
  298. {% if data['style'][key]['trend'] == 'true' %}
  299. {% else %}
  300. {% end %}
  301. <div class="icon">
  302. <img width="{{ data['style'][key]['width'] }}px" height="{{ data['style'][key]['height'] }}px" src='{{ static_url("relay_inactive.svg") }}'></img>
  303. </div>
  304. </div>
  305. {% else %}
  306. data-type="{{ data['style'][key]['type'] }}" data-icon="{{ data['style'][key]['icon'] }}" data-off="{{ data['style'][key]['off'] }}" data-offexpression="{{ data['style'][key]['off_condition'] }}" data-on="{{ data['style'][key]['on'] }}" data-onexpression="{{ data['style'][key]['on_condition'] }}" class='databox' id="{{ key }}">
  307. {% if data['style'][key]['trend'] == 'true' %}
  308. {% else %}
  309. {% end %}
  310. <div class="icon">
  311. <img width="{{ data['style'][key]['width'] }}px" height="{{ data['style'][key]['height'] }}px" src='{{ static_url("relay_inactive.svg") }}'></img>
  312. </div>
  313. </div>
  314. {% end %}
  315. {% else %}
  316. {% end %}
  317. {% if data['style'][key]['icon'] == "switch" %}
  318. {% if "ref" in data['style'][key] %}
  319. <div tooltip="{{ data['style'][key]['ref'] }}"
  320. {% else %}
  321. <div tooltip="{{ key }}"
  322. {% end %}
  323. 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; transform: {{ data['style'][key]['rotate'] }};'
  324. {% if "trend" in data['style'][key] %}
  325. data-trend="{{ data['style'][key]['trend'] }}"
  326. {% else %}
  327. {% end %}
  328. {% if data['style'][key]['linkhtml'] == 'true' %}
  329. {% if "server" in data %}
  330. onclick="window.open( '{{ data["server"] }}#module=graph&{{ data['varname'][data['style'][key]['ref']] }}&experiment=-&window=86400&module=graph&virtual=srctree&srctree=&infomod=legend', '_blank');"
  331. {% else %}
  332. {% end %}
  333. {% else %}
  334. {% end %}
  335. {% if "ref" in data['style'][key] %}
  336. data-type="{{ data['style'][key]['type'] }}" data-icon="{{ data['style'][key]['icon'] }}" data-off="{{ data['style'][key]['off'] }}" data-offexpression="{{ data['style'][key]['off_condition'] }}" data-on="{{ data['style'][key]['on'] }}" data-onexpression="{{ data['style'][key]['on_condition'] }}" class='databox' id="{{ key }}">
  337. {% if data['style'][key]['trend'] == 'true' %}
  338. {% else %}
  339. {% end %}
  340. <div class="icon">
  341. <img width="{{ data['style'][key]['width'] }}px" height="{{ data['style'][key]['height'] }}px" src='{{ static_url("switch_inactive.svg") }}'></img>
  342. </div>
  343. </div>
  344. {% else %}
  345. data-type="{{ data['style'][key]['type'] }}" data-icon="{{ data['style'][key]['icon'] }}" data-off="{{ data['style'][key]['off'] }}" data-offexpression="{{ data['style'][key]['off_condition'] }}" data-on="{{ data['style'][key]['on'] }}" data-onexpression="{{ data['style'][key]['on_condition'] }}" class='databox' id="{{ key }}">
  346. {% if data['style'][key]['trend'] == 'true' %}
  347. {% else %}
  348. {% end %}
  349. <div class="icon">
  350. <img width="{{ data['style'][key]['width'] }}px" height="{{ data['style'][key]['height'] }}px" src='{{ static_url("switch_inactive.svg") }}'></img>
  351. </div>
  352. </div>
  353. {% end %}
  354. {% else %}
  355. {% end %}
  356. {% if data['style'][key]['icon'] == "bottle" %}
  357. {% if "ref" in data['style'][key] %}
  358. <div tooltip="{{ data['style'][key]['ref'] }}"
  359. {% else %}
  360. <div tooltip="{{ key }}"
  361. {% end %}
  362. 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; transform: {{ data['style'][key]['rotate'] }};'
  363. {% if "trend" in data['style'][key] %}
  364. data-trend="{{ data['style'][key]['trend'] }}"
  365. {% else %}
  366. {% end %}
  367. {% if data['style'][key]['linkhtml'] == 'true' %}
  368. {% if "server" in data %}
  369. onclick="window.open( '{{ data["server"] }}#module=graph&{{ data['varname'][data['style'][key]['ref']] }}&experiment=-&window=86400&module=graph&virtual=srctree&srctree=&infomod=legend', '_blank');"
  370. {% else %}
  371. {% end %}
  372. {% else %}
  373. {% end %}
  374. {% if "ref" in data['style'][key] %}
  375. data-type="{{ data['style'][key]['type'] }}" data-icon="{{ data['style'][key]['icon'] }}" data-off="{{ data['style'][key]['off'] }}" data-offexpression="{{ data['style'][key]['off_condition'] }}" data-on="{{ data['style'][key]['on'] }}" data-onexpression="{{ data['style'][key]['on_condition'] }}" class='databox' id="{{ key }}">
  376. {% if data['style'][key]['trend'] == 'true' %}
  377. {% else %}
  378. {% end %}
  379. <div class="icon">
  380. <img width="{{ data['style'][key]['width'] }}px" height="{{ data['style'][key]['height'] }}px" src='{{ static_url("bottle_inactive.svg") }}'></img>
  381. </div>
  382. </div>
  383. {% else %}
  384. data-type="{{ data['style'][key]['type'] }}" data-icon="{{ data['style'][key]['icon'] }}" data-off="{{ data['style'][key]['off'] }}" data-offexpression="{{ data['style'][key]['off_condition'] }}" data-on="{{ data['style'][key]['on'] }}" data-onexpression="{{ data['style'][key]['on_condition'] }}" class='databox' id="{{ key }}">
  385. {% if data['style'][key]['trend'] == 'true' %}
  386. {% else %}
  387. {% end %}
  388. <div class="icon">
  389. <img width="{{ data['style'][key]['width'] }}px" height="{{ data['style'][key]['height'] }}px" src='{{ static_url("bottle_inactive.svg") }}'></img>
  390. </div>
  391. </div>
  392. {% end %}
  393. {% else %}
  394. {% end %}
  395. {% else %}
  396. {% end %}
  397. {% if data['style'][key]['type'] == "integer-to-string" %}
  398. <div tooltip="{{ key }}" style='position: absolute; top: {{
  399. data['style'][key]['top'] }}; left:{{ data['style'][key]['left'] }};
  400. width:{{ data['style'][key]['width'] }}px; height:{{
  401. data['style'][key]['height'] }}px; transform: {{ data['style'][key]['rotate'] }};
  402. {% if "background_color" in data['style'][key] %}
  403. background-color:{{ data['style'][key]['background_color'] }};'
  404. {% else%}
  405. '
  406. {% end%}
  407. {% if "cond" in data['style'][key] %}
  408. data-cond="{{ data['style'][key]['cond'] }}"
  409. {% else %}
  410. {% end %}
  411. {% if "trend" in data['style'][key] %}
  412. data-trend="{{ data['style'][key]['trend'] }}"
  413. {% else %}
  414. {% end %}
  415. {% if "linkhtml" in data['style'][key] %}
  416. {% if data['style'][key]['linkhtml'] == 'true' %}
  417. {% if "server" in data %}
  418. onclick="window.open( '{{ data["server"] }}#module=graph&{{ data['varname'][data['style'][key]['ref']] }}&experiment=-&window=86400&module=graph&virtual=srctree&srctree=&infomod=legend', '_blank');"
  419. {% else %}
  420. {% end %}
  421. {% else %}
  422. {% end %}
  423. {% else %}
  424. {% end %}
  425. data-dict="{{ data['style'][key]['dict'] }}" data-type="{{ data['style'][key]['type'] }}" class='databox' id="{{ key }}">
  426. <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><br /><span style="color: #000; font-size: {{ data['style'][key]['unit']['size'] }}px; font-weight: {{ data['style'][key]['unit']['weight'] }};" class="varval">--- </span>
  427. {% if "trend" in data['style'][key] %}
  428. {% if data['style'][key]['trend'] == 'true' %}
  429. {% else %}
  430. {% end %}
  431. {% else %}
  432. {% end %}
  433. </p>
  434. </div>
  435. {% else %}
  436. {% end %}
  437. {% if data['style'][key]['type'] == "header" %}
  438. <div style='position: absolute; top: {{ data['style'][key]['top'] }}; left:{{
  439. data['style'][key]['left'] }}; width:{{ data['style'][key]['width'] }}px;
  440. height:{{ data['style'][key]['height'] }}px; transform: {{ data['style'][key]['rotate'] }};
  441. {% if "background_color" in data['style'][key] %}
  442. background-color:{{ data['style'][key]['background_color'] }};'
  443. {% else %}
  444. {% end %}
  445. data-type="{{
  446. data['style'][key]['type'] }}" class='databox' id="{{ key }}">
  447. <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></p>
  448. </div>
  449. {% else %}
  450. {% end %}
  451. {% end %}
  452. {% else %}
  453. {% end %}
  454. {% if "background" in data %}
  455. <img src="{{ static_url( data['background'] ) }}"></img>
  456. {% else %}
  457. <img src="{{ static_url( 'background.png' ) }}"></img>
  458. {% end %}
  459. <!-- java script -->
  460. <script src="{{ static_url("jquery-1.12.3.min.js") }}"></script>
  461. <script src="{{ static_url("jquery-ui.min.js") }}"></script>
  462. <script src="{{ static_url("math.min.js") }}"></script>
  463. <script>
  464. jQuery(window).load(function () {
  465. $(".databox").hover(function(){
  466. var key = $(this).attr('id');
  467. if ($("#" + key).attr('data-trend') == "true") {
  468. $('#'+ key).append('<span class="popup"><img src="/static/'+ $("#page_title_cache").text().toLowerCase() +'/images/'+key+'.png" width="600px" height="400px"/></span>');
  469. }
  470. });
  471. myTimer();
  472. var myVar = setInterval(myTimer, 10000);
  473. function myTimer() {
  474. var dataToSend = {};
  475. $.ajax({
  476. url: '/'+$("#page_title_cache").text().toLowerCase()+'/getdata/',
  477. //url: '/wgts/getabcddata/',
  478. type: 'GET',
  479. data: dataToSend,
  480. success: function (response) {
  481. //var objresponse = JSON.parse(response);
  482. console.log(response);
  483. for (var key in response) {
  484. //console.log(key, response[key]);
  485. data_type = $("#" + key).attr('data-type');
  486. if($("#" + key).length > 0) {
  487. if (data_type == "data") {
  488. //console.log("data");
  489. var datavalue, set_color, formula;
  490. var formula_attr = $("#" + key).attr('data-formula');
  491. if (response[key]) {
  492. if (formula_attr) {
  493. datavalue = parseFloat(response[key]).toFixed(2);
  494. formula = formula_attr.replace("x", datavalue.toString());
  495. datavalue = math.round(math.eval(formula),2);
  496. datavalue = datavalue.toFixed(2);
  497. } else {
  498. if ( ($("#" + key).attr('data-exponential')) == "True" || ($("#" + key).attr('data-exponential')) == "true" ) {
  499. datavalue = parseFloat(response[key]);
  500. datavalue = datavalue.toExponential(2)
  501. } else {
  502. datavalue = parseFloat(response[key]).toFixed(2);
  503. }
  504. }
  505. set_color = "green";
  506. } else {
  507. datavalue = "---";
  508. set_color = "black";
  509. }
  510. $(".varval", "#" + key).text(datavalue);
  511. var condition_attr = $("#" + key).attr('data-cond');
  512. var lesser_attr = $("#" + key).attr('data-lesser');
  513. var larger_attr = $("#" + key).attr('data-larger');
  514. //console.log(condition_attr);
  515. if (condition_attr) {
  516. if (response[key] == condition_attr) {
  517. set_color = "red";
  518. }
  519. }
  520. if (lesser_attr) {
  521. if (parseFloat(response[key]) < parseFloat(lesser_attr)) {
  522. set_color = "red";
  523. }
  524. }
  525. if (larger_attr) {
  526. if (parseFloat(response[key]) > parseFloat(larger_attr)) {
  527. set_color = "red";
  528. }
  529. }
  530. $(".varval", "#" + key).css("color", set_color);
  531. $(".unit_title", "#" + key).css("color", set_color);
  532. } else if (data_type == "icon") {
  533. //console.log("ventil");
  534. var on_attr = $("#" + key).attr('data-on');
  535. var off_attr = $("#" + key).attr('data-off');
  536. var on_condition = $("#" + key).attr('data-onexpression');
  537. var off_condition = $("#" + key).attr('data-offexpression');
  538. if (on_condition == 'onequal'){
  539. if (parseFloat(response[key]) == parseFloat(on_attr)) {
  540. $("img", "#" + key).attr("src", "/static/" + $("#" + key).attr('data-icon') + "_green.svg");
  541. }
  542. } else if (on_condition == 'onsmaller'){
  543. if (parseFloat(response[key]) < parseFloat(on_attr)) {
  544. $(".icon img", "#" + key).attr("src", "/static/" + $("#" + key).attr('data-icon') + "_green.svg");
  545. }
  546. } else if (on_condition == 'ongreater'){
  547. if (parseFloat(response[key]) > parseFloat(on_attr)) {
  548. $(".icon img", "#" + key).attr("src", "/static/" + $("#" + key).attr('data-icon') + "_green.svg");
  549. }
  550. }
  551. if (off_condition == 'offequal'){
  552. if (parseFloat(response[key]) == parseFloat(off_attr)) {
  553. $(".icon img", "#" + key).attr("src", "/static/" + $("#" + key).attr('data-icon') + "_red.svg");
  554. }
  555. } else if (off_condition == 'offsmaller'){
  556. if (parseFloat(response[key]) < parseFloat(off_attr)) {
  557. $(".icon img", "#" + key).attr("src", "/static/" + $("#" + key).attr('data-icon') + "_red.svg");
  558. }
  559. } else if (off_condition == 'offgreater'){
  560. if (parseFloat(response[key]) > parseFloat(off_attr)) {
  561. $(".icon img", "#" + key).attr("src", "/static/" + $("#" + key).attr('data-icon') + "_red.svg");
  562. }
  563. }
  564. } else if (data_type == "integer-to-string") {
  565. //console.log("integer-to-string");
  566. var dict_attr = JSON.parse($("#" + key).attr('data-dict'));
  567. var dict_cond;
  568. if ($("#"+key).attr("data-cond")) {
  569. dict_cond = JSON.parse($("#" + key).attr('data-cond'));
  570. } else {
  571. dict_cond = {};
  572. }
  573. var dict_color = "";
  574. if (key in response) {
  575. var token = response[key];
  576. if (token in dict_cond) {
  577. dict_color = dict_cond[token];
  578. }
  579. }
  580. $(".varval", "#" + key).css("color", dict_color);
  581. $(".varval", "#" + key).text(dict_attr[response[key]]);
  582. }
  583. }
  584. }
  585. $('[id^=virtual_]').each(function( index ) {
  586. var key = this.id;
  587. var ref = key.split("_");
  588. ref.shift();
  589. ref.pop();
  590. ref = ref.join("_");
  591. //ref = ref[1];
  592. console.log(ref, key);
  593. data_type = $("#" + key).attr('data-type');
  594. if($("#" + key).length > 0) {
  595. if (data_type == "data") {
  596. console.log(key);
  597. var datavalue, set_color, formula;
  598. var formula_attr = $("#" + key).attr('data-formula');
  599. if (response[ref]) {
  600. if (formula_attr) {
  601. datavalue = parseFloat(response[ref]).toFixed(2);
  602. formula = formula_attr.replace("x", datavalue.toString());
  603. datavalue = math.round(math.eval(formula),2);
  604. datavalue = datavalue.toFixed(2);
  605. } else {
  606. datavalue = parseFloat(response[ref]).toFixed(2);
  607. }
  608. set_color = "green";
  609. } else {
  610. datavalue = "---";
  611. set_color = "black";
  612. }
  613. $(".varval", "#" + key).text(datavalue);
  614. var condition_attr = $("#" + key).attr('data-cond');
  615. var lesser_attr = $("#" + key).attr('data-lesser');
  616. var larger_attr = $("#" + key).attr('data-larger');
  617. //console.log(condition_attr);
  618. if (condition_attr) {
  619. if (response[ref] == condition_attr) {
  620. set_color = "red";
  621. }
  622. }
  623. if (lesser_attr) {
  624. if (parseFloat(response[ref]) < parseFloat(lesser_attr)) {
  625. set_color = "red";
  626. }
  627. }
  628. if (larger_attr) {
  629. if (parseFloat(response[ref]) > parseFloat(larger_attr)) {
  630. set_color = "red";
  631. }
  632. }
  633. $(".varval", "#" + key).css("color", set_color);
  634. $(".unit_title", "#" + key).css("color", set_color);
  635. } else if (data_type == "icon") {
  636. var on_attr = $("#" + key).attr('data-on');
  637. var off_attr = $("#" + key).attr('data-off');
  638. var on_condition = $("#" + key).attr('data-onexpression');
  639. var off_condition = $("#" + key).attr('data-offexpression');
  640. if (on_condition == 'onequal'){
  641. if (parseFloat(response[ref]) == parseFloat(on_attr)) {
  642. $("img", "#" + key).attr("src", "/static/" + $("#" + key).attr('data-icon') + "_green.svg");
  643. }
  644. } else if (on_condition == 'onsmaller'){
  645. if (parseFloat(response[ref]) < parseFloat(on_attr)) {
  646. $("img", "#" + key).attr("src", "/static/" + $("#" + key).attr('data-icon') + "_green.svg");
  647. }
  648. } else if (on_condition == 'ongreater'){
  649. if (parseFloat(response[ref]) > parseFloat(on_attr)) {
  650. $("img", "#" + key).attr("src", "/static/" + $("#" + key).attr('data-icon') + "_green.svg");
  651. }
  652. }
  653. if (off_condition == 'offequal'){
  654. if (parseFloat(response[ref]) == parseFloat(off_attr)) {
  655. $("img", "#" + key).attr("src", "/static/" + $("#" + key).attr('data-icon') + "_red.svg");
  656. }
  657. } else if (off_condition == 'offsmaller'){
  658. if (parseFloat(response[ref]) < parseFloat(off_attr)) {
  659. $("img", "#" + key).attr("src", "/static/" + $("#" + key).attr('data-icon') + "_red.svg");
  660. }
  661. } else if (off_condition == 'offgreater'){
  662. if (parseFloat(response[ref]) > parseFloat(off_attr)) {
  663. $("img", "#" + key).attr("src", "/static/" + $("#" + key).attr('data-icon') + "_red.svg");
  664. }
  665. }
  666. } else if (data_type == "integer-to-string") {
  667. var dict_attr = JSON.parse($("#" + key).attr('data-dict'));
  668. var dict_cond;
  669. if ($("#"+key).attr("data-cond")) {
  670. dict_cond = JSON.parse($("#" + key).attr('data-cond'));
  671. } else {
  672. dict_cond = {};
  673. }
  674. var dict_color = "";
  675. if (ref in response) {
  676. var token = response[ref];
  677. if (token in dict_cond) {
  678. dict_color = dict_cond[token];
  679. }
  680. }
  681. $(".varval", "#" + key).css("color", dict_color);
  682. $(".varval", "#" + key).text(dict_attr[response[ref]]);
  683. }
  684. }
  685. });
  686. $('[id^=calc_]').each(function( index ) {
  687. //console.log(this.id);
  688. //console.log($(this).attr('data-formula'));
  689. if (typeof $(this).attr('data-formula') != "undefined") {
  690. var myformula = $(this).attr('data-formula').trim();
  691. /*
  692. myformula = myformula.replace(/\[.*?\]/g, '__');
  693. console.log(myformula);
  694. */
  695. var data = myformula;
  696. var re= /\[(.*?)\]/g;
  697. var buffer = []
  698. for(m = re.exec(data); m; m = re.exec(data)){
  699. buffer.push(m[1]);
  700. }
  701. console.log("Debug:");
  702. console.log(buffer);
  703. var finalstring = "";
  704. var pattern = /\[(.*?)\]/g;
  705. var teststring = myformula.split(/[\[\]]+/);
  706. console.log(teststring);
  707. console.log(finalstring);
  708. for (var i = 0; i < teststring.length; i++) {
  709. var val = "";
  710. if (teststring[i] in response) {
  711. val = response[teststring[i]];
  712. } else {
  713. val = teststring[i];
  714. }
  715. finalstring += val;
  716. finalstring += " ";
  717. }
  718. finalstring = finalstring.trim();
  719. console.log(finalstring);
  720. var myvalue = math.round(math.eval(finalstring),2);
  721. myvalue = myvalue.toFixed(2);
  722. set_color = "green";
  723. console.log(myvalue);
  724. $(".varval", "#" + this.id).text(myvalue);
  725. var condition_attr = $("#" + this.id).attr('data-cond');
  726. var lesser_attr = $("#" + this.id).attr('data-lesser');
  727. var larger_attr = $("#" + this.id).attr('data-larger');
  728. //console.log(condition_attr);
  729. if (condition_attr) {
  730. if (myvalue == condition_attr) {
  731. set_color = "red";
  732. }
  733. }
  734. if (lesser_attr) {
  735. if (parseFloat(myvalue) < parseFloat(lesser_attr)) {
  736. set_color = "red";
  737. }
  738. }
  739. if (larger_attr) {
  740. if (parseFloat(myvalue) > parseFloat(larger_attr)) {
  741. set_color = "red";
  742. }
  743. }
  744. $(".varval", "#" + this.id).css("color", set_color);
  745. $(".unit_title", "#" + this.id).css("color", set_color);
  746. }
  747. });
  748. var page_title_cache = $("#page_title_cache").text();
  749. var datetime = page_title_cache + " data monitoring page. Last Sync: " + response["time"];
  750. $("#page_info").text(datetime);
  751. console.log(datetime);
  752. },
  753. error: function () {
  754. console.log("Error.")
  755. }
  756. });
  757. }
  758. });
  759. </script>
  760. </body>
  761. </html>