status.html 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="UTF-8">
  5. <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">CPS data monitoring. Last refreshed</div>
  16. {% if data['style'] %}
  17. {% for key in data['style'] %}
  18. <div style='position: absolute; top: {{ data['style'][key]['top'] }}; left:{{ data['style'][key]['left'] }}; width:{{ data['style'][key]['width'] }}px; height:{{ data['style'][key]['height'] }}px;' min="{{ data['style'][key]['min'] }}" max="{{ data['style'][key]['max'] }}" lesser="{{ data['style'][key]['lesser'] }}" larger="{{ data['style'][key]['larger'] }}" id="{{ key }}">
  19. <p><span style="color: #000; font-size: {{ data['style'][key]['header']['size'] }}; font-weight: {{ data['style'][key]['header']['weight'] }};" class="title">{{ data['style'][key]['header']['title'] }}</span>&nbsp;&nbsp;&nbsp;&nbsp;
  20. <span style="color: #000; font-size: {{ data['style'][key]['unit']['size'] }}; font-weight: {{ data['style'][key]['unit']['weight'] }};" class="varval"> XXX.XX </span><span class='unit_title'> {{ data['style'][key]['unit']['title'] }}</span></p>
  21. </div>
  22. {% end %}
  23. {% else %}
  24. {% end %}
  25. <img src="{{ static_url('background.png') }}"></img>
  26. <!-- java script -->
  27. <script src="{{ static_url("jquery-1.12.3.min.js") }}"></script>
  28. <script src="{{ static_url("jquery-ui.min.js") }}"></script>
  29. <script>
  30. jQuery(window).load(function () {
  31. myTimer();
  32. var myVar = setInterval(myTimer, 10000);
  33. function myTimer() {
  34. var dataToSend = {};
  35. $.ajax({
  36. url: '/getdata/',
  37. type: 'GET',
  38. data: dataToSend,
  39. success: function (response) {
  40. //var objresponse = JSON.parse(response);
  41. console.log(response);
  42. for (var key in response) {
  43. console.log(key, response[key]);
  44. if($("#" + key).length > 0) {
  45. $(".varval", "#" + key).text(parseFloat(response[key]).toFixed(2));
  46. }
  47. }
  48. var currentdate = new Date();
  49. var datetime = "CPS data monitoring page. Last Sync: " + ( (currentdate.getDate()<10?'0':'').toString() + (currentdate.getDate()).toString() ) + "/"
  50. + ( ((currentdate.getMonth()+1)<10?'0':'').toString() + (currentdate.getMonth()+1)).toString() + "/"
  51. + ( (currentdate.getFullYear()<10?'0':'').toString() + (currentdate.getFullYear()).toString() ) + " @ "
  52. + ( (currentdate.getHours()<10?'0':'').toString() + (currentdate.getHours()).toString() ) + ":"
  53. + ( (currentdate.getMinutes()<10?'0':'').toString() + (currentdate.getMinutes()).toString() ) + ":"
  54. + ( (currentdate.getSeconds()<10?'0':'').toString() + (currentdate.getSeconds()).toString() );
  55. $("#page_info").text(datetime);
  56. console.log(datetime);
  57. },
  58. error: function () {
  59. console.log("Error.")
  60. }
  61. });
  62. }
  63. });
  64. </script>
  65. </body>
  66. </html>