torquebox-backstage 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (65) hide show
  1. data/Gemfile +18 -0
  2. data/Gemfile.lock +69 -0
  3. data/README.md +164 -0
  4. data/Rakefile +32 -0
  5. data/TODO +9 -0
  6. data/TORQUEBOX_VERSION +1 -0
  7. data/VERSION +1 -0
  8. data/backstage.rb +84 -0
  9. data/bin/backstage +78 -0
  10. data/config.ru +3 -0
  11. data/config/torquebox.yml +14 -0
  12. data/lib/apps.rb +18 -0
  13. data/lib/apps/models/app.rb +33 -0
  14. data/lib/apps/routes.rb +18 -0
  15. data/lib/authentication.rb +64 -0
  16. data/lib/destinations.rb +21 -0
  17. data/lib/destinations/models/destination.rb +80 -0
  18. data/lib/destinations/models/message.rb +67 -0
  19. data/lib/destinations/models/queue.rb +33 -0
  20. data/lib/destinations/models/topic.rb +59 -0
  21. data/lib/destinations/routes.rb +44 -0
  22. data/lib/has_mbean.rb +59 -0
  23. data/lib/helpers.rb +142 -0
  24. data/lib/jobs.rb +19 -0
  25. data/lib/jobs/models/job.rb +35 -0
  26. data/lib/jobs/routes.rb +18 -0
  27. data/lib/message_processors.rb +18 -0
  28. data/lib/message_processors/models/message_processor.rb +40 -0
  29. data/lib/message_processors/routes.rb +18 -0
  30. data/lib/pools.rb +18 -0
  31. data/lib/pools/models/pool.rb +51 -0
  32. data/lib/pools/routes.rb +41 -0
  33. data/lib/resource.rb +53 -0
  34. data/lib/resource_helpers.rb +63 -0
  35. data/lib/runtimes.rb +19 -0
  36. data/lib/runtimes/models/job.rb +35 -0
  37. data/lib/runtimes/routes.rb +18 -0
  38. data/lib/services.rb +18 -0
  39. data/lib/services/models/service.rb +35 -0
  40. data/lib/services/routes.rb +17 -0
  41. data/lib/torquebox_managed.rb +36 -0
  42. data/lib/util.rb +33 -0
  43. data/spec/api_spec.rb +136 -0
  44. data/spec/auth_spec.rb +70 -0
  45. data/spec/spec_helper.rb +39 -0
  46. data/views/apps/index.haml +15 -0
  47. data/views/apps/show.haml +12 -0
  48. data/views/css/_mixins.sass +51 -0
  49. data/views/css/html5reset.sass +82 -0
  50. data/views/css/style.sass +152 -0
  51. data/views/destinations/index.haml +37 -0
  52. data/views/destinations/show.haml +18 -0
  53. data/views/jobs/index.haml +23 -0
  54. data/views/jobs/show.haml +13 -0
  55. data/views/layout.haml +31 -0
  56. data/views/message_processors/index.haml +28 -0
  57. data/views/message_processors/show.haml +12 -0
  58. data/views/messages/index.haml +20 -0
  59. data/views/messages/properties.haml +3 -0
  60. data/views/messages/show.haml +19 -0
  61. data/views/pools/index.haml +32 -0
  62. data/views/pools/show.haml +44 -0
  63. data/views/services/index.haml +21 -0
  64. data/views/services/show.haml +13 -0
  65. metadata +289 -0
@@ -0,0 +1,18 @@
1
+ #destinations-show
2
+ %h2
3
+ == #{simple_class_name( @object ).capitalize}: #{@object.display_name}
4
+ .actions
5
+ = link_to collection_path(@object, :messages), 'View Messages' unless @object.is_a?(Backstage::Topic)
6
+ = @object.status == 'Running' ? action_button( @object, 'pause' ) : action_button( @object, 'resume' )
7
+ %table.data-table
8
+ = data_row( "Name", @object.display_name )
9
+ = data_row( "JNDI Address", @object.jndi_name )
10
+ = data_row( "Dead Letter Address", ::Backstage::Destination.display_name( @object.dead_letter_address ) )
11
+ = data_row( "Expiry Address", ::Backstage::Destination.display_name( @object.expiry_address ) )
12
+ = data_row( "App", @object.app_name )
13
+ - %w{ status consumer_count message_count delivering_count scheduled_count messages_added }.each do |method|
14
+ = data_row( method.humanize, @object.send( method ) )
15
+
16
+ .controls
17
+ = link_to collection_path( simple_class_name( @object ).pluralize ), '<< Back'
18
+
@@ -0,0 +1,23 @@
1
+ #jobs-index
2
+ %table
3
+ %tr
4
+ %th Name
5
+ %th App
6
+ %th Ruby Class
7
+ %th Status
8
+ %th Schedule
9
+ %th
10
+ - @collection.each do |job|
11
+ %tr
12
+ %td= link_to( object_path( job ), job.name )
13
+ %td
14
+ - if job.app
15
+ = link_to( object_path( job.app ), job.app_name )
16
+ - else
17
+ = job.app_name
18
+ %td= job.ruby_class_name
19
+ %td.status{:class => job.status.downcase}= job.status
20
+ %td= job.cron_expression
21
+ %td
22
+ - job.available_actions.each do |action|
23
+ = action_button( job, action )
@@ -0,0 +1,13 @@
1
+ #jobs-show
2
+ %h2
3
+ == Job: #{@object.name}
4
+ .actions
5
+ = @object.status == 'Started' ? action_button( @object, 'stop' ) : action_button( @object, 'start' )
6
+
7
+ %table.data-table
8
+ - %w{ name app_name ruby_class_name status cron_expression }.each do |method|
9
+ = data_row( method.humanize, @object.send( method ) )
10
+
11
+ .controls
12
+ = link_to collection_path( :jobs ), '<< Back'
13
+
@@ -0,0 +1,31 @@
1
+ !!!
2
+ %html
3
+ %title TorqueBox::BackStage
4
+ %link{:rel=>"stylesheet", :type=>"text/css", :href=>"#{url_for('/css/html5reset.css')}"}
5
+ %link{:rel=>"stylesheet", :type=>"text/css", :href=>"#{url_for('/css/style.css')}"}
6
+ %script{:type=>"text/javascript", :src=>"https://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js"}
7
+ %body{:class => class_for_body}
8
+ #header
9
+ %h1 TorqueBox::Backstage
10
+ #navigation
11
+ = link_to collection_path( :apps ), 'Apps', :class => 'apps'
12
+ = link_to collection_path( :queues ), 'Queues', :class => 'queues'
13
+ = link_to collection_path( :topics ), 'Topics', :class => 'topics'
14
+ = link_to collection_path( :message_processors ), 'Msg. Processors', :class => 'message_processors'
15
+ = link_to collection_path( :jobs ), 'Jobs', :class => 'jobs'
16
+ = link_to collection_path( :services ), 'Services', :class => 'services'
17
+ = link_to collection_path( :pools ), 'Runtime Pools', :class => 'pools'
18
+
19
+ #content-wrapper
20
+ - if flash_msg = flash[:notice]
21
+ #flash
22
+ = flash_msg
23
+ #content
24
+ = yield
25
+ #footer
26
+ %a{:href => 'https://github.com/torquebox/backstage'}<
27
+ Backstage
28
+ v#{Backstage::BACKSTAGE_VERSION} for
29
+ %a{:href => 'http://torquebox.org/'}<
30
+ TorqueBox
31
+ v#{Backstage::TORQUEBOX_VERSION}
@@ -0,0 +1,28 @@
1
+ #message_processors-index
2
+ %table
3
+ %tr
4
+ %th Name
5
+ %th App
6
+ %th Status
7
+ %th Destination
8
+ %th Selector
9
+ %th Concurrency
10
+ - @collection.each do |message_processor|
11
+ %tr
12
+ %td= link_to( object_path( message_processor ), message_processor.name )
13
+ %td
14
+ - if message_processor.app
15
+ = link_to( object_path( message_processor.app ), message_processor.app_name )
16
+ - else
17
+ = message_processor.app_name
18
+ %td.status{:class => message_processor.status.downcase}= message_processor.status
19
+ %td= message_processor.destination_name
20
+ %td= message_processor.message_selector
21
+ %td= message_processor.concurrency
22
+ %td
23
+ - message_processor.available_actions.each do |action|
24
+ = action_button( message_processor, action )
25
+
26
+
27
+
28
+
@@ -0,0 +1,12 @@
1
+ #message_processors-show
2
+ %h2
3
+ == Message Processor: #{@object.name}
4
+ .actions
5
+ = @object.status == 'Started' ? action_button( @object, 'stop' ) : action_button( @object, 'start' )
6
+ %table.data-table
7
+ - %w{ name app_name status destination_name message_selector concurrency }.each do |method|
8
+ = data_row( method.humanize, @object.send( method ) )
9
+
10
+ .controls
11
+ = link_to collection_path( :message_processors ), '<< Back'
12
+
@@ -0,0 +1,20 @@
1
+ #messages-index
2
+ %h2
3
+ == #{simple_class_name( @destination ).capitalize}: #{link_to( object_path( @destination ), @destination.display_name)} :: Messages
4
+ %table
5
+ %tr
6
+ %th ID
7
+ %th Delivery Count
8
+ %th Properties
9
+ %th Content
10
+ - @destination.each do |message|
11
+ %tr
12
+ %td
13
+ = link_to( object_path( message ), message.jms_id )
14
+ %td
15
+ = message.delivery_count
16
+ %td
17
+ = haml :'messages/properties', :locals => { :message => message }
18
+ %td
19
+ = truncate( message.content, 40 )
20
+
@@ -0,0 +1,3 @@
1
+ - message.properties.each do |name, value|
2
+ .property
3
+ == #{name}: #{truncate( value )}
@@ -0,0 +1,19 @@
1
+ #messages-show
2
+ %h2
3
+ == #{simple_class_name( @destination ).capitalize}: #{link_to( object_path( @destination ), @destination.display_name)} :: Message: #{@object.jms_id}
4
+ .actions
5
+
6
+ %table.data-table
7
+ = data_row( "ID", @object.jms_id )
8
+ = data_row( "Delivery Count", @object.delivery_count )
9
+ %tr.data-row
10
+ %td.label
11
+ Properties
12
+ %td.value
13
+ = haml :'messages/properties', :locals => { :message => @object }
14
+ = data_row( "Content", @object.content )
15
+ - @object.jms_properties.each do |name,val|
16
+ = data_row(name,val)
17
+ .controls
18
+ = link_to collection_path( @destination, :messages ), '<< Back'
19
+
@@ -0,0 +1,32 @@
1
+ #pools-index
2
+ %table
3
+ %tr
4
+ %th Name
5
+ %th App
6
+ %th Type
7
+ %th Size
8
+ %th Available
9
+ %th Borrowed
10
+ %th Min Instances
11
+ %th Max Instances
12
+ - @collection.each do |pool|
13
+ %tr
14
+ %td= link_to( object_path( pool ), pool.name )
15
+ %td
16
+ - if pool.app
17
+ = link_to( object_path( pool.app ), pool.app_name )
18
+ - else
19
+ = pool.app_name
20
+ %td= pool.pool_type
21
+ %td= pool.size
22
+ %td
23
+ = pool.available unless pool.shared?
24
+ %td
25
+ = pool.borrowed unless pool.shared?
26
+ %td
27
+ = pool.minimum_instances unless pool.shared?
28
+ %td
29
+ = pool.maximum_instances unless pool.shared?
30
+
31
+
32
+
@@ -0,0 +1,44 @@
1
+ #pools-show
2
+ %h2
3
+ == Runtime Pool: #{@object.name}
4
+ .actions
5
+
6
+ %table.data-table
7
+ - %w{ name app_name pool_type size }.each do |method|
8
+ = data_row( method.humanize, @object.send( method ) )
9
+
10
+ - unless @object.shared?
11
+ - %w{ available borrowed minimum_instances maximum_instances }.each do |method|
12
+ = data_row( method.humanize, @object.send( method ) )
13
+
14
+ #evaluate
15
+ %h3 Evaluate Ruby Against This Pool
16
+ #results
17
+
18
+ :javascript
19
+ function evaluate_remote() {
20
+ $.post(
21
+ '#{url_for( object_action_path( @object, :evaluate ) )}',
22
+ $('#script_form').serialize(),
23
+ function( response ) {
24
+ result = response.result
25
+ klass = 'result'
26
+ if (response.exception) {
27
+ klass += ' exception'
28
+ result = response.exception + "\n " + response.backtrace.join( "\n " )
29
+ } else {
30
+ result = '' + response.result
31
+ }
32
+ $( '#results' ).append( $( '<pre/>' ).addClass( klass ).text( result ) )
33
+ }
34
+ )
35
+ }
36
+
37
+ %form#script_form
38
+ %textarea{:name => 'script'}
39
+ = @script
40
+ %input{:type => 'button', :value => 'Evaluate', :onclick => "javascript:evaluate_remote()"}
41
+
42
+ .controls
43
+ = link_to collection_path( :pools ), '<< Back'
44
+
@@ -0,0 +1,21 @@
1
+ #services-index
2
+ %table
3
+ %tr
4
+ %th Name
5
+ %th App
6
+ %th Status
7
+ %th
8
+ - @collection.each do |service|
9
+ %tr
10
+ %td= link_to( object_path( service ), service.name )
11
+ %td
12
+ - if service.app
13
+ = link_to( object_path( service.app ), service.app_name )
14
+ - else
15
+ = service.app_name
16
+ %td.status{:class => service.status.downcase}= service.status
17
+ %td
18
+ - service.available_actions.each do |action|
19
+ = action_button( service, action )
20
+
21
+
@@ -0,0 +1,13 @@
1
+ #services-show
2
+ %h2
3
+ == Service: #{@object.name}
4
+ .actions
5
+ = @object.status == 'Started' ? action_button( @object, 'stop' ) : action_button( @object, 'start' )
6
+
7
+ %table.data-table
8
+ - %w{ name app_name status }.each do |method|
9
+ = data_row( method.humanize, @object.send( method ) )
10
+
11
+ .controls
12
+ = link_to collection_path( :services ), '<< Back'
13
+
metadata ADDED
@@ -0,0 +1,289 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: torquebox-backstage
3
+ version: !ruby/object:Gem::Version
4
+ prerelease:
5
+ version: 0.1.0
6
+ platform: ruby
7
+ authors:
8
+ - Tobias Crawley
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+
13
+ date: 2011-04-15 00:00:00 -04:00
14
+ default_executable: backstage
15
+ dependencies:
16
+ - !ruby/object:Gem::Dependency
17
+ name: sinatra
18
+ version_requirements: &id001 !ruby/object:Gem::Requirement
19
+ none: false
20
+ requirements:
21
+ - - "="
22
+ - !ruby/object:Gem::Version
23
+ version: 1.1.2
24
+ requirement: *id001
25
+ prerelease: false
26
+ type: :runtime
27
+ - !ruby/object:Gem::Dependency
28
+ name: rack-flash
29
+ version_requirements: &id002 !ruby/object:Gem::Requirement
30
+ none: false
31
+ requirements:
32
+ - - ">="
33
+ - !ruby/object:Gem::Version
34
+ version: "0"
35
+ requirement: *id002
36
+ prerelease: false
37
+ type: :runtime
38
+ - !ruby/object:Gem::Dependency
39
+ name: haml
40
+ version_requirements: &id003 !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ version: "3.0"
46
+ requirement: *id003
47
+ prerelease: false
48
+ type: :runtime
49
+ - !ruby/object:Gem::Dependency
50
+ name: jmx
51
+ version_requirements: &id004 !ruby/object:Gem::Requirement
52
+ none: false
53
+ requirements:
54
+ - - "="
55
+ - !ruby/object:Gem::Version
56
+ version: "0.7"
57
+ requirement: *id004
58
+ prerelease: false
59
+ type: :runtime
60
+ - !ruby/object:Gem::Dependency
61
+ name: json
62
+ version_requirements: &id005 !ruby/object:Gem::Requirement
63
+ none: false
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ version: "0"
68
+ requirement: *id005
69
+ prerelease: false
70
+ type: :runtime
71
+ - !ruby/object:Gem::Dependency
72
+ name: torquebox
73
+ version_requirements: &id006 !ruby/object:Gem::Requirement
74
+ none: false
75
+ requirements:
76
+ - - "="
77
+ - !ruby/object:Gem::Version
78
+ version: 1.0.0.CR1
79
+ requirement: *id006
80
+ prerelease: false
81
+ type: :runtime
82
+ - !ruby/object:Gem::Dependency
83
+ name: tobias-sinatra-url-for
84
+ version_requirements: &id007 !ruby/object:Gem::Requirement
85
+ none: false
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: "0"
90
+ requirement: *id007
91
+ prerelease: false
92
+ type: :runtime
93
+ - !ruby/object:Gem::Dependency
94
+ name: rack-accept
95
+ version_requirements: &id008 !ruby/object:Gem::Requirement
96
+ none: false
97
+ requirements:
98
+ - - ">="
99
+ - !ruby/object:Gem::Version
100
+ version: "0"
101
+ requirement: *id008
102
+ prerelease: false
103
+ type: :runtime
104
+ - !ruby/object:Gem::Dependency
105
+ name: thor
106
+ version_requirements: &id009 !ruby/object:Gem::Requirement
107
+ none: false
108
+ requirements:
109
+ - - ">="
110
+ - !ruby/object:Gem::Version
111
+ version: "0"
112
+ requirement: *id009
113
+ prerelease: false
114
+ type: :development
115
+ - !ruby/object:Gem::Dependency
116
+ name: jeweler
117
+ version_requirements: &id010 !ruby/object:Gem::Requirement
118
+ none: false
119
+ requirements:
120
+ - - ">="
121
+ - !ruby/object:Gem::Version
122
+ version: "0"
123
+ requirement: *id010
124
+ prerelease: false
125
+ type: :development
126
+ - !ruby/object:Gem::Dependency
127
+ name: watchr
128
+ version_requirements: &id011 !ruby/object:Gem::Requirement
129
+ none: false
130
+ requirements:
131
+ - - ">="
132
+ - !ruby/object:Gem::Version
133
+ version: "0"
134
+ requirement: *id011
135
+ prerelease: false
136
+ type: :development
137
+ - !ruby/object:Gem::Dependency
138
+ name: rspec
139
+ version_requirements: &id012 !ruby/object:Gem::Requirement
140
+ none: false
141
+ requirements:
142
+ - - ">="
143
+ - !ruby/object:Gem::Version
144
+ version: "0"
145
+ requirement: *id012
146
+ prerelease: false
147
+ type: :development
148
+ - !ruby/object:Gem::Dependency
149
+ name: rack-test
150
+ version_requirements: &id013 !ruby/object:Gem::Requirement
151
+ none: false
152
+ requirements:
153
+ - - ">="
154
+ - !ruby/object:Gem::Version
155
+ version: "0"
156
+ requirement: *id013
157
+ prerelease: false
158
+ type: :development
159
+ - !ruby/object:Gem::Dependency
160
+ name: thor
161
+ version_requirements: &id014 !ruby/object:Gem::Requirement
162
+ none: false
163
+ requirements:
164
+ - - ">"
165
+ - !ruby/object:Gem::Version
166
+ version: "0.14"
167
+ requirement: *id014
168
+ prerelease: false
169
+ type: :runtime
170
+ - !ruby/object:Gem::Dependency
171
+ name: bundler
172
+ version_requirements: &id015 !ruby/object:Gem::Requirement
173
+ none: false
174
+ requirements:
175
+ - - ">"
176
+ - !ruby/object:Gem::Version
177
+ version: 1.0.12
178
+ requirement: *id015
179
+ prerelease: false
180
+ type: :runtime
181
+ description: BackStage - Queue/Topic/Job viewer for TorqueBox
182
+ email: tcrawley@redhat.com
183
+ executables:
184
+ - backstage
185
+ extensions: []
186
+
187
+ extra_rdoc_files:
188
+ - README.md
189
+ - TODO
190
+ files:
191
+ - Gemfile
192
+ - Gemfile.lock
193
+ - README.md
194
+ - Rakefile
195
+ - TODO
196
+ - TORQUEBOX_VERSION
197
+ - VERSION
198
+ - backstage.rb
199
+ - config.ru
200
+ - config/torquebox.yml
201
+ - lib/apps.rb
202
+ - lib/apps/models/app.rb
203
+ - lib/apps/routes.rb
204
+ - lib/authentication.rb
205
+ - lib/destinations.rb
206
+ - lib/destinations/models/destination.rb
207
+ - lib/destinations/models/message.rb
208
+ - lib/destinations/models/queue.rb
209
+ - lib/destinations/models/topic.rb
210
+ - lib/destinations/routes.rb
211
+ - lib/has_mbean.rb
212
+ - lib/helpers.rb
213
+ - lib/jobs.rb
214
+ - lib/jobs/models/job.rb
215
+ - lib/jobs/routes.rb
216
+ - lib/message_processors.rb
217
+ - lib/message_processors/models/message_processor.rb
218
+ - lib/message_processors/routes.rb
219
+ - lib/pools.rb
220
+ - lib/pools/models/pool.rb
221
+ - lib/pools/routes.rb
222
+ - lib/resource.rb
223
+ - lib/resource_helpers.rb
224
+ - lib/runtimes.rb
225
+ - lib/runtimes/models/job.rb
226
+ - lib/runtimes/routes.rb
227
+ - lib/services.rb
228
+ - lib/services/models/service.rb
229
+ - lib/services/routes.rb
230
+ - lib/torquebox_managed.rb
231
+ - lib/util.rb
232
+ - spec/api_spec.rb
233
+ - spec/auth_spec.rb
234
+ - spec/spec_helper.rb
235
+ - views/apps/index.haml
236
+ - views/apps/show.haml
237
+ - views/css/_mixins.sass
238
+ - views/css/html5reset.sass
239
+ - views/css/style.sass
240
+ - views/destinations/index.haml
241
+ - views/destinations/show.haml
242
+ - views/jobs/index.haml
243
+ - views/jobs/show.haml
244
+ - views/layout.haml
245
+ - views/message_processors/index.haml
246
+ - views/message_processors/show.haml
247
+ - views/messages/index.haml
248
+ - views/messages/properties.haml
249
+ - views/messages/show.haml
250
+ - views/pools/index.haml
251
+ - views/pools/show.haml
252
+ - views/services/index.haml
253
+ - views/services/show.haml
254
+ - bin/backstage
255
+ has_rdoc: true
256
+ homepage: http://github.com/torquebox/backstage
257
+ licenses:
258
+ - MIT
259
+ post_install_message:
260
+ rdoc_options: []
261
+
262
+ require_paths:
263
+ - lib
264
+ required_ruby_version: !ruby/object:Gem::Requirement
265
+ none: false
266
+ requirements:
267
+ - - ">="
268
+ - !ruby/object:Gem::Version
269
+ hash: 2
270
+ segments:
271
+ - 0
272
+ version: "0"
273
+ required_rubygems_version: !ruby/object:Gem::Requirement
274
+ none: false
275
+ requirements:
276
+ - - ">="
277
+ - !ruby/object:Gem::Version
278
+ version: "0"
279
+ requirements: []
280
+
281
+ rubyforge_project:
282
+ rubygems_version: 1.5.1
283
+ signing_key:
284
+ specification_version: 3
285
+ summary: BackStage - Queue/Topic/Job viewer for TorqueBox
286
+ test_files:
287
+ - spec/api_spec.rb
288
+ - spec/auth_spec.rb
289
+ - spec/spec_helper.rb