aboutsummaryrefslogtreecommitdiff
path: root/views/index.hbs
blob: 8885933e73041445a22238222b3b08ae5bd1f2ad (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
  <div class="container body">
    <div class="main_container">
      <div class="col-md-3 left_col">
        <div class="left_col scroll-view">
          <div class="navbar nav_title" style="border: 0;">
            <a href="index.html" class="site_title">
              <span>Energy Monitor</span>
            </a>
          </div>

          <div class="clearfix"></div>

          <div id="sidebar-menu" class="main_menu_side hidden-print main_menu">
            <div class="menu_section">
              <h3>Devices</h3>
              <ul class="nav side-menu">
                {{#each devices}}
                <li class="active">
                  <a title="Device Id: {{this.deviceId}}">
                    <i class="fa fa-plug"></i>
                    {{this.alias}}
                  </a>
                </li>
                {{/each}}
              </ul>
            </div>
          </div>

        </div>
      </div>

      <div class="right_col" role="main">
        
        <div class="page-header">
          <div class="row">
            <div class="col-sm-8">
              <h1>
                <i class="fa fa-plug"></i> {{device.alias}} {{#device.relayState}}
                <span class="label label-success">ON</span>
                {{/device.relayState}} {{^device.relayState}}
                <span class="label label-danger">OFF</span>
                {{/device.relayState}}
              </h1>
            </div>
            <div class="col-sm-4">
              <h2 class="pull-right">
              <input id="toggle-polling" class="form-control" type="checkbox" checked data-toggle="toggle" data-on="Auto refresh on" data-off="Auto refresh off" data-offstyle="danger">
              </h2>
            </div>
          </div>
        </div>

        <div class="row">


          <div class="col-md-5 col-sm-5 col-xs-12">
            <div class="x_panel tile">
              <div class="x_title">
                <h2>
                  <strong>Realtime Usage</strong>
                </h2>
                <div class="clearfix"></div>
              </div>
              <div class="x_content">
                <div class="row">
                  <h1 class="text-center">
                    <strong id="rtu-power">- kW</strong>
                  </h1>
                </div>

                <div class="row text-center">
                  <div>
                    <canvas id="rtu-gauge"></canvas>
                  </div>
                </div>


                <div class="row">
                  <div class="col-md-6 col-xs-6 text-center">
                    <h1>
                      <strong id="rtu-current">- A</strong>
                    </h1>
                  </div>
                  <div class="col-md-6 col-xs-6 text-center">
                    <h1>
                      <strong id="rtu-voltage">- V</strong>
                    </h1>
                  </div>
                </div>

              </div>

            </div>
          </div>
        </div>

      </div>
    </div>
  </div>
  <footer>
    <ul class="list-inline">
      <li>
        <strong>Device name:</strong> {{device.name}}</li>
      <li>
        <strong>Model:</strong> {{device.model}}</li>
      <li>
        <strong>Sw ver:</strong> {{device.softwareVersion}}</li>
      <li>
        <strong>Hw ver:</strong> {{device.hardwareVersion}}</li>
    </ul>
  </footer>
  </div>
  </div>

  <script src="https://getbootstrap.com/assets/js/vendor/popper.min.js"></script>
  <script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0/js/bootstrap.min.js"></script>
  <script src="https://bernii.github.io/gauge.js/dist/gauge.min.js"></script>
  <script src="https://gitcdn.github.io/bootstrap-toggle/2.2.2/js/bootstrap-toggle.min.js"></script>

  <script src="/javascripts/dash.js"></script>

  {{!-- <script>

    $(document).ready(function () {
      var opts = {
        angle: 0,
        lineWidth: 0.2,
        pointer: {
          length: 0.6,
          strokeWidth: 0.035,
          color: '#000000'
        },
        limitMax: true,
        limitMin: true,
        generateGradient: true,
        highDpiSupport: true, 
        staticLabels: {
          font: "12px sans-serif",
          labels: [500, 1500, 3000]
        },
        staticZones: [
          { strokeStyle: "#30B32D", min: 0, max: 500 },
          { strokeStyle: "#FFDD00", min: 500, max: 1500 },
          { strokeStyle: "#F03E3E", min: 1500, max: 3000 }
        ]
      };
      var target = document.getElementById('realtime-gauge');

      var gauge = new Gauge(target).setOptions(opts);
      gauge.maxValue = 3000;
      gauge.setMinValue(0);
      gauge.animationSpeed = 1;
      gauge.set({{ realtimeUsage.power }});
    })
  </script> --}}