elasticsearch-paramedic-rack 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (34) hide show
  1. data/.gitignore +17 -0
  2. data/.travis.yml +9 -0
  3. data/Gemfile +4 -0
  4. data/LICENSE.txt +22 -0
  5. data/README.md +38 -0
  6. data/Rakefile +24 -0
  7. data/elasticsearch-paramedic-rack.gemspec +24 -0
  8. data/lib/elasticsearch-paramedic-rack.rb +10 -0
  9. data/lib/elasticsearch-paramedic-rack/middelware.rb +23 -0
  10. data/lib/elasticsearch-paramedic-rack/version.rb +7 -0
  11. data/public/elasticsearch-paramedic/audio/alert-green.mp3 +0 -0
  12. data/public/elasticsearch-paramedic/audio/alert-red.mp3 +0 -0
  13. data/public/elasticsearch-paramedic/audio/alert-yellow.mp3 +0 -0
  14. data/public/elasticsearch-paramedic/css/app.css +312 -0
  15. data/public/elasticsearch-paramedic/css/libs/cubism.css +57 -0
  16. data/public/elasticsearch-paramedic/css/libs/style.css +499 -0
  17. data/public/elasticsearch-paramedic/img/apple-touch-icon.png +0 -0
  18. data/public/elasticsearch-paramedic/img/glyphicons-halflings-white.png +0 -0
  19. data/public/elasticsearch-paramedic/img/glyphicons-halflings.png +0 -0
  20. data/public/elasticsearch-paramedic/img/spinner.gif +0 -0
  21. data/public/elasticsearch-paramedic/index.html +196 -0
  22. data/public/elasticsearch-paramedic/js/app.js +474 -0
  23. data/public/elasticsearch-paramedic/js/cubism.js +109 -0
  24. data/public/elasticsearch-paramedic/js/libs/colorbrewer.min.js +1 -0
  25. data/public/elasticsearch-paramedic/js/libs/cubism.elasticsearch.js +273 -0
  26. data/public/elasticsearch-paramedic/js/libs/cubism.v1.js +986 -0
  27. data/public/elasticsearch-paramedic/js/libs/cubism.v1.min.js +1 -0
  28. data/public/elasticsearch-paramedic/js/libs/d3.v2.min.js +4 -0
  29. data/public/elasticsearch-paramedic/js/libs/ember-0.9.8.js +20150 -0
  30. data/public/elasticsearch-paramedic/js/libs/ember-0.9.8.min.js +14 -0
  31. data/public/elasticsearch-paramedic/js/libs/jquery-1.7.2.min.js +4 -0
  32. data/test/middelware_test.rb +63 -0
  33. data/test/test_helper.rb +12 -0
  34. metadata +134 -0
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/.travis.yml ADDED
@@ -0,0 +1,9 @@
1
+ language: ruby
2
+ rvm:
3
+ - ree
4
+ - 1.8.7
5
+ - 1.9.2
6
+ - 1.9.3
7
+ - ruby-head
8
+ - rbx-19mode
9
+ - jruby-19mode
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in elasticsearch-paramedic-rack.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Timo Schilling
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,38 @@
1
+ # Elasticsearch::Paramedic::Rack
2
+
3
+ A gemed version of [elasticsearch-paramedic](https://github.com/karmi/elasticsearch-paramedic) with Rack support.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'elasticsearch-paramedic-rack'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install elasticsearch-paramedic-rack
18
+
19
+ ## Usage
20
+
21
+ use Elasticsearch::Paramedic::Rack
22
+
23
+ ## Todo's
24
+
25
+ * Authlogic
26
+ * Tests
27
+ * Rails integration
28
+ * Usage
29
+ * Configuration
30
+ * Support other Rubies
31
+
32
+ ## Contributing
33
+
34
+ 1. Fork it
35
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
36
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
37
+ 4. Push to the branch (`git push origin my-new-feature`)
38
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,24 @@
1
+ require "bundler/gem_tasks"
2
+ require "rake/testtask"
3
+
4
+ desc "Import new elasticsearch-paramedic version"
5
+ task :import do
6
+ [
7
+ "rm -rf public/elasticsearch-paramedic",
8
+ "git clone https://github.com/karmi/elasticsearch-paramedic.git public/elasticsearch-paramedic",
9
+ "cd public/elasticsearch-paramedic && rm -rf .git* elasticsearch-paramedic-screenshot.png MIT-LICENSE Rakefile README.md",
10
+ "git add public/elasticsearch-paramedic && git commit -m 'update elasticsearch-paramedic'"
11
+ ].each do |command|
12
+ puts command
13
+ `#{command}`
14
+ end
15
+ end
16
+
17
+ Rake::TestTask.new do |t|
18
+ t.libs << "lib"
19
+ t.test_files = FileList["test/*_test.rb"]
20
+ t.ruby_opts = ["-r./test/test_helper.rb"]
21
+ t.verbose = true
22
+ end
23
+
24
+ task :default => :test
@@ -0,0 +1,24 @@
1
+ # -*- encoding: utf-8 -*-
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'elasticsearch-paramedic-rack/version'
5
+
6
+ Gem::Specification.new do |gem|
7
+ gem.name = "elasticsearch-paramedic-rack"
8
+ gem.version = Elasticsearch::Paramedic::Rack::VERSION
9
+ gem.authors = ["Timo Schilling"]
10
+ gem.email = ["timo@schilling.io"]
11
+ gem.description = %q{A gemed version of elasticsearch-paramedic with Rack support.}
12
+ gem.summary = %q{A gemed version of elasticsearch-paramedic with Rack support.}
13
+ gem.homepage = "https://github.com/timoschilling/elasticsearch-paramedic-rack"
14
+
15
+ gem.files = `git ls-files`.split($/)
16
+ gem.executables = gem.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
18
+ gem.require_paths = ["lib"]
19
+
20
+ gem.add_dependency "rack"
21
+
22
+ gem.add_development_dependency "rake"
23
+ gem.add_development_dependency "minitest", "~> 3.0"
24
+ end
@@ -0,0 +1,10 @@
1
+ require "elasticsearch-paramedic-rack/version"
2
+ require "elasticsearch-paramedic-rack/middelware"
3
+
4
+ module Elasticsearch
5
+ module Paramedic
6
+ module Rack
7
+ ROOT = File.expand_path("../../public", __FILE__)
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,23 @@
1
+ require "rack/static"
2
+
3
+ module Elasticsearch
4
+ module Paramedic
5
+ module Rack
6
+ class Middelware < ::Rack::Static
7
+ def initialize app
8
+ super app, :root => Elasticsearch::Paramedic::Rack::ROOT, :urls => ["/elasticsearch-paramedic"]
9
+ end
10
+
11
+ def call env
12
+ if env["PATH_INFO"] =~ %r"^/elasticsearch-paramedic$"
13
+ return [302, {"Location" => "/elasticsearch-paramedic/", "Content-Type" => "text/plain"}, []]
14
+ elsif env["PATH_INFO"] == "/elasticsearch-paramedic/"
15
+ env["PATH_INFO"] = "/elasticsearch-paramedic/index.html"
16
+ end
17
+
18
+ super
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,7 @@
1
+ module Elasticsearch
2
+ module Paramedic
3
+ module Rack
4
+ VERSION = "0.1.0"
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,312 @@
1
+ /* Common */
2
+
3
+ body
4
+ { font-family: 'Helvetica Neue', Helvetica, sans-serif;
5
+ margin: 2em; }
6
+
7
+ h2.label
8
+ { color: #b2b2b2; font-size: 12px; font-weight: 300; text-transform: uppercase; border-bottom: 1px solid #e0e0e0; }
9
+
10
+ span.label
11
+ { color: #b2b2b2; font-size: 12px; font-weight: 300; text-transform: uppercase; padding: 0; margin: 0; }
12
+
13
+ .dimmed, .dimmed *
14
+ { color: #b2b2b2; }
15
+
16
+ .loading
17
+ { color: #999;
18
+ font-size: 90%;
19
+ background: transparent url('../img/spinner.gif') no-repeat 0 50%;
20
+ padding: 0 0 0 21px; }
21
+
22
+ /* Header */
23
+ header
24
+ { margin: 0 0 1.5em 0;
25
+ padding: 0; }
26
+ header h1
27
+ { font-size: 28px;
28
+ padding: 0;
29
+ margin: -0.25em 0 0.1em 0; }
30
+
31
+ header section
32
+ { width: 15em;
33
+ float: left; }
34
+
35
+ header section.cluster_name
36
+ { width: 40em; }
37
+ header section.endpoint
38
+ { width: 30em; }
39
+
40
+ header section #elasticsearch_url
41
+ { font: bolder 13px 'Helvetica Neue', Helvetica, sans-serif;
42
+ border: none;
43
+ border-bottom: 1px dotted #ccc;
44
+ width: 30em;}
45
+
46
+ header section p.refresh
47
+ { display: inline-block; }
48
+
49
+ header section p.refresh .refresh-label
50
+ { color: #999;
51
+ margin-top: 0.5em;
52
+ display: inline-block; }
53
+ header section p.refresh:hover .refresh-label
54
+ { color: #666; }
55
+
56
+ header section p.refresh .refresh-controls
57
+ { color: #999;
58
+ position: relative;
59
+ top: -0.15em;
60
+ display: inline-block; }
61
+ header section p.refresh .refresh-controls button,
62
+ header section p.refresh .refresh-controls select
63
+ { color: #999;
64
+ -webkit-text-fill-color: #999; }
65
+ header section p.refresh:hover .refresh-controls button,
66
+ header section p.refresh:hover .refresh-controls select
67
+ { color: #333;
68
+ -webkit-text-fill-color: #333; }
69
+
70
+ header section p.alerts
71
+ { margin: 0 0 0 1em;
72
+ display: inline-block; }
73
+
74
+ header section p.alerts input
75
+ { position: relative;
76
+ top: -0.2em; }
77
+
78
+ header section p.alerts label
79
+ { color: #d0d0d0;
80
+ font-size: 90%; }
81
+
82
+ header section.endpoint .icon-refresh
83
+ { position: relative;
84
+ width: 14px;
85
+ height: 14px;
86
+ opacity: 0.2; }
87
+
88
+ header section.endpoint.polling-active .icon-refresh
89
+ { opacity: 0.4; }
90
+
91
+ header section.endpoint.polling-in-progress .icon-refresh
92
+ { opacity: 0.5;
93
+ -webkit-animation-name: rotateRefreshIcon;
94
+ -webkit-animation-duration:1s;
95
+ -webkit-animation-iteration-count:infinite;
96
+ -webkit-animation-timing-function:linear; }
97
+
98
+ @-webkit-keyframes rotateRefreshIcon
99
+ { from {-webkit-transform: rotate(0deg);}
100
+ to {-webkit-transform: rotate(360deg);} }
101
+
102
+ header section .status
103
+ { background: #f5f5f5;
104
+ font-weight: bolder;
105
+ font-size: 12px;
106
+ letter-spacing: -1px;
107
+ text-transform: uppercase;
108
+ padding: 0.25em 0.5em 0.25em 0.45em;
109
+ border-radius: 0.25em; }
110
+ header section .status.green
111
+ { color: #fff;
112
+ background: #97f218; }
113
+ header section .status.yellow
114
+ { color: #fff;
115
+ background: #f2bc18; }
116
+ header section .status.red
117
+ { color: #fff;
118
+ background: #f2184f; }
119
+
120
+ header section .label.darker
121
+ { color: #333; }
122
+
123
+ /* Nodes */
124
+
125
+ #nodes .node
126
+ { margin: 0.25em 0.5em 0.25em 0;
127
+ padding: 0.25em 0.5em 0.25em 0;
128
+ float: left; }
129
+
130
+ #nodes .node h3
131
+ { color: #444;
132
+ font-size: 16px; }
133
+
134
+ #nodes .node .meta
135
+ { color: #333;
136
+ border-right: 1px solid #f5f5f5;
137
+ padding-right: 0.5em; }
138
+
139
+ /* Indices */
140
+
141
+ #indices
142
+ { counter-reset: index; }
143
+
144
+ #indices .index
145
+ { border-bottom: 1px solid #999;
146
+ clear: both; }
147
+
148
+ #indices .index.close,
149
+ #indices .index.close a
150
+ { color: #999 !important; }
151
+
152
+ #indices .index .basic-info
153
+ { padding: 0.5em 0 0.5em 0; }
154
+
155
+ #indices .index:hover .basic-info
156
+ { background-color: #fafafa; }
157
+
158
+ #indices .index .basic-info h3
159
+ { min-width: 15em;
160
+ counter-increment: index; }
161
+ #indices .index .basic-info h3:before
162
+ { content: counter(index) ". ";
163
+ color: #999;
164
+ font-weight: normal;
165
+ font-size: 11px; }
166
+
167
+ #indices .index:hover .basic-info h3,
168
+ #indices .index.expanded .basic-info h3
169
+ { text-shadow: #fff 0px 1px 0px; }
170
+
171
+ #indices .index .basic-info h3 a
172
+ { color: #444;
173
+ text-decoration: none; }
174
+ #indices .index:hover .basic-info h3 a
175
+ { text-decoration: underline; }
176
+
177
+ #indices .index .basic-info .buttons
178
+ { margin-right: 1em;
179
+ visibility: hidden; }
180
+ #indices .index:hover .basic-info .buttons,
181
+ #indices .index.expanded .basic-info.buttons
182
+ { visibility: visible; }
183
+
184
+
185
+ #indices .index .basic-info .meta
186
+ { color: #999;
187
+ float: right; }
188
+ #indices .index.close .basic-info .meta
189
+ { color: #999; }
190
+ #indices .index:hover .basic-info .meta
191
+ { color: #666; }
192
+ #indices .index.close:hover .basic-info .meta
193
+ { color: #999; }
194
+
195
+ #indices .index h3
196
+ { font-size: 14px;
197
+ margin-right: 0.5em;
198
+ float: left; }
199
+
200
+ #indices .index h3 small
201
+ { font-weight: normal; }
202
+
203
+ #indices .index .shards
204
+ { float: left; }
205
+
206
+ #indices .index .shards .shard
207
+ { margin: -0.25em 0.25em 0 0; }
208
+
209
+ #indices .index .buttons
210
+ { float: left; }
211
+
212
+ /* Index extra info */
213
+
214
+ #indices .index .extra-info
215
+ { /*display: none;*/
216
+ border-top: 1px solid #e0e0e0;
217
+ width: 100%; }
218
+
219
+ #indices .index .extra-info .loading
220
+ { margin: 0.5em 0 0.5em 0; }
221
+
222
+ /* Shards */
223
+
224
+ .index .shards .shard
225
+ { background: #ccc;
226
+ border-radius: 3px;
227
+ float: left;
228
+ padding: 0.25em;
229
+ margin: 0.25em 0.25em 0.25em 0; }
230
+
231
+ .index .shard.primary
232
+ { background: #62b9f3; }
233
+
234
+ .index .shard.STARTED
235
+ { background: #bbf866; }
236
+ .index .shard.UNASSIGNED
237
+ { background: #ffea3f; }
238
+
239
+ .index .shard.primary.STARTED
240
+ { background: #62b9f3; }
241
+ .index .shard.primary.UNASSIGNED
242
+ { color: #fff;
243
+ background: #d72e59; }
244
+
245
+ .index .shard h3
246
+ { color: #444 !important; }
247
+
248
+ /* Node Shard Allocation */
249
+
250
+ #indices .extra-info .node
251
+ { background: #f9f9f9;
252
+ border-radius: 5px;
253
+ padding: 0.5em;
254
+ margin: 0.45em 0.25em 0.45em 0;
255
+ float: left; }
256
+
257
+ #indices .extra-info .node h3
258
+ { color: #666;
259
+ font-size: 14px;
260
+ margin-bottom: 0.45em;
261
+ float: none;
262
+ clear: both; }
263
+ #indices .extra-info .node h3 small
264
+ { color: #999; }
265
+
266
+ #indices .extra-info .node .shard
267
+ { border-radius: 5px;
268
+ margin-bottom: 0.5em !important;
269
+ width: 11em;
270
+ height: 4em; }
271
+
272
+ #indices .extra-info .node .shard h3
273
+ { font-size: 42px;
274
+ margin: 0;
275
+ float: left; }
276
+ #indices .extra-info .node .shard .meta
277
+ { margin: 0.75em 0 0 2.25em; }
278
+
279
+ /* Cubism */
280
+
281
+ #cubism
282
+ { font-weight: 300;
283
+ margin: 0 0 1em 0; }
284
+ #cubism h2 a
285
+ { color: #999;
286
+ text-transform: none;
287
+ float: right; }
288
+ #cubism h2 a:hover
289
+ { color: #666;
290
+ border-bottom: 1px solid #666;
291
+ cursor: pointer; }
292
+ #cubism .horizon:hover
293
+ { background-color: #fafafa; }
294
+ #cubism .horizon:hover .title
295
+ { opacity: 0.99; }
296
+ #cubism:hover .axis text { fill: #333; }
297
+ #cubism .axis { border-color: #999 !important; }
298
+ #cubism .axis path, #cubism .axis line { stroke: #999; }
299
+ #cubism .axis text { fill: #999; }
300
+ #cubism .horizon
301
+ { border-color: #999; }
302
+ #cubism .horizon .title,
303
+ #cubism .horizon .value
304
+ { font-size: 12px;
305
+ top: -2px;
306
+ text-shadow: rgba(255, 255, 255, 0.9) 0.1em 0.1em 0.09em !important; }
307
+ #cubism .horizon .title
308
+ { font-weight: normal;
309
+ opacity: 0.9;
310
+ margin-left: 0; }
311
+ #cubism .horizon .value
312
+ { font-weight: bolder; }