casseo 0.1.4 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/casseo/dashboard.rb +15 -5
- data/lib/casseo/version.rb +1 -1
- metadata +1 -1
data/lib/casseo/dashboard.rb
CHANGED
@@ -239,15 +239,25 @@ module Casseo
|
|
239
239
|
Curses.refresh
|
240
240
|
end
|
241
241
|
|
242
|
+
def format_period(seconds)
|
243
|
+
case true
|
244
|
+
when seconds < 60 then "#{seconds}s"
|
245
|
+
when seconds < 3600 then "#{seconds / 60}m"
|
246
|
+
when seconds < 86400 then "#{seconds / 3600}h"
|
247
|
+
else "#{seconds / 86400}d"
|
248
|
+
end
|
249
|
+
end
|
250
|
+
|
242
251
|
def show_status
|
243
252
|
Curses.setpos(num_lines, 0)
|
244
253
|
Curses.attron(Curses::color_pair(STATUS) | Curses::A_NORMAL) do
|
245
|
-
str = "Casseo:
|
246
|
-
|
247
|
-
|
254
|
+
str = "Casseo: =%s (%s) [Metrics:%s Interval:%ss]" %
|
255
|
+
[@name, format_period(@period * 60), @num_metrics, Config.interval.to_i]
|
256
|
+
page_str = "--- %s/%s ---" % [@page, num_pages]
|
257
|
+
|
258
|
+
# right align the page number
|
259
|
+
str += "%#{Curses.cols - str.length}s" % page_str
|
248
260
|
|
249
|
-
# pad until the end of the line so we get the background
|
250
|
-
str += " " * (Curses.cols - str.length)
|
251
261
|
Curses.addstr(str)
|
252
262
|
end
|
253
263
|
end
|
data/lib/casseo/version.rb
CHANGED