status.html 39 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856
  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;
  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;
  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;
  126. {% if "background_color" in data['style'][key] %}
  127. background-color:{{ data['style'][key]['background_color'] }};'
  128. {% else%}
  129. {% end%}
  130. {% if "trend" in data['style'][key] %}
  131. data-trend="{{ data['style'][key]['trend'] }}"
  132. {% else %}
  133. {% end %}
  134. {% if data['style'][key]['linkhtml'] == 'true' %}
  135. {% if "server" in data %}
  136. onclick="window.open( '{{ data["server"] }}#module=graph&{{ data['varname'][data['style'][key]['ref']] }}&experiment=-&window=86400&module=graph&virtual=srctree&srctree=&infomod=legend', '_blank');"
  137. {% else %}
  138. {% end %}
  139. {% else %}
  140. {% end %}
  141. {% if "ref" in data['style'][key] %}
  142. 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 }}">
  143. {% if "trend" in data['style'][key] %}
  144. {% if data['style'][key]['trend'] == 'true' %}
  145. {% else %}
  146. {% end %}
  147. {% else %}
  148. {% end %}
  149. <div class="icon">
  150. <img width="{{ data['style'][key]['width'] }}px" height="{{ data['style'][key]['height'] }}px" style='transform: {{ data['style'][key]['rotate'] }}' src='{{ static_url("valve_inactive.png") }}'></img>
  151. </div>
  152. </div>
  153. {% else %}
  154. 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 }}">
  155. {% if data['style'][key]['trend'] == 'true' %}
  156. {% else %}
  157. {% end %}
  158. <div class="icon">
  159. <img width="{{ data['style'][key]['width'] }}px" height="{{ data['style'][key]['height'] }}px" style='transform: {{ data['style'][key]['rotate'] }}' src='{{ static_url("valve_inactive.png") }}'></img>
  160. </div>
  161. </div>
  162. {% end %}
  163. {% else %}
  164. {% end %}
  165. {% if data['style'][key]['icon'] == "commbit" %}
  166. {% if "ref" in data['style'][key] %}
  167. <div tooltip="{{ data['style'][key]['ref'] }}"
  168. {% else %}
  169. <div tooltip="{{ key }}"
  170. {% end %}
  171. 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;
  172. {% if "background_color" in data['style'][key] %}
  173. background-color:{{ data['style'][key]['background_color'] }};'
  174. {% else%}
  175. {% end%}
  176. {% if "trend" in data['style'][key] %}
  177. data-trend="{{ data['style'][key]['trend'] }}"
  178. {% else %}
  179. {% end %}
  180. {% if data['style'][key]['linkhtml'] == 'true' %}
  181. {% if "server" in data %}
  182. onclick="window.open( '{{ data["server"] }}#module=graph&{{ data['varname'][data['style'][key]['ref']] }}&experiment=-&window=86400&module=graph&virtual=srctree&srctree=&infomod=legend', '_blank');"
  183. {% else %}
  184. {% end %}
  185. {% else %}
  186. {% end %}
  187. {% if "ref" in data['style'][key] %}
  188. 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 }}">
  189. {% if data['style'][key]['trend'] == 'true' %}
  190. {% else %}
  191. {% end %}
  192. <div class="icon">
  193. <img width="{{ data['style'][key]['width'] }}px" height="{{ data['style'][key]['height'] }}px" style='transform: {{ data['style'][key]['rotate'] }}' src='{{ static_url("commbit_inactive.svg") }}'></img>
  194. </div>
  195. </div>
  196. {% else %}
  197. 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 }}">
  198. {% if data['style'][key]['trend'] == 'true' %}
  199. {% else %}
  200. {% end %}
  201. <div class="icon">
  202. <img width="{{ data['style'][key]['width'] }}px" height="{{ data['style'][key]['height'] }}px" style='transform: {{ data['style'][key]['rotate'] }}' src='{{ static_url("commbit_inactive.svg") }}'></img>
  203. </div>
  204. </div>
  205. {% end %}
  206. {% else %}
  207. {% end %}
  208. {% if data['style'][key]['icon'] == "alarm" %}
  209. {% if "ref" in data['style'][key] %}
  210. <div tooltip="{{ data['style'][key]['ref'] }}"
  211. {% else %}
  212. <div tooltip="{{ key }}"
  213. {% end %}
  214. 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;
  215. {% if "background_color" in data['style'][key] %}
  216. background-color:{{ data['style'][key]['background_color'] }};'
  217. {% else%}
  218. {% end%}
  219. {% if "trend" in data['style'][key] %}
  220. data-trend="{{ data['style'][key]['trend'] }}"
  221. {% else %}
  222. {% end %}
  223. {% if data['style'][key]['linkhtml'] == 'true' %}
  224. {% if "server" in data %}
  225. onclick="window.open( '{{ data["server"] }}#module=graph&{{ data['varname'][data['style'][key]['ref']] }}&experiment=-&window=86400&module=graph&virtual=srctree&srctree=&infomod=legend', '_blank');"
  226. {% else %}
  227. {% end %}
  228. {% else %}
  229. {% end %}
  230. {% if "ref" in data['style'][key] %}
  231. 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 }}">
  232. {% if data['style'][key]['trend'] == 'true' %}
  233. {% else %}
  234. {% end %}
  235. <div class="icon">
  236. <img width="{{ data['style'][key]['width'] }}px" height="{{ data['style'][key]['height'] }}px" style='transform: {{ data['style'][key]['rotate'] }}' src='{{ static_url("alarm_inactive.svg") }}'></img>
  237. </div>
  238. </div>
  239. {% else %}
  240. 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 }}">
  241. {% if data['style'][key]['trend'] == 'true' %}
  242. {% else %}
  243. {% end %}
  244. <div class="icon">
  245. <img width="{{ data['style'][key]['width'] }}px" height="{{ data['style'][key]['height'] }}px" style='transform: {{ data['style'][key]['rotate'] }}' src='{{ static_url("alarm_inactive.svg") }}'></img>
  246. </div>
  247. </div>
  248. {% end %}
  249. {% else %}
  250. {% end %}
  251. {% if data['style'][key]['icon'] == "TMP" %}
  252. {% if "ref" in data['style'][key] %}
  253. <div tooltip="{{ data['style'][key]['ref'] }}"
  254. {% else %}
  255. <div tooltip="{{ key }}"
  256. {% end %}
  257. 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;
  258. {% if "background_color" in data['style'][key] %}
  259. background-color:{{ data['style'][key]['background_color'] }};'
  260. {% else%}
  261. {% end%}
  262. {% if "trend" in data['style'][key] %}
  263. data-trend="{{ data['style'][key]['trend'] }}"
  264. {% else %}
  265. {% end %}
  266. {% if data['style'][key]['linkhtml'] == 'true' %}
  267. {% if "server" in data %}
  268. onclick="window.open( '{{ data["server"] }}#module=graph&{{ data['varname'][data['style'][key]['ref']] }}&experiment=-&window=86400&module=graph&virtual=srctree&srctree=&infomod=legend', '_blank');"
  269. {% else %}
  270. {% end %}
  271. {% else %}
  272. {% end %}
  273. {% if "ref" in data['style'][key] %}
  274. 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 }}">
  275. {% if data['style'][key]['trend'] == 'true' %}
  276. {% else %}
  277. {% end %}
  278. <div class="icon">
  279. <img width="{{ data['style'][key]['width'] }}px" height="{{ data['style'][key]['height'] }}px" style='transform: {{ data['style'][key]['rotate'] }}' src='{{ static_url("TMP_inactive.svg") }}'></img>
  280. </div>
  281. </div>
  282. {% else %}
  283. 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 }}">
  284. {% if data['style'][key]['trend'] == 'true' %}
  285. {% else %}
  286. {% end %}
  287. <div class="icon">
  288. <img width="{{ data['style'][key]['width'] }}px" height="{{ data['style'][key]['height'] }}px" style='transform: {{ data['style'][key]['rotate'] }}' src='{{ static_url("TMP_inactive.svg") }}'></img>
  289. </div>
  290. </div>
  291. {% end %}
  292. {% else %}
  293. {% end %}
  294. {% if data['style'][key]['icon'] == "relay" %}
  295. {% if "ref" in data['style'][key] %}
  296. <div tooltip="{{ data['style'][key]['ref'] }}"
  297. {% else %}
  298. <div tooltip="{{ key }}"
  299. {% end %}
  300. 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;
  301. {% if "background_color" in data['style'][key] %}
  302. background-color:{{ data['style'][key]['background_color'] }};'
  303. {% else%}
  304. {% end%}
  305. {% if "trend" in data['style'][key] %}
  306. data-trend="{{ data['style'][key]['trend'] }}"
  307. {% else %}
  308. {% end %}
  309. {% if data['style'][key]['linkhtml'] == 'true' %}
  310. {% if "server" in data %}
  311. onclick="window.open( '{{ data["server"] }}#module=graph&{{ data['varname'][data['style'][key]['ref']] }}&experiment=-&window=86400&module=graph&virtual=srctree&srctree=&infomod=legend', '_blank');"
  312. {% else %}
  313. {% end %}
  314. {% else %}
  315. {% end %}
  316. {% if "ref" in data['style'][key] %}
  317. 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 }}">
  318. {% if data['style'][key]['trend'] == 'true' %}
  319. {% else %}
  320. {% end %}
  321. <div class="icon">
  322. <img width="{{ data['style'][key]['width'] }}px" height="{{ data['style'][key]['height'] }}px" style='transform: {{ data['style'][key]['rotate'] }}' src='{{ static_url("relay_inactive.svg") }}'></img>
  323. </div>
  324. </div>
  325. {% else %}
  326. 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 }}">
  327. {% if data['style'][key]['trend'] == 'true' %}
  328. {% else %}
  329. {% end %}
  330. <div class="icon">
  331. <img width="{{ data['style'][key]['width'] }}px" height="{{ data['style'][key]['height'] }}px" style='transform: {{ data['style'][key]['rotate'] }}' src='{{ static_url("relay_inactive.svg") }}'></img>
  332. </div>
  333. </div>
  334. {% end %}
  335. {% else %}
  336. {% end %}
  337. {% if data['style'][key]['icon'] == "switch" %}
  338. {% if "ref" in data['style'][key] %}
  339. <div tooltip="{{ data['style'][key]['ref'] }}"
  340. {% else %}
  341. <div tooltip="{{ key }}"
  342. {% end %}
  343. 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;
  344. {% if "background_color" in data['style'][key] %}
  345. background-color:{{ data['style'][key]['background_color'] }};'
  346. {% else%}
  347. {% end%}
  348. {% if "trend" in data['style'][key] %}
  349. data-trend="{{ data['style'][key]['trend'] }}"
  350. {% else %}
  351. {% end %}
  352. {% if data['style'][key]['linkhtml'] == 'true' %}
  353. {% if "server" in data %}
  354. onclick="window.open( '{{ data["server"] }}#module=graph&{{ data['varname'][data['style'][key]['ref']] }}&experiment=-&window=86400&module=graph&virtual=srctree&srctree=&infomod=legend', '_blank');"
  355. {% else %}
  356. {% end %}
  357. {% else %}
  358. {% end %}
  359. {% if "ref" in data['style'][key] %}
  360. 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 }}">
  361. {% if data['style'][key]['trend'] == 'true' %}
  362. {% else %}
  363. {% end %}
  364. <div class="icon">
  365. <img width="{{ data['style'][key]['width'] }}px" height="{{ data['style'][key]['height'] }}px" style='transform: {{ data['style'][key]['rotate'] }}' src='{{ static_url("switch_inactive.svg") }}'></img>
  366. </div>
  367. </div>
  368. {% else %}
  369. 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 }}">
  370. {% if data['style'][key]['trend'] == 'true' %}
  371. {% else %}
  372. {% end %}
  373. <div class="icon">
  374. <img width="{{ data['style'][key]['width'] }}px" height="{{ data['style'][key]['height'] }}px" style='transform: {{ data['style'][key]['rotate'] }}' src='{{ static_url("switch_inactive.svg") }}'></img>
  375. </div>
  376. </div>
  377. {% end %}
  378. {% else %}
  379. {% end %}
  380. {% if data['style'][key]['icon'] == "bottle" %}
  381. {% if "ref" in data['style'][key] %}
  382. <div tooltip="{{ data['style'][key]['ref'] }}"
  383. {% else %}
  384. <div tooltip="{{ key }}"
  385. {% end %}
  386. 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;
  387. {% if "background_color" in data['style'][key] %}
  388. background-color:{{ data['style'][key]['background_color'] }};'
  389. {% else%}
  390. {% end%}
  391. {% if "trend" in data['style'][key] %}
  392. data-trend="{{ data['style'][key]['trend'] }}"
  393. {% else %}
  394. {% end %}
  395. {% if data['style'][key]['linkhtml'] == 'true' %}
  396. {% if "server" in data %}
  397. onclick="window.open( '{{ data["server"] }}#module=graph&{{ data['varname'][data['style'][key]['ref']] }}&experiment=-&window=86400&module=graph&virtual=srctree&srctree=&infomod=legend', '_blank');"
  398. {% else %}
  399. {% end %}
  400. {% else %}
  401. {% end %}
  402. {% if "ref" in data['style'][key] %}
  403. 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 }}">
  404. {% if data['style'][key]['trend'] == 'true' %}
  405. {% else %}
  406. {% end %}
  407. <div class="icon">
  408. <img width="{{ data['style'][key]['width'] }}px" height="{{ data['style'][key]['height'] }}px" style='transform: {{ data['style'][key]['rotate'] }}' src='{{ static_url("bottle_inactive.svg") }}'></img>
  409. </div>
  410. </div>
  411. {% else %}
  412. 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 }}">
  413. {% if data['style'][key]['trend'] == 'true' %}
  414. {% else %}
  415. {% end %}
  416. <div class="icon">
  417. <img width="{{ data['style'][key]['width'] }}px" height="{{ data['style'][key]['height'] }}px" style='transform: {{ data['style'][key]['rotate'] }}' src='{{ static_url("bottle_inactive.svg") }}'></img>
  418. </div>
  419. </div>
  420. {% end %}
  421. {% else %}
  422. {% end %}
  423. {% else %}
  424. {% end %}
  425. {% if data['style'][key]['type'] == "integer-to-string" %}
  426. <div tooltip="{{ key }}" style='position: absolute; top: {{
  427. data['style'][key]['top'] }}; left:{{ data['style'][key]['left'] }};
  428. width:{{ data['style'][key]['width'] }}px; height:{{
  429. data['style'][key]['height'] }}px;
  430. {% if "background_color" in data['style'][key] %}
  431. background-color:{{ data['style'][key]['background_color'] }};'
  432. {% else%}
  433. '
  434. {% end%}
  435. {% if "cond" in data['style'][key] %}
  436. data-cond="{{ data['style'][key]['cond'] }}"
  437. {% else %}
  438. {% end %}
  439. {% if "trend" in data['style'][key] %}
  440. data-trend="{{ data['style'][key]['trend'] }}"
  441. {% else %}
  442. {% end %}
  443. {% if "linkhtml" in data['style'][key] %}
  444. {% if data['style'][key]['linkhtml'] == 'true' %}
  445. {% if "server" in data %}
  446. onclick="window.open( '{{ data["server"] }}#module=graph&{{ data['varname'][data['style'][key]['ref']] }}&experiment=-&window=86400&module=graph&virtual=srctree&srctree=&infomod=legend', '_blank');"
  447. {% else %}
  448. {% end %}
  449. {% else %}
  450. {% end %}
  451. {% else %}
  452. {% end %}
  453. data-dict="{{ data['style'][key]['dict'] }}" data-type="{{ data['style'][key]['type'] }}" class='databox' id="{{ key }}">
  454. <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>
  455. {% if "trend" in data['style'][key] %}
  456. {% if data['style'][key]['trend'] == 'true' %}
  457. {% else %}
  458. {% end %}
  459. {% else %}
  460. {% end %}
  461. </p>
  462. </div>
  463. {% else %}
  464. {% end %}
  465. {% if data['style'][key]['type'] == "header" %}
  466. <div style='position: absolute; top: {{ data['style'][key]['top'] }}; left:{{
  467. data['style'][key]['left'] }}; width:{{ data['style'][key]['width'] }}px;
  468. height:{{ data['style'][key]['height'] }}px;
  469. {% if "background_color" in data['style'][key] %}
  470. background-color:{{ data['style'][key]['background_color'] }};'
  471. {% else %}
  472. {% end %}
  473. data-type="{{
  474. data['style'][key]['type'] }}" class='databox' id="{{ key }}">
  475. <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>
  476. </div>
  477. {% else %}
  478. {% end %}
  479. {% end %}
  480. {% else %}
  481. {% end %}
  482. {% if "background" in data %}
  483. <img src="{{ static_url( data['background'] ) }}"></img>
  484. {% else %}
  485. <img src="{{ static_url( 'background.png' ) }}"></img>
  486. {% end %}
  487. <!-- java script -->
  488. <script src="{{ static_url("jquery-1.12.3.min.js") }}"></script>
  489. <script src="{{ static_url("jquery-ui.min.js") }}"></script>
  490. <script src="{{ static_url("math.min.js") }}"></script>
  491. <script>
  492. jQuery(window).load(function () {
  493. var win_width = $(document).width();
  494. var win_height = $(document).height();
  495. $(".databox").hover(function(){
  496. var trend_time = Math.floor(Date.now() / 1000);
  497. var key = $(this).attr('id');
  498. if ($("#" + key).attr('data-trend') == "true") {
  499. $('#'+ key).append('<span class="popup" style="top:0; left:250px;"><img src="/static/'+ $("#page_title_cache").text().toLowerCase() +'/images/'+key+'.png?time='+trend_time+'" width="600px" height="400px"/></span>');
  500. var key_left = parseInt($("#" + key).css("left"));
  501. var pos_left = key_left + 850;
  502. var key_top = parseInt($("#" + key).css("top"));
  503. var pos_top = key_top + 400;
  504. if(pos_left > win_width) {
  505. $("#" + key + " .popup").css({
  506. 'right':'250px',
  507. 'left': ''
  508. });
  509. }
  510. if(pos_top > win_height) {
  511. $("#" + key + " .popup").css({
  512. 'bottom':'0px',
  513. 'top': ''
  514. });
  515. }
  516. }
  517. });
  518. myTimer();
  519. var myVar = setInterval(myTimer, 10000);
  520. function myTimer() {
  521. var dataToSend = {};
  522. $.ajax({
  523. url: '/'+$("#page_title_cache").text().toLowerCase()+'/getdata/',
  524. //url: '/wgts/getabcddata/',
  525. type: 'GET',
  526. data: dataToSend,
  527. success: function (response) {
  528. //var objresponse = JSON.parse(response);
  529. console.log(response);
  530. for (var key in response) {
  531. //console.log(key, response[key]);
  532. data_type = $("#" + key).attr('data-type');
  533. if($("#" + key).length > 0) {
  534. if (data_type == "data") {
  535. //console.log("data");
  536. var datavalue, set_color, formula;
  537. var formula_attr = $("#" + key).attr('data-formula');
  538. if (response[key]) {
  539. if (formula_attr) {
  540. datavalue = parseFloat(response[key]).toFixed(2);
  541. formula = formula_attr.replace("x", datavalue.toString());
  542. datavalue = math.round(math.eval(formula),2);
  543. datavalue = datavalue.toFixed(2);
  544. } else {
  545. if ( ($("#" + key).attr('data-exponential')) == "True" || ($("#" + key).attr('data-exponential')) == "true" ) {
  546. datavalue = parseFloat(response[key]);
  547. datavalue = datavalue.toExponential(2)
  548. } else {
  549. datavalue = parseFloat(response[key]).toFixed(2);
  550. }
  551. }
  552. set_color = "green";
  553. } else {
  554. datavalue = "---";
  555. set_color = "black";
  556. }
  557. $(".varval", "#" + key).text(datavalue);
  558. var condition_attr = $("#" + key).attr('data-cond');
  559. var lesser_attr = $("#" + key).attr('data-lesser');
  560. var larger_attr = $("#" + key).attr('data-larger');
  561. //console.log(condition_attr);
  562. if (condition_attr) {
  563. if (response[key] == condition_attr) {
  564. set_color = "red";
  565. }
  566. }
  567. if (lesser_attr) {
  568. if (parseFloat(response[key]) < parseFloat(lesser_attr)) {
  569. set_color = "red";
  570. }
  571. }
  572. if (larger_attr) {
  573. if (parseFloat(response[key]) > parseFloat(larger_attr)) {
  574. set_color = "red";
  575. }
  576. }
  577. $(".varval", "#" + key).css("color", set_color);
  578. $(".unit_title", "#" + key).css("color", set_color);
  579. } else if (data_type == "icon") {
  580. //console.log("ventil");
  581. var on_attr = $("#" + key).attr('data-on');
  582. var off_attr = $("#" + key).attr('data-off');
  583. var on_condition = $("#" + key).attr('data-onexpression');
  584. var off_condition = $("#" + key).attr('data-offexpression');
  585. if (on_condition == 'onequal'){
  586. if (parseFloat(response[key]) == parseFloat(on_attr)) {
  587. $("img", "#" + key).attr("src", "/static/" + $("#" + key).attr('data-icon') + "_green.svg");
  588. }
  589. } else if (on_condition == 'onsmaller'){
  590. if (parseFloat(response[key]) < parseFloat(on_attr)) {
  591. $(".icon img", "#" + key).attr("src", "/static/" + $("#" + key).attr('data-icon') + "_green.svg");
  592. }
  593. } else if (on_condition == 'ongreater'){
  594. if (parseFloat(response[key]) > parseFloat(on_attr)) {
  595. $(".icon img", "#" + key).attr("src", "/static/" + $("#" + key).attr('data-icon') + "_green.svg");
  596. }
  597. }
  598. if (off_condition == 'offequal'){
  599. if (parseFloat(response[key]) == parseFloat(off_attr)) {
  600. $(".icon img", "#" + key).attr("src", "/static/" + $("#" + key).attr('data-icon') + "_red.svg");
  601. }
  602. } else if (off_condition == 'offsmaller'){
  603. if (parseFloat(response[key]) < parseFloat(off_attr)) {
  604. $(".icon img", "#" + key).attr("src", "/static/" + $("#" + key).attr('data-icon') + "_red.svg");
  605. }
  606. } else if (off_condition == 'offgreater'){
  607. if (parseFloat(response[key]) > parseFloat(off_attr)) {
  608. $(".icon img", "#" + key).attr("src", "/static/" + $("#" + key).attr('data-icon') + "_red.svg");
  609. }
  610. }
  611. } else if (data_type == "integer-to-string") {
  612. //console.log("integer-to-string");
  613. var dict_attr = JSON.parse($("#" + key).attr('data-dict'));
  614. var dict_cond;
  615. if ($("#"+key).attr("data-cond")) {
  616. dict_cond = JSON.parse($("#" + key).attr('data-cond'));
  617. } else {
  618. dict_cond = {};
  619. }
  620. var dict_color = "";
  621. if (key in response) {
  622. var token = response[key];
  623. if (token in dict_cond) {
  624. dict_color = dict_cond[token];
  625. }
  626. }
  627. $(".varval", "#" + key).css("color", dict_color);
  628. $(".varval", "#" + key).text(dict_attr[response[key]]);
  629. }
  630. }
  631. }
  632. $('[id^=virtual_]').each(function( index ) {
  633. var key = this.id;
  634. var ref = key.split("_");
  635. ref.shift();
  636. ref.pop();
  637. ref = ref.join("_");
  638. //ref = ref[1];
  639. console.log(ref, key);
  640. data_type = $("#" + key).attr('data-type');
  641. if($("#" + key).length > 0) {
  642. if (data_type == "data") {
  643. console.log(key);
  644. var datavalue, set_color, formula;
  645. var formula_attr = $("#" + key).attr('data-formula');
  646. if (response[ref]) {
  647. if (formula_attr) {
  648. datavalue = parseFloat(response[ref]).toFixed(2);
  649. formula = formula_attr.replace("x", datavalue.toString());
  650. datavalue = math.round(math.eval(formula),2);
  651. datavalue = datavalue.toFixed(2);
  652. } else {
  653. datavalue = parseFloat(response[ref]).toFixed(2);
  654. }
  655. set_color = "green";
  656. } else {
  657. datavalue = "---";
  658. set_color = "black";
  659. }
  660. $(".varval", "#" + key).text(datavalue);
  661. var condition_attr = $("#" + key).attr('data-cond');
  662. var lesser_attr = $("#" + key).attr('data-lesser');
  663. var larger_attr = $("#" + key).attr('data-larger');
  664. //console.log(condition_attr);
  665. if (condition_attr) {
  666. if (response[ref] == condition_attr) {
  667. set_color = "red";
  668. }
  669. }
  670. if (lesser_attr) {
  671. if (parseFloat(response[ref]) < parseFloat(lesser_attr)) {
  672. set_color = "red";
  673. }
  674. }
  675. if (larger_attr) {
  676. if (parseFloat(response[ref]) > parseFloat(larger_attr)) {
  677. set_color = "red";
  678. }
  679. }
  680. $(".varval", "#" + key).css("color", set_color);
  681. $(".unit_title", "#" + key).css("color", set_color);
  682. } else if (data_type == "icon") {
  683. var on_attr = $("#" + key).attr('data-on');
  684. var off_attr = $("#" + key).attr('data-off');
  685. var on_condition = $("#" + key).attr('data-onexpression');
  686. var off_condition = $("#" + key).attr('data-offexpression');
  687. if (on_condition == 'onequal'){
  688. if (parseFloat(response[ref]) == parseFloat(on_attr)) {
  689. $("img", "#" + key).attr("src", "/static/" + $("#" + key).attr('data-icon') + "_green.svg");
  690. }
  691. } else if (on_condition == 'onsmaller'){
  692. if (parseFloat(response[ref]) < parseFloat(on_attr)) {
  693. $("img", "#" + key).attr("src", "/static/" + $("#" + key).attr('data-icon') + "_green.svg");
  694. }
  695. } else if (on_condition == 'ongreater'){
  696. if (parseFloat(response[ref]) > parseFloat(on_attr)) {
  697. $("img", "#" + key).attr("src", "/static/" + $("#" + key).attr('data-icon') + "_green.svg");
  698. }
  699. }
  700. if (off_condition == 'offequal'){
  701. if (parseFloat(response[ref]) == parseFloat(off_attr)) {
  702. $("img", "#" + key).attr("src", "/static/" + $("#" + key).attr('data-icon') + "_red.svg");
  703. }
  704. } else if (off_condition == 'offsmaller'){
  705. if (parseFloat(response[ref]) < parseFloat(off_attr)) {
  706. $("img", "#" + key).attr("src", "/static/" + $("#" + key).attr('data-icon') + "_red.svg");
  707. }
  708. } else if (off_condition == 'offgreater'){
  709. if (parseFloat(response[ref]) > parseFloat(off_attr)) {
  710. $("img", "#" + key).attr("src", "/static/" + $("#" + key).attr('data-icon') + "_red.svg");
  711. }
  712. }
  713. } else if (data_type == "integer-to-string") {
  714. var dict_attr = JSON.parse($("#" + key).attr('data-dict'));
  715. var dict_cond;
  716. if ($("#"+key).attr("data-cond")) {
  717. dict_cond = JSON.parse($("#" + key).attr('data-cond'));
  718. } else {
  719. dict_cond = {};
  720. }
  721. var dict_color = "";
  722. if (ref in response) {
  723. var token = response[ref];
  724. if (token in dict_cond) {
  725. dict_color = dict_cond[token];
  726. }
  727. }
  728. $(".varval", "#" + key).css("color", dict_color);
  729. $(".varval", "#" + key).text(dict_attr[response[ref]]);
  730. }
  731. }
  732. });
  733. $('[id^=calc_]').each(function( index ) {
  734. //console.log(this.id);
  735. //console.log($(this).attr('data-formula'));
  736. if (typeof $(this).attr('data-formula') != "undefined") {
  737. var myformula = $(this).attr('data-formula').trim();
  738. /*
  739. myformula = myformula.replace(/\[.*?\]/g, '__');
  740. console.log(myformula);
  741. */
  742. var data = myformula;
  743. var re= /\[(.*?)\]/g;
  744. var buffer = []
  745. for(m = re.exec(data); m; m = re.exec(data)){
  746. buffer.push(m[1]);
  747. }
  748. console.log("Debug:");
  749. console.log(buffer);
  750. var finalstring = "";
  751. var pattern = /\[(.*?)\]/g;
  752. var teststring = myformula.split(/[\[\]]+/);
  753. console.log(teststring);
  754. console.log(finalstring);
  755. for (var i = 0; i < teststring.length; i++) {
  756. var val = "";
  757. if (teststring[i] in response) {
  758. val = response[teststring[i]];
  759. } else {
  760. val = teststring[i];
  761. }
  762. finalstring += val;
  763. finalstring += " ";
  764. }
  765. finalstring = finalstring.trim();
  766. console.log(finalstring);
  767. var myvalue = math.round(math.eval(finalstring),2);
  768. myvalue = myvalue.toFixed(2);
  769. set_color = "green";
  770. console.log(myvalue);
  771. $(".varval", "#" + this.id).text(myvalue);
  772. var condition_attr = $("#" + this.id).attr('data-cond');
  773. var lesser_attr = $("#" + this.id).attr('data-lesser');
  774. var larger_attr = $("#" + this.id).attr('data-larger');
  775. //console.log(condition_attr);
  776. if (condition_attr) {
  777. if (myvalue == condition_attr) {
  778. set_color = "red";
  779. }
  780. }
  781. if (lesser_attr) {
  782. if (parseFloat(myvalue) < parseFloat(lesser_attr)) {
  783. set_color = "red";
  784. }
  785. }
  786. if (larger_attr) {
  787. if (parseFloat(myvalue) > parseFloat(larger_attr)) {
  788. set_color = "red";
  789. }
  790. }
  791. $(".varval", "#" + this.id).css("color", set_color);
  792. $(".unit_title", "#" + this.id).css("color", set_color);
  793. }
  794. });
  795. var page_title_cache = $("#page_title_cache").text();
  796. var datetime = page_title_cache + " data monitoring page. Last Sync: " + response["time"];
  797. $("#page_info").text(datetime);
  798. console.log(datetime);
  799. },
  800. error: function () {
  801. console.log("Error.")
  802. }
  803. });
  804. }
  805. });
  806. </script>
  807. </body>
  808. </html>