casseo 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  Casseo
2
2
  ======
3
3
 
4
- A Graphite dashboard viewable without ever leaving the command line. Configuration and concept very similar to [Tasseo](tasseo).
4
+ A Graphite dashboard viewable without ever leaving the command line. Configuration and concept very similar to [Tasseo](https://github.com/obfuscurity/tasseo).
5
5
 
6
6
  Install via Rubygems:
7
7
 
@@ -24,7 +24,7 @@ Casseo expects to be able to find your Graphite credentials at `~/.casseorc`:
24
24
 
25
25
  Other allowed configuration options are:
26
26
 
27
- * `compressed_chart:` whether to include a space between chart symbols (default: false)
27
+ * `compressed_chart:` whether to include a space between chart symbols (default: false); see also `c` shortcut
28
28
  * `dashboard_default:` name of the dashboard to load if none is specified (default: home)
29
29
  * `decimal_precision:` floating point precision to show (default: 1); see also `p` shortcut
30
30
  * `interval:` Graphite update interval in seconds (default: 2)
@@ -67,9 +67,10 @@ Key Bindings
67
67
 
68
68
  For now, there are no options on key bindings. Here's what you get:
69
69
 
70
+ * `c` toggle compressed chart
70
71
  * `j` page down
71
72
  * `k` page up
72
- * `m` show/hide max value column
73
+ * `m` toggle max value column
73
74
  * `p` show more floating point precision
74
75
  * `q` quit
75
76
  * `1` 5 minute range
@@ -77,5 +78,3 @@ For now, there are no options on key bindings. Here's what you get:
77
78
  * `3` 3 hour range
78
79
  * `4` 24 hour range
79
80
  * `5` 7 day range
80
-
81
- [tasseo]: https://github.com/obfuscurity/tasseo
@@ -8,6 +8,7 @@ module Casseo
8
8
 
9
9
  def initialize
10
10
  @confs = []
11
+ @compressed_chart = Config.compressed_chart
11
12
  @data = nil
12
13
  @decimal_precision = Config.decimal_precision
13
14
  @page = 0
@@ -86,6 +87,7 @@ module Casseo
86
87
 
87
88
  def handle_key_presses
88
89
  loop do
90
+ new_compressed_chart = nil
89
91
  new_decimal_precision = nil
90
92
  new_page = nil
91
93
  new_period = nil
@@ -93,6 +95,7 @@ module Casseo
93
95
 
94
96
  case Curses.getch
95
97
  when Curses::KEY_RESIZE then show
98
+ when ?c then new_compressed_chart = !@compressed_chart
96
99
  when ?j then new_page = clamp(@page + 1, 0, num_pages)
97
100
  when ?k then new_page = clamp(@page - 1, 0, num_pages)
98
101
  when ?m then new_show_max = !@show_max
@@ -106,6 +109,12 @@ module Casseo
106
109
  when ?5 then new_period = 60 * 24 * 7
107
110
  end
108
111
 
112
+ if new_compressed_chart != nil
113
+ @compressed_chart = new_compressed_chart
114
+ Curses.clear
115
+ show
116
+ end
117
+
109
118
  if new_page && new_page != @page
110
119
  @page = new_page
111
120
  Curses.clear
@@ -173,14 +182,14 @@ module Casseo
173
182
  if max && max > 0
174
183
  num_samples = Curses.cols - str.length
175
184
  (1..num_samples).each do |i|
176
- next if i % 2 == 0 unless Config.compressed_chart
185
+ next if i % 2 == 0 unless @compressed_chart
177
186
  index = ((i.to_f / num_samples.to_f) * data_points.count.to_f).to_i - 1
178
187
  sample = data_points[index][0]
179
188
  sample = 0.0 unless sample
180
189
 
181
190
  index = (sample / max * CHART_CHARS.count).to_i - 1
182
191
  chart += CHART_CHARS[index]
183
- chart += " " unless Config.compressed_chart
192
+ chart += " " unless @compressed_chart
184
193
  end
185
194
  end
186
195
 
@@ -1,3 +1,3 @@
1
1
  module Casseo
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: casseo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: