mindreframer-riemann-dash 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. data/.gitignore +8 -0
  2. data/Gemfile +7 -0
  3. data/Gemfile.lock +52 -0
  4. data/LICENSE +21 -0
  5. data/README.markdown +52 -0
  6. data/Rakefile.rb +11 -0
  7. data/bin/riemann-dash +7 -0
  8. data/example/config.rb +17 -0
  9. data/lib/riemann/dash.rb +5 -0
  10. data/lib/riemann/dash/app.rb +32 -0
  11. data/lib/riemann/dash/config.rb +154 -0
  12. data/lib/riemann/dash/controller/css.rb +5 -0
  13. data/lib/riemann/dash/controller/index.rb +20 -0
  14. data/lib/riemann/dash/public/clock.js +45 -0
  15. data/lib/riemann/dash/public/dash.js +287 -0
  16. data/lib/riemann/dash/public/format.js +24 -0
  17. data/lib/riemann/dash/public/jquery-1.7.2.min.js +4 -0
  18. data/lib/riemann/dash/public/jquery-ui-1.9.0.custom.min.js +6 -0
  19. data/lib/riemann/dash/public/jquery.json-2.2.min.js +31 -0
  20. data/lib/riemann/dash/public/jquery.quickfit.js +144 -0
  21. data/lib/riemann/dash/public/jquery.simplemodal.1.4.3.min.js +26 -0
  22. data/lib/riemann/dash/public/keys.js +46 -0
  23. data/lib/riemann/dash/public/mustache.js +597 -0
  24. data/lib/riemann/dash/public/persistence.js +30 -0
  25. data/lib/riemann/dash/public/profile.js +33 -0
  26. data/lib/riemann/dash/public/subs.js +164 -0
  27. data/lib/riemann/dash/public/toastr.css +174 -0
  28. data/lib/riemann/dash/public/toastr.js +207 -0
  29. data/lib/riemann/dash/public/toolbar.js +217 -0
  30. data/lib/riemann/dash/public/underscore-min.js +5 -0
  31. data/lib/riemann/dash/public/util.js +34 -0
  32. data/lib/riemann/dash/public/vendor/smoothie.js +374 -0
  33. data/lib/riemann/dash/public/view.js +704 -0
  34. data/lib/riemann/dash/public/views/gauge.js +76 -0
  35. data/lib/riemann/dash/public/views/grid.js +279 -0
  36. data/lib/riemann/dash/public/views/help.js +28 -0
  37. data/lib/riemann/dash/public/views/timeseries.js +107 -0
  38. data/lib/riemann/dash/public/views/title.js +35 -0
  39. data/lib/riemann/dash/public/x.png +0 -0
  40. data/lib/riemann/dash/rack/static.rb +16 -0
  41. data/lib/riemann/dash/version.rb +4 -0
  42. data/lib/riemann/dash/views/css.scss +393 -0
  43. data/lib/riemann/dash/views/index.erubis +203 -0
  44. data/lib/riemann/dash/views/layout.erubis +21 -0
  45. data/riemann-dash.gemspec +28 -0
  46. data/sh/c +1 -0
  47. data/sh/env.rb +2 -0
  48. data/sh/test +1 -0
  49. data/test/config_test.rb +106 -0
  50. data/test/fixtures/config/basic_config.rb +2 -0
  51. data/test/fixtures/config/ws_config.rb +1 -0
  52. data/test/fixtures/ws_config/dummy_config.json +1 -0
  53. data/test/fixtures/ws_config/pretty_printed_config.json +6 -0
  54. data/test/test_helper.rb +10 -0
  55. metadata +202 -0
@@ -0,0 +1,35 @@
1
+ (function() {
2
+ var fitopts = {min: 6, max: 400};
3
+
4
+ var Title = function(json) {
5
+ view.View.call(this, json);
6
+ this.title = json.title;
7
+ this.clickFocusable = true;
8
+ this.el.addClass("title");
9
+ this.h2 = $('<h2/>');
10
+ this.el.append(this.h2);
11
+ this.h2.text(this.title);
12
+ this.reflow();
13
+ }
14
+
15
+ view.inherit(view.View, Title);
16
+ view.Title = Title;
17
+ view.types.Title = Title;
18
+
19
+ Title.prototype.json = function() {
20
+ return $.extend(view.View.prototype.json.call(this), {
21
+ type: 'Title',
22
+ title: this.title
23
+ });
24
+ }
25
+
26
+ Title.prototype.editForm = function() {
27
+ return Mustache.render('<label for="title">Title</label>' +
28
+ '<input type="title" name="title" value="{{title}}" />',
29
+ this);
30
+ }
31
+
32
+ Title.prototype.reflow = function() {
33
+ this.h2.quickfit(fitopts);
34
+ }
35
+ })();
Binary file
@@ -0,0 +1,16 @@
1
+ class Riemann::Dash::Static
2
+ def initialize(app, options = {})
3
+ @app = app
4
+ @root = options[:root] or raise ArgumentError, "no root"
5
+ @file_server = ::Rack::File.new(@root)
6
+ end
7
+
8
+ def call(env)
9
+ r = @app.call env
10
+ if r[0] < 200 or 400 <= r[0]
11
+ @file_server.call env
12
+ else
13
+ r
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,4 @@
1
+ module Riemann; end
2
+ module Riemann::Dash
3
+ VERSION = '0.2.3'
4
+ end
@@ -0,0 +1,393 @@
1
+ /* Colors! */
2
+ $bright-green: #2CFE40;
3
+ $dark-green: #059F00;
4
+ $fuschia: #FD47B7;
5
+ $purple: #7C2CFF;
6
+ $orange: #FF6513;
7
+ $amber: #FFC712;
8
+ $light-blue: #2CCCFE;
9
+ $blue: #2C55FF;
10
+ $dark-grey: #1F1F1F;
11
+ $light-grey: #ccc;
12
+ $off-white: #dedede;
13
+ $grey: #888;
14
+ $green: #06FA23;
15
+ $yellow: #FEF206;
16
+
17
+ @mixin vendor-prefix($name, $argument) {
18
+ #{$name}: $argument;
19
+ -webkit-#{$name}: $argument;
20
+ -ms-#{$name}: $argument;
21
+ -moz-#{$name}: $argument;
22
+ }
23
+
24
+ html {
25
+ height: 100%;
26
+ margin: 0;
27
+ padding: 0;
28
+ }
29
+
30
+ body {
31
+ overflow: hidden;
32
+ height: 100%;
33
+ margin: 0;
34
+ padding: 0;
35
+ background: #fff;
36
+ color: $dark-grey;
37
+ }
38
+
39
+ html,table {
40
+ font-family: "HelveticaNeue", "Helvetica Neue", "HelveticaNeueRoman", "HelveticaNeue-Roman", "Helvetica Neue Roman", 'TeXGyreHerosRegular', "Helvetica", "Tahoma", "Geneva", "Arial", sans-serif;
41
+ font-weight:400;
42
+ font-stretch:normal;
43
+ font-size: 14px;
44
+ }
45
+
46
+ #toolbar {
47
+ height: 28px;
48
+ overflow: hidden;
49
+ position: absolute;
50
+ top: 3px;
51
+ left: 3px;
52
+ right: 3px;
53
+ font-size: 12px;
54
+
55
+ input {
56
+ background: $off-white;
57
+ border: 1px solid $dark-grey;
58
+ margin: 3px;
59
+ padding: 3px 6px;
60
+ }
61
+ input:hover {
62
+ background: lighten($off-white, 5%);
63
+ }
64
+
65
+ .server {
66
+ float: right;
67
+ }
68
+
69
+ .load {
70
+ position: relative;
71
+ margin: 3px;
72
+ float: right;
73
+ width: 100px;
74
+ padding: 4px 6px 3px 6px;
75
+ border: 1px solid $dark-grey;
76
+ span {
77
+ z-index: -1;
78
+ }
79
+ .bar {
80
+ border-radius: 0;
81
+ background: rgba(0,0,0,0.25);
82
+ width: 1%;
83
+ }
84
+ }
85
+
86
+ .button {
87
+ display: inline-block;
88
+ margin: 3px;
89
+ padding: 3px 6px;
90
+ border: 1px solid $light-grey;
91
+ background: $off-white;
92
+ cursor: pointer;
93
+ }
94
+ .button:hover {
95
+ background: lighten($off-white, 5%);
96
+ }
97
+
98
+ .pager {
99
+ margin: 0;
100
+ padding: 0;
101
+ float: left;
102
+
103
+ ol {
104
+ display: inline-block;
105
+ list-style-type: none;
106
+ margin: 0;
107
+ padding: 0;
108
+ }
109
+
110
+ li {
111
+ .delete {
112
+ display: none;
113
+ }
114
+ }
115
+
116
+ li:hover {
117
+ background: lighten($off-white, 10%);
118
+ }
119
+
120
+ li.current {
121
+ border-color: $dark-grey;
122
+
123
+ .delete {
124
+ display: inline;
125
+ margin-left: 10px;
126
+ }
127
+ }
128
+ }
129
+ }
130
+
131
+ #view {
132
+ position: absolute;
133
+ left: 3px;
134
+ right: 3px;
135
+ top: 28px;
136
+ bottom: 3px;
137
+ }
138
+
139
+ .box {
140
+ position: absolute;
141
+ height: auto;
142
+ width: auto;
143
+ top: 0;
144
+ bottom: 0;
145
+ left: 0;
146
+ right: 0;
147
+ margin: 3px;
148
+ padding: 3px;
149
+ background: $light-grey;
150
+ border-radius: 3px;
151
+ }
152
+
153
+ .bar {
154
+ position: absolute;
155
+ left: 0;
156
+ top: 0;
157
+ bottom: 0;
158
+ height: 100%;
159
+ background: rgba(0, 0, 0, 0.2);
160
+ border-radius: 3px;
161
+ }
162
+
163
+ .state {
164
+ @include vendor-prefix(transition, all 0.3s linear);
165
+ }
166
+
167
+ .state.ok, .state.okay, .bar.ok, .bar.okay {
168
+ background: $green;
169
+ color: #000;
170
+ }
171
+ .state.warning, .bar.warning {
172
+ background: $amber;
173
+ color: #000;
174
+ }
175
+ .state.critical, .state.failure, .bar.critical, .bar.failure {
176
+ background: $orange;
177
+ color: #000;
178
+ }
179
+
180
+ .view .query {
181
+ display: block;
182
+ position: absolute;
183
+ top: 0;
184
+ left: 0;
185
+ right: 0;
186
+ height: 16px;
187
+ margin: 0;
188
+ }
189
+
190
+ .scroll {
191
+ overflow-x: hidden;
192
+ overflow-y: scroll;
193
+ }
194
+
195
+ .log-table .scroll {
196
+ position: absolute;
197
+ top: 26px;
198
+ left: 0;
199
+ right: 0;
200
+ bottom: 0;
201
+ }
202
+
203
+ .log-table table {
204
+ width: 100%;
205
+ border-collapse: collapse;
206
+ }
207
+
208
+ .log-table thead {
209
+ text-align: left;
210
+ }
211
+
212
+ .log-table tbody {
213
+ }
214
+
215
+ .log-table td {
216
+ border-bottom: 1px solid #eee;
217
+ vertical-align: top;
218
+ padding: 3px;
219
+ white-space: pre;
220
+ }
221
+ .log-table td .bar {
222
+ margin: -3px;
223
+ padding: 3px;
224
+ }
225
+
226
+ .chart {
227
+ width: 140px;
228
+ border: 1px solid #ccc;
229
+ }
230
+ .chart td {
231
+ min-width: 40px;
232
+ overflow: hidden;
233
+ }
234
+ .chart th {
235
+ width: 1px;
236
+ text-align: left;
237
+ }
238
+
239
+ .timeSeries rect {
240
+ fill: #CA0000;
241
+ stroke: white;
242
+ }
243
+
244
+ #layout {
245
+ position: relative;
246
+ }
247
+
248
+ .view {
249
+ margin: 0;
250
+ padding: 0;
251
+ position: absolute;
252
+ top: 0;
253
+ left: 0;
254
+ height: 0;
255
+ width: 0;
256
+ overflow: hidden;
257
+ }
258
+
259
+ .focusOverlay {
260
+ position: absolute;
261
+ z-index: 1000;
262
+ border-radius: 5px;
263
+ background: rgba(0,0,0,0.5);
264
+ }
265
+
266
+ #simplemodal-overlay {
267
+ background-color:#000;
268
+ }
269
+ #simplemodal-container {
270
+ background-color:#fff;
271
+ color: #000;
272
+ padding:12px;
273
+ border-radius: 4px;
274
+ min-width: 400px;
275
+ min-height: 400px;
276
+ }
277
+ #simplemodal-container a.modalCloseImg {
278
+ background:url(/x.png) no-repeat; /* adjust url as required */
279
+ width:25px;
280
+ height:29px;
281
+ display:inline;
282
+ z-index:3200;
283
+ position:absolute;
284
+ top:-10px;
285
+ right:-10px;
286
+ cursor:pointer;
287
+ }
288
+
289
+ textarea.query {
290
+ width: 100%;
291
+ height: 100px;
292
+ }
293
+
294
+ .quickfit {
295
+ display: block;
296
+ white-space: nowrap;
297
+ width: 100%;
298
+ }
299
+
300
+ h2 {
301
+ display: block;
302
+ padding: 3px;
303
+ margin: 0;
304
+ }
305
+
306
+ .metric {
307
+ font-weight: bolder;
308
+ text-align: right;
309
+ }
310
+
311
+ .title h2 {
312
+ position: absolute;
313
+ left: 3px;
314
+ right: 3px;
315
+ top: 3px;
316
+ bottom: 3px;
317
+ }
318
+
319
+ .gauge {
320
+ h2 {
321
+ position: absolute;
322
+ height: 25%;
323
+ width: 75%;
324
+ bottom: 3px;
325
+ right: 3px;
326
+ text-align: right;
327
+ }
328
+
329
+ .value {
330
+ position: absolute;
331
+ height: 75%;
332
+ top: 0;
333
+ right: 0;
334
+ width: 100%;
335
+ text-align: right;
336
+ }
337
+ }
338
+
339
+ .grid {
340
+ h2 {
341
+ height: 28px;
342
+ font-size: 24px;
343
+ }
344
+
345
+ .container {
346
+ position: absolute;
347
+ top: 28px;
348
+ left: 0;
349
+ right: 0;
350
+ bottom: 0;
351
+ }
352
+
353
+ .bar {
354
+ position: static;
355
+ display: block;
356
+ height: 100%;
357
+ }
358
+
359
+ .box {
360
+ margin: 0;
361
+ padding: 0;
362
+ position: static;
363
+
364
+ .metric {
365
+ padding: 3px;
366
+ font-weight: normal;
367
+ }
368
+ }
369
+
370
+ table {
371
+ font-size: 12px;
372
+ position: absolute;
373
+ width: 100%;
374
+ border-spacing: 3px;
375
+
376
+ thead {
377
+ margin: 0;
378
+ padding: 0;
379
+
380
+ th {
381
+ // Work around https://bugs.webkit.org/show_bug.cgi?id=20040
382
+ position: relative;
383
+ top: 3px;
384
+ vertical-align: bottom;
385
+ text-align: right;
386
+ }
387
+ }
388
+ }
389
+
390
+ tr > *:first-child {
391
+ width: 1px;
392
+ }
393
+ }