pencil 0.2.0 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,30 @@
1
+ <% hosts, clusters = @dash.get_valid_hosts(@zoom) %>
2
+
3
+ <%= cluster_switcher %>
4
+ <%= graph_switcher %>
5
+ <%= graph_uplink %>
6
+ <br>
7
+ <br>
8
+ <%= clusters.sort.collect { |h| "<a href=\"##{h}\">#{h}</a>" }.join(" ") %>
9
+ <br>
10
+
11
+ <div class="graphsection" style="width:<%= @zoom.width(merge_opts) %>;">
12
+ <% graph_name = "#{@zoom.name} overview" %>
13
+ <span class="graphtitle"><%= graph_name %></span>
14
+ <div class="graph">
15
+ <img src="<%= @dash.render_global_graph(@zoom, :dynamic_url_opts => merge_opts) %>">
16
+ </div>
17
+ </div>
18
+
19
+ <% clusters.sort.each do |cluster| %>
20
+ <div class="graphsection" style="width:<%= @zoom.width(merge_opts) %>;">
21
+ <a name="<%= cluster %>">
22
+ <% graph_name = "#{@dash.name} / #{@zoom.name} / #{cluster}" %>
23
+ <% image_url, zoom_url = cluster_graph(@zoom, cluster, graph_name) %>
24
+ <span class="graphtitle"><%= graph_name %></span>
25
+ <span class="dashlinks">(<a href="<%= zoom_url %>">zoom</a>)</span>
26
+ <div class="graph">
27
+ <a href="<%= zoom_url %>"><img src="<%= image_url %>"></a>
28
+ </div>
29
+ </div>
30
+ <% end %>
@@ -0,0 +1,20 @@
1
+ <% clusters = @dash.clusters %>
2
+
3
+ <%= cluster_switcher %>
4
+ <%= dash_switcher %>
5
+ <%= dash_uplink %>
6
+ <br>
7
+ <br>
8
+ <%= @dash.graphs.collect { |g| "<a href=\"##{g.name}\">#{g.name}</a>" }.join(" ") %>
9
+
10
+ <% @dash.graphs.each do |g| %>
11
+ <div class="graphsection" style="width:<%= g.width(merge_opts) %>;">
12
+ <a name="<%= g.name %>">
13
+ <span class="graphtitle"><%= g.name %></span>
14
+ <span class="dashlinks"><%= suggest_cluster_links(clusters, g) %></span>
15
+ <div class="graph">
16
+ <% zoom_url = cluster_graph_link(@dash, g, "global") %>
17
+ <a href="<%= zoom_url %>"><img src="<%= @dash.render_global_graph(g, :dynamic_url_opts => merge_opts) %>"></a>
18
+ </div>
19
+ </div>
20
+ <% end %>
@@ -0,0 +1,31 @@
1
+ <h2>List of dashboards for <%= cluster_selector %></h2>
2
+
3
+ I feel like some graphs should go here
4
+
5
+ <% hosts = Host.all
6
+ boards = @dashboards
7
+ seen_hosts = Set.new %>
8
+
9
+ <% boards.each do |b| %>
10
+ <h2><a href="/dash/<%= "#{@cluster}/#{append_query_string(b.name)}" %>"><%= b.name %></a>
11
+ <% dash_hosts = b.get_all_hosts()[0]
12
+ seen_hosts += dash_hosts %>
13
+ <%= hosts_selector(dash_hosts) %>
14
+ </h2>
15
+ <%= b.graphs.collect do |g|
16
+ href = append_query_string("/dash/#{@cluster}/#{b.name}/#{g}")
17
+ "<li><a href=\"#{href}\">#{g}</a><br></li>"
18
+ end %>
19
+ <br>
20
+ <% end %>
21
+
22
+ <h3>clusters :: hosts</h3>
23
+ <% map = Hash.new([])
24
+ hosts.each { |h| map[h.cluster] = map[h.cluster] + [h] }
25
+ map.sort.each do |k, v| %>
26
+ <h3><a href="/dash/<%= append_query_string(k) %>"><%= k %></h3>
27
+ <%= v.sort.collect do |h|
28
+ href = append_query_string("/host/#{h.cluster}/#{h}")
29
+ "<li><a href=\"#{href}\">#{h}</a></li>"
30
+ end %>
31
+ <% end %>
@@ -0,0 +1,14 @@
1
+ <%= host_uplink %>
2
+ <br><br>
3
+ <%= @host.graphs.collect { |g| "<a href=\"##{g.name}\">#{g.name}</a>" }.join(" ") %>
4
+
5
+ <% @host.graphs.each do |g| %>
6
+ <div class="graphsection" style="width:<%= g.width(merge_opts) %>;">
7
+ <a name="<%= g.name %>">
8
+ <span class="graphtitle"><%= g.name %></span>
9
+ <span class="dashlinks"><%= suggest_dashboards_links(@host, g) %></span>
10
+ <div class="graph">
11
+ <img src="<%= g.render_url([@host.name], [@host.cluster], :title => "#{g.name} / #{@host.cluster} / #{@host.name}", :dynamic_url_opts => merge_opts) %>">
12
+ </div>
13
+ </div>
14
+ <% end %>
@@ -0,0 +1,55 @@
1
+ <html>
2
+ <head>
3
+ <%= css_url %>
4
+ <link href="/favicon.ico" rel="icon" type="text/x-icon">
5
+ <link href="/favicon.ico" rel="shortcut icon" type="text/x-icon">
6
+ <%= refresh %>
7
+ </head>
8
+ <body bgcolor="black">
9
+
10
+ <div id="wrap">
11
+ <div id="header">
12
+ <h2><%= @title %></h2>
13
+ <h3><%= range_string %></h3>
14
+ <%= permalink unless @no_graphs %>
15
+ </div>
16
+
17
+ <div id="nav">
18
+ <% if @cluster %>
19
+ <ul>
20
+ Global Views:
21
+ <li><a href="<%= cluster_link("global") %>">overview</a></li>
22
+ <br>
23
+ Cluster Views:
24
+ <br>
25
+ <% clusters = settings.config.clusters %>
26
+ <% clusters.sort.each do |cluster| %>
27
+ <li><a href="<%= cluster_link(cluster) %>"><%= cluster %></a></li>
28
+ <% end %>
29
+ <br>
30
+ Dashboards: (<%= @cluster %>)
31
+ <br>
32
+ <% @dashboards.sort.each do |dash| %>
33
+ <li><a href="<%= dash_link(dash, @cluster) %>"><%= dash["title"] %></a></li>
34
+ <% end %>
35
+ <br>
36
+ Jump to Host:
37
+ <br>
38
+ <%= hosts_selector(Host.all) %>
39
+ <br>
40
+ <br>
41
+ <%= input_boxes %>
42
+ <%= refresh_button %>
43
+ <div id="footer"> <%= cookies_form %></div>
44
+ </ul>
45
+ </div>
46
+ <% end %>
47
+
48
+ <div id="main">
49
+ <%= yield %>
50
+ </div>
51
+ </div>
52
+
53
+ </body>
54
+ <div id="footer" style="color:green;">generated <%= @request_time %></div>
55
+ </html>
@@ -0,0 +1,6 @@
1
+ <select class="select2" onchange="window.open(this.options[this.selectedIndex].value,'_top')">
2
+ <option value="/dash/<%= append_query_string(@cluster) %>" selected="selected"><%= @cluster %></option>
3
+ <% (@clusters - [@cluster]).each do |c| %>
4
+ <option value="/dash/<%= append_query_string(c) %>"><%= c %></option>
5
+ <% end %>
6
+ </select>
@@ -0,0 +1,12 @@
1
+ clusters:
2
+ <%= settings.config.clusters.sort.collect do |c|
3
+ sub = append_query_string(request.path.sub(@cluster, c))
4
+ @cluster == c ? "#{c}" : "<a href=\"#{sub}\">#{c}</a>"
5
+ end.join(" ") %>
6
+
7
+ <%= if @cluster == "global"
8
+ " (global)"
9
+ else
10
+ " <a href=\"#{append_query_string(request.path.sub(@cluster, 'global'))}\">(global)</a>"
11
+ end %>
12
+ <br>
@@ -0,0 +1,12 @@
1
+ <form action="/saveprefs" name="input" method="get">
2
+ <div class="invisible">
3
+ <% @prefs.each do |label, name| %>
4
+ <%= "<input value=\"#{params[name]}\" name=\"#{name}\"><br>" if params[name] %>
5
+ <% end %>
6
+ </div>
7
+ <input type="submit" value="save preferences in a cookie">
8
+ </form>
9
+
10
+ <form action="/clear" name="clear" method="get">
11
+ <input type="submit" value="clear cookies">
12
+ </form>
@@ -0,0 +1,8 @@
1
+ <span class="graphtitle">
2
+ dashboards:
3
+ <%= @dashboards.sort.collect do |d|
4
+ sub = append_query_string(request.path.sub(@dash.name, d.name))
5
+ @dash == d ? "#{d}" : "<a href=\"#{sub}\">#{d}</a>"
6
+ end.join(" ") %>
7
+ </span>
8
+ <br>
@@ -0,0 +1,8 @@
1
+ <span class="graphtitle">
2
+ graphs:
3
+ <%= @dash.graphs.map { |g| g.name }.collect do |g|
4
+ sub = append_query_string(request.path.sub(@zoom.name, g))
5
+ @zoom.name == g ? "#{g}" : "<a href=\"#{sub}\">#{g}</a>"
6
+ end.join(" ") %>
7
+ </span>
8
+ <br>
@@ -0,0 +1,7 @@
1
+ <select onchange="window.open(this.options[this.selectedIndex].value,'_top')">
2
+ <option value="">-select host-</option>
3
+ <% @hosts.sort.each do |h|
4
+ value = append_query_string("/host/#{h.cluster}/#{h}") %>
5
+ <option value="<%= value %>" <%= "selected=\"selected\"" if @host == h %>><%= h %></option>
6
+ <% end %>
7
+ </select>
@@ -0,0 +1,25 @@
1
+ <form name="input" method="get"><table style="font-size:small;">
2
+ <% @prefs.each do |label, name|
3
+ val = param_lookup(name) %>
4
+ <tr>
5
+ <td><%= label %>:</td>
6
+ <td><nobr><input <%= "value=\"#{val}\" " if val %>size="<%= name =~ /start|duration/ ? 10 : 4 %>" type="text" name="<%= name %>">
7
+ <% if name == "start" %>
8
+ <a href="http://chronic.rubyforge.org/" target="_blank">?</a>
9
+ <% elsif name == "duration" %>
10
+ <a href="https://github.com/hpoydar/chronic_duration" target="_blank">?</a>
11
+ <% end %></nobr>
12
+ <%= if name == "start"
13
+ "<div class=\"error\">Bad Time!</a>" unless \
14
+ Chronic.parse(param_lookup(name))
15
+ elsif name == "duration" && param_lookup(name)
16
+ "<div class=\"error\">Bad Interval!</a>" unless \
17
+ ChronicDuration.parse(param_lookup(name))
18
+ end %>
19
+ </td>
20
+ </tr>
21
+ <% end %>
22
+ </table> <input type="submit" value="Submit">
23
+ </form>
24
+
25
+ <form method="get"> <input type="submit" value="Clear"></form>
@@ -0,0 +1,8 @@
1
+ <form action="<%= request.path %>" name="input" method="get">
2
+ <input type="submit" value="Refresh">
3
+ <div class="invisible">
4
+ <% @prefs.each do |label, name| %>
5
+ <%= "<input value=\"#{params[name]}\" name=\"#{name}\"><br>" if params[name] %>
6
+ <% end %>
7
+ </div>
8
+ </form>
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pencil
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
4
+ hash: 19
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 0
10
- version: 0.2.0
9
+ - 2
10
+ version: 0.2.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Pete Fritchman
@@ -20,7 +20,7 @@ date: 2011-07-12 00:00:00 -07:00
20
20
  default_executable:
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
23
- name: rack
23
+ name: mongrel
24
24
  prerelease: false
25
25
  requirement: &id001 !ruby/object:Gem::Requirement
26
26
  none: false
@@ -34,7 +34,7 @@ dependencies:
34
34
  type: :runtime
35
35
  version_requirements: *id001
36
36
  - !ruby/object:Gem::Dependency
37
- name: sinatra
37
+ name: rack
38
38
  prerelease: false
39
39
  requirement: &id002 !ruby/object:Gem::Requirement
40
40
  none: false
@@ -48,7 +48,7 @@ dependencies:
48
48
  type: :runtime
49
49
  version_requirements: *id002
50
50
  - !ruby/object:Gem::Dependency
51
- name: json
51
+ name: sinatra
52
52
  prerelease: false
53
53
  requirement: &id003 !ruby/object:Gem::Requirement
54
54
  none: false
@@ -62,7 +62,7 @@ dependencies:
62
62
  type: :runtime
63
63
  version_requirements: *id003
64
64
  - !ruby/object:Gem::Dependency
65
- name: chronic
65
+ name: json
66
66
  prerelease: false
67
67
  requirement: &id004 !ruby/object:Gem::Requirement
68
68
  none: false
@@ -76,7 +76,7 @@ dependencies:
76
76
  type: :runtime
77
77
  version_requirements: *id004
78
78
  - !ruby/object:Gem::Dependency
79
- name: chronic_duration
79
+ name: chronic
80
80
  prerelease: false
81
81
  requirement: &id005 !ruby/object:Gem::Requirement
82
82
  none: false
@@ -89,6 +89,20 @@ dependencies:
89
89
  version: "0"
90
90
  type: :runtime
91
91
  version_requirements: *id005
92
+ - !ruby/object:Gem::Dependency
93
+ name: chronic_duration
94
+ prerelease: false
95
+ requirement: &id006 !ruby/object:Gem::Requirement
96
+ none: false
97
+ requirements:
98
+ - - ">="
99
+ - !ruby/object:Gem::Version
100
+ hash: 3
101
+ segments:
102
+ - 0
103
+ version: "0"
104
+ type: :runtime
105
+ version_requirements: *id006
92
106
  description: Graphite dashboard frontend
93
107
  email:
94
108
  - petef@databits.net
@@ -100,8 +114,37 @@ extensions: []
100
114
  extra_rdoc_files: []
101
115
 
102
116
  files:
103
- - examples/graphs.yml
117
+ - lib/models.rb
118
+ - lib/public/style.css
119
+ - lib/public/favicon.ico
120
+ - lib/config.rb
121
+ - lib/models/host.rb
122
+ - lib/models/graph.rb
123
+ - lib/models/dashboard.rb
124
+ - lib/models/base.rb
125
+ - lib/views/cluster.erb
126
+ - lib/views/global.erb
127
+ - lib/views/dash-cluster-zoom.erb
128
+ - lib/views/dash-global-zoom.erb
129
+ - lib/views/dash-global.erb
130
+ - lib/views/host.erb
131
+ - lib/views/partials/graph_switcher.erb
132
+ - lib/views/partials/hosts_selector.erb
133
+ - lib/views/partials/input_boxes.erb
134
+ - lib/views/partials/cluster_selector.erb
135
+ - lib/views/partials/cluster_switcher.erb
136
+ - lib/views/partials/dash_switcher.erb
137
+ - lib/views/partials/cookies_form.erb
138
+ - lib/views/partials/refresh_button.erb
139
+ - lib/views/layout.erb
140
+ - lib/views/dash-cluster.erb
141
+ - lib/namespace.rb
142
+ - lib/helpers.rb
143
+ - lib/dash.rb
144
+ - lib/config.ru
145
+ - docs/pencil_options.md
104
146
  - examples/pencil.yml
147
+ - examples/graphs.yml
105
148
  - examples/dashboards.yml
106
149
  - bin/pencil
107
150
  has_rdoc: true
@@ -113,7 +156,6 @@ rdoc_options: []
113
156
 
114
157
  require_paths:
115
158
  - lib
116
- - lib
117
159
  required_ruby_version: !ruby/object:Gem::Requirement
118
160
  none: false
119
161
  requirements: