gdash 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,5 @@
1
1
  require 'rubygems'
2
- require 'sinatra'
2
+ require 'sinatra/base'
3
3
  require 'yaml'
4
4
  require 'erb'
5
5
  require 'redcarpet'
@@ -51,6 +51,6 @@ class GDash
51
51
  end
52
52
  end
53
53
 
54
- dashboards.sort_by{|d| d[:name]}
54
+ dashboards.sort_by{|d| d[:name].to_s}
55
55
  end
56
56
  end
@@ -85,21 +85,21 @@ Template Directory Layout?
85
85
  The directory layout is such that you can have many groupins of dashboards each with
86
86
  many dashboards underneath it, an example layout of your templates dir would be:
87
87
 
88
- graph_templates
89
- `-- virtualization
90
- |-- dom0
91
- | |-- dash.yaml
92
- | |-- iowait.graph
93
- | |-- load.graph
94
- | |-- system.graph
95
- | |-- threads.graph
96
- | `-- user.graph
97
- `-- kvm1
98
- |-- dash.yaml
99
- |-- disk_read.graph
100
- |-- disk_write.graph
101
- |-- ssd_read.graph
102
- `-- ssd_write.graph
88
+ graph_templates
89
+ `-- virtualization
90
+ |-- dom0
91
+ | |-- dash.yaml
92
+ | |-- iowait.graph
93
+ | |-- load.graph
94
+ | |-- system.graph
95
+ | |-- threads.graph
96
+ | `-- user.graph
97
+ `-- kvm1
98
+ |-- dash.yaml
99
+ |-- disk_read.graph
100
+ |-- disk_write.graph
101
+ |-- ssd_read.graph
102
+ `-- ssd_write.graph
103
103
 
104
104
  Here we have a group of dashboards called 'virtualization' with 2 dashboards inside it
105
105
  each with numerous graphs.
@@ -1,6 +1,6 @@
1
1
  <html>
2
2
  <head>
3
- <meta http-equiv="refresh" content="60">
3
+ <script src="<%= @prefix %>/js/jquery-1.5.2.min.js"></script>
4
4
  </head>
5
5
  <% if @error %>
6
6
  <h2><%= @error %></h2>
@@ -19,6 +19,18 @@
19
19
  </tr>
20
20
  <% end %>
21
21
  </table>
22
+ <script>
23
+ $(document).ready(function() {
24
+ setInterval(reloadDash, <%= @refresh_rate * 1000 %>);
25
+ });
26
+ function reloadDash() {
27
+ var now = new Date();
28
+ $('img').each(function(index) {
29
+ var url = $(this).attr('src').replace(/&\d+$/, '');
30
+ $(this).attr('src', url + '&' + now.getTime());
31
+ });
32
+ }
33
+ </script>
22
34
  </body>
23
35
  <% end %>
24
36
  </html>
@@ -7,7 +7,7 @@
7
7
  <th width="70%">Description</th>
8
8
  </thead>
9
9
  <tbody>
10
- <% @top_level[key].dashboards.sort_by{|b| b[:name]}.each do |board| %>
10
+ <% @top_level[key].dashboards.sort_by{|b| b[:name].to_s}.each do |board| %>
11
11
  <tr>
12
12
  <td><a href="<%= [@prefix, key, board[:link]].join('/') %>/"><%= board[:name] %></a></td><td><%= board[:description] %></td>
13
13
  </tr>
@@ -9,7 +9,6 @@
9
9
  <script src="<%= @prefix %>/js/bootstrap-dropdown.js"></script>
10
10
  <script src="<%= @prefix %>/js/bootstrap-popover.js"></script>
11
11
  <title><%= @dash_title %></title>
12
- <meta http-equiv="refresh" content="<%= @refresh_rate %>">
13
12
  </head>
14
13
  <body style="padding-top: 80px;">
15
14
  <div class="topbar-wrapper" style="z-index: 5;">
@@ -22,7 +21,7 @@
22
21
  <li class="dropdown">
23
22
  <a href="#" class="dropdown-toggle"><%= category.capitalize %></a>
24
23
  <ul class="dropdown-menu">
25
- <% @top_level[category].dashboards.sort_by{|b| b[:name]}.each do |board| %>
24
+ <% @top_level[category].dashboards.sort_by{|b| b[:name].to_s}.each do |board| %>
26
25
  <li><a href="<%= [@prefix, category, board[:link]].join('/') %>/"><%= board[:name] %></a></li>
27
26
  <% end %>
28
27
  </ul>
@@ -47,7 +46,22 @@
47
46
  <%= yield %>
48
47
  </div>
49
48
  <div class="container">
50
- <h6>Updated <%= Time.now %></h6>
49
+ <h6 id="updated"></h6>
51
50
  </div>
51
+ <script>
52
+ $(document).ready(function() {
53
+ var now = new Date();
54
+ $('#updated').text('Updated ' + now.toLocaleString())
55
+ setInterval(reloadDash, <%= @refresh_rate * 1000 %>);
56
+ });
57
+ function reloadDash() {
58
+ var now = new Date();
59
+ $('img').each(function(index) {
60
+ var url = $(this).attr('src').replace(/&\d+$/, '');
61
+ $(this).attr('src', url + '&' + now.getTime());
62
+ });
63
+ $('#updated').text('Updated ' + now.toLocaleString())
64
+ }
65
+ </script>
52
66
  </body>
53
67
  </html>
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gdash
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 25
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 2
10
- version: 0.0.2
9
+ - 3
10
+ version: 0.0.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - R.I.Pienaar
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-04-15 00:00:00 +01:00
18
+ date: 2012-07-12 00:00:00 +01:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency