wackamole 0.0.9 → 0.1.2

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.
Files changed (40) hide show
  1. data/History.txt +4 -1
  2. data/README.rdoc +17 -17
  3. data/Rakefile +1 -1
  4. data/bin/wackamole +5 -3
  5. data/lib/app.rb +13 -13
  6. data/lib/controllers/dashboard.rb +7 -2
  7. data/lib/controllers/features.rb +1 -1
  8. data/lib/controllers/logs.rb +20 -1
  9. data/lib/controllers/mission.rb +7 -8
  10. data/lib/controllers/session.rb +0 -1
  11. data/lib/controllers/users.rb +5 -1
  12. data/lib/helpers/dashboard_helper.rb +7 -2
  13. data/lib/helpers/flash_helper.rb +0 -1
  14. data/lib/helpers/main_helper.rb +6 -0
  15. data/lib/helpers/session_helper.rb +9 -6
  16. data/lib/wackamole.rb +1 -1
  17. data/lib/wackamole/models/control.rb +58 -31
  18. data/lib/wackamole/models/feature.rb +1 -1
  19. data/lib/wackamole/models/log.rb +1 -2
  20. data/lib/wackamole/models/mission.rb +49 -46
  21. data/lib/wackamole/models/mole_info.rb +4 -5
  22. data/lib/wackamole/models/search_filter.rb +2 -2
  23. data/lib/wackamole/models/user.rb +1 -1
  24. data/public/stylesheets/wackamole.css +41 -14
  25. data/spec/config/test.yml +4 -3
  26. data/spec/data/fixtures.rb +92 -92
  27. data/spec/spec_helper.rb +2 -1
  28. data/spec/wackamole/models/control_spec.rb +27 -33
  29. data/spec/wackamole/models/feature_spec.rb +19 -20
  30. data/spec/wackamole/models/log_spec.rb +2 -3
  31. data/spec/wackamole/models/mission_spec.rb +16 -18
  32. data/spec/wackamole/models/moled_info_spec.rb +9 -10
  33. data/spec/wackamole/models/search_filter_spec.rb +4 -5
  34. data/spec/wackamole/models/user_spec.rb +2 -3
  35. data/views/features/_rows.erb +1 -1
  36. data/views/layout.erb +18 -26
  37. data/views/logs/show.erb +6 -4
  38. data/views/mission/_report.erb +39 -39
  39. data/views/users/_rows.erb +2 -2
  40. metadata +11 -11
@@ -12,6 +12,7 @@ require File.expand_path( File.join(File.dirname(__FILE__), %w[data fixtures]))
12
12
  require File.expand_path( File.join(File.dirname(__FILE__), %w[.. lib wackamole]))
13
13
 
14
14
  # BOZO !! To run test you'll need to start a mongo instance
15
- # mongod --dbpath /data/wackamole/ --port 27777
15
+ # BOZO !! Rake task pleeease!!
16
+ # mongod --dbpath /data/wackamole/ --port 27099
16
17
  Spec::Runner.configure do |config|
17
18
  end
@@ -7,46 +7,40 @@ describe Wackamole::Control do
7
7
  end
8
8
 
9
9
  it "should raise an error if not correctly initialized" do
10
- lambda{ Wackamole::Control.connection }.should raise_error( /You must call init_config/ )
10
+ lambda{ Wackamole::Control.connection( "Fred" ) }.should raise_error( /You must call init_config/ )
11
11
  end
12
12
 
13
13
  it "should raise an error if invalid config file" do
14
14
  config_file = File.join(File.dirname(__FILE__), %w[.. .. config blee.yml])
15
15
  lambda {
16
- Wackamole::Control.init_config( config_file, 'test' )
16
+ Wackamole::Control.init_config( config_file )
17
17
  }.should raise_error( /Hoy! An error occur loading the config file `#{config_file} -- No such file or directory/ )
18
18
  end
19
-
20
- it "should raise an error if a bogus env is requested" do
21
- config_file = File.join(File.dirname(__FILE__), %w[.. .. config test.yml])
22
- lambda {
23
- Wackamole::Control.init_config( config_file, 'production' )
24
- }.should raise_error( /Hoy! An error occur loading the config file `#{config_file} -- Invalid environment `production/ )
25
- end
26
-
19
+
27
20
  it "should raise an error if invalid config file content" do
28
21
  config_file = File.join(File.dirname(__FILE__), %w[.. .. config bogus_test.yml])
29
22
  lambda {
30
- Wackamole::Control.init_config( config_file, 'test' )
31
- }.should raise_error( /Hoy! An error occur loading the config file `#{config_file} -- Unable to find host in -/ )
23
+ Wackamole::Control.init_config( config_file )
24
+ }.should raise_error( /Hoy! An error occur loading the config file `#{config_file} -- Unable to find zones definition/ )
32
25
  end
33
26
  end
34
27
 
35
28
  describe 'connection' do
36
29
  before :all do
37
30
  Wackamole::Control.reset!
38
- Wackamole::Control.init_config( File.join(File.dirname(__FILE__), %w[.. .. config test.yml]), 'test' )
39
- Wackamole::Control.connection.should_not be_nil
31
+ Wackamole::Control.init_config( File.join(File.dirname(__FILE__), %w[.. .. config test.yml]) )
32
+ Wackamole::Control.connection( 'test' ).should_not be_nil
40
33
  end
41
34
 
42
35
  describe "#collection" do
43
36
  it "should find a collection correctly" do
44
- cltn = Wackamole::Control.collection( 'features', "mole_app1_test_mdb" )
37
+ Wackamole::Control.current_db( 'test', 'app1', 'test' )
38
+ cltn = Wackamole::Control.collection( 'features' )
45
39
  cltn.count.should == 6
46
40
  feature = cltn.find_one()
47
41
  feature['app'].should == "app1"
48
42
  feature['env'].should == "test"
49
- feature['did'].should == Time.now.utc.to_date_id.to_s
43
+ feature['did'].should == Time.now.to_date_id.to_s
50
44
  feature['ctx'].should match( /\// )
51
45
  end
52
46
  end
@@ -54,7 +48,7 @@ describe Wackamole::Control do
54
48
  describe "mole databases" do
55
49
  it "should correctly identify mole dbs" do
56
50
  # gen_bogus_dbs
57
- mole_dbs = Wackamole::Control.mole_databases
51
+ mole_dbs = Wackamole::Control.mole_databases( 'test' )
58
52
  mole_dbs.should have(2).items
59
53
  end
60
54
 
@@ -70,29 +64,29 @@ describe Wackamole::Control do
70
64
 
71
65
  it "should connect to a mole databases correctly" do
72
66
  %w[app1 app2].each do |app|
73
- Wackamole::Control.db( "mole_#{app}_test_mdb" )
67
+ Wackamole::Control.current_db( "test", app, "test", true )
74
68
  feature = Wackamole::Control.collection( 'features' ).find_one()
75
69
  feature['app'].should == app
76
70
  feature['env'].should == "test"
77
71
  end
78
72
  end
79
73
 
80
- it "should switch mole dbs correctly" do
81
- %w[app1 app2].each do |app|
82
- Wackamole::Control.switch_mole_db!( app, "test" )
83
- feature = Wackamole::Control.collection( 'features' ).find_one()
84
- feature['app'].should == app
85
- feature['env'].should == "test"
86
- end
87
- end
88
-
89
- it "should fail to switch if there is no mole db" do
90
- lambda{ Wackamole::Control.switch_mole_db!( "blee", "test" ) }.should raise_error( /Invalid mole database mole_blee_test_mdb/ )
91
- end
74
+ # it "should switch mole dbs correctly" do
75
+ # %w[app1 app2].each do |app|
76
+ # Wackamole::Control.switch_mole_db!( app, "test" )
77
+ # feature = Wackamole::Control.collection( 'features' ).find_one()
78
+ # feature['app'].should == app
79
+ # feature['env'].should == "test"
80
+ # end
81
+ # end
92
82
 
93
- it "should fail to switch for an invalid mole db" do
94
- lambda{ Wackamole::Control.switch_mole_db!( "zorg", "missing" ) }.should raise_error( /Invalid mole database mole_zorg_missing_mdb/ )
95
- end
83
+ # it "should fail to switch if there is no mole db" do
84
+ # lambda{ Wackamole::Control.switch_mole_db!( "blee", "test" ) }.should raise_error( /Invalid mole database mole_blee_test_mdb/ )
85
+ # end
86
+ #
87
+ # it "should fail to switch for an invalid mole db" do
88
+ # lambda{ Wackamole::Control.switch_mole_db!( "zorg", "missing" ) }.should raise_error( /Invalid mole database mole_zorg_missing_mdb/ )
89
+ # end
96
90
  end
97
91
  end
98
92
  end
@@ -3,9 +3,8 @@ require 'chronic'
3
3
 
4
4
  describe Wackamole::Feature do
5
5
  before( :all ) do
6
- Wackamole::Control.init_config( File.join(File.dirname(__FILE__), %w[.. .. config test.yml]), 'test' )
7
- Wackamole::Control.connection.should_not be_nil
8
- Wackamole::Control.db( "mole_app1_test_mdb" )
6
+ Wackamole::Control.init_config( File.join(File.dirname(__FILE__), %w[.. .. config test.yml]) )
7
+ Wackamole::Control.current_db( "test", "app1", "test", true )
9
8
  end
10
9
 
11
10
  it "retrieve an app info correctly" do
@@ -30,23 +29,23 @@ describe Wackamole::Feature do
30
29
  @cltn.drop_indexes
31
30
  end
32
31
 
33
- it "should set up indexes correctly" do
34
- indexes = @cltn.index_information
35
- indexes.should have(1).item
36
- count = Wackamole::Feature.ensure_indexes!
37
- count.should == 3
38
- indexes = @cltn.index_information
39
- indexes.should have(3).items
40
- end
41
-
42
- it "should do nothing if indexes are already present" do
43
- indexes = @cltn.index_information
44
- indexes.should have(3).items
45
- count = Wackamole::Feature.ensure_indexes!
46
- count.should == 1
47
- indexes = @cltn.index_information
48
- indexes.should have(3).items
49
- end
32
+ # it "should set up indexes correctly" do
33
+ # indexes = @cltn.index_information
34
+ # indexes.should have(1).item
35
+ # count = Wackamole::Feature.ensure_indexes!
36
+ # count.should == 3
37
+ # indexes = @cltn.index_information
38
+ # indexes.should have(3).items
39
+ # end
40
+ #
41
+ # it "should do nothing if indexes are already present" do
42
+ # indexes = @cltn.index_information
43
+ # indexes.should have(3).items
44
+ # count = Wackamole::Feature.ensure_indexes!
45
+ # count.should == 1
46
+ # indexes = @cltn.index_information
47
+ # indexes.should have(3).items
48
+ # end
50
49
  end
51
50
 
52
51
  end
@@ -3,9 +3,8 @@ require 'chronic'
3
3
 
4
4
  describe Wackamole::Log do
5
5
  before( :all ) do
6
- Wackamole::Control.init_config( File.join(File.dirname(__FILE__), %w[.. .. config test.yml]), 'test' )
7
- Wackamole::Control.connection.should_not be_nil
8
- Wackamole::Control.db( "mole_app1_test_mdb" )
6
+ Wackamole::Control.init_config( File.join(File.dirname(__FILE__), %w[.. .. config test.yml]) )
7
+ Wackamole::Control.current_db( "test", "app1", "test", true )
9
8
  end
10
9
 
11
10
  it "should paginate logs correctly" do
@@ -3,11 +3,10 @@ require 'chronic'
3
3
 
4
4
  describe Wackamole::Mission do
5
5
  before :all do
6
- Wackamole::Control.reset!
7
- Wackamole::Control.init_config( File.join(File.dirname(__FILE__), %w[.. .. config test.yml]), 'test' )
8
- Wackamole::Control.connection.should_not be_nil
9
- now = Time.now
10
- @test_time = Chronic.parse( "%d/%2d/%2d 17:00:00" % [now.year,now.month,now.day] )
6
+ Wackamole::Control.init_config( File.join(File.dirname(__FILE__), %w[.. .. config test.yml]) )
7
+ Wackamole::Control.current_db( "test", "app1", "test", true )
8
+ now = Time.now-24*60*60
9
+ @test_time = Chronic.parse( "%d/%2d/%2d 00:00:01" % [now.year,now.month,now.day] )
11
10
  # @test_time = Chronic.parse( "2010/01/01 01:00:00" ).utc
12
11
  end
13
12
 
@@ -27,24 +26,23 @@ describe Wackamole::Mission do
27
26
  end
28
27
 
29
28
  it "should pick up an app pulse correctly" do
30
- pulse = Wackamole::Mission.pulse( @test_time )
31
- pulse.should have(3).items
32
- pulse[:to_date].should_not be_nil
33
- pulse[:today].should_not be_nil
34
- pulse[:last_tick].should_not be_nil
35
- expected = {'to_date' => [7,5,3], 'today' => [6,4,2] }
29
+ zones = Wackamole::Mission.pulse( @test_time )
30
+ zones.should have(1).items
31
+ apps = zones['test']
32
+ apps.should have(2).items
33
+ expected = {'to_date' => [7,5,3], 'today' => [3,2,1] }
36
34
  %w(to_date today).each do |p|
37
35
  %w(app1 app2).each do |app|
38
36
  [0, 1, 2].each do |type|
39
- pulse[p.to_sym][app]["test"][type].should == expected[p][type]
37
+ zones['test'][app]['test'][p.to_sym][type].should == expected[p][type]
40
38
  end
41
39
  end
42
40
  end
43
- %w(app1 app2).each do |app|
44
- expected = [3,2,1]
45
- [0, 1, 2].each do |type|
46
- pulse[:last_tick][app]["test"][type].should == expected[type]
47
- end
48
- end
41
+ # %w(app1 app2).each do |app|
42
+ # expected = [3,2,1]
43
+ # [0, 1, 2].each do |type|
44
+ # pulse[:last_tick][app]["test"][type].should == expected[type]
45
+ # end
46
+ # end
49
47
  end
50
48
  end
@@ -3,16 +3,15 @@ require 'chronic'
3
3
 
4
4
  describe Wackamole::MoledInfo do
5
5
  before( :all ) do
6
- Wackamole::Control.init_config( File.join(File.dirname(__FILE__), %w[.. .. config test.yml]), 'test' )
7
- Wackamole::Control.connection.should_not be_nil
8
- Wackamole::Control.db( "mole_app1_test_mdb" )
9
- now = Time.now
10
- @test_time = Chronic.parse( "%d/%2d/%2d 17:00:00" % [now.year,now.month,now.day] )
6
+ Wackamole::Control.init_config( File.join(File.dirname(__FILE__), %w[.. .. config test.yml]) )
7
+ Wackamole::Control.current_db( "test", "app1", "test", true )
8
+ now = Time.now-24*60*60
9
+ @test_time = Chronic.parse( "%d/%2d/%2d 18:00:01" % [now.year,now.month,now.day] )
11
10
  end
12
11
 
13
12
  it "should gather dashboard info correctly" do
14
13
  info = Wackamole::MoledInfo.collect_dashboard_info( @test_time )
15
-
14
+
16
15
  info[:total_users].should == 5
17
16
  info[:user_load].should == 2
18
17
  info[:total_features].should == 6
@@ -20,10 +19,10 @@ describe Wackamole::MoledInfo do
20
19
  info[:fault_load].should == 1
21
20
  info[:perf_load].should == 2
22
21
 
23
- info[:user_series].should == series_for( [[17,2]] )
24
- info[:feature_series].should == series_for( [[17,2]] )
25
- info[:fault_series].should == series_for( [[17,1]] )
26
- info[:perf_series].should == series_for( [[17,2]] )
22
+ info[:user_series].should == series_for( [[18,2]] )
23
+ info[:feature_series].should == series_for( [[18,2]] )
24
+ info[:fault_series].should == series_for( [[18,1]] )
25
+ info[:perf_series].should == series_for( [[18,2]] )
27
26
  end
28
27
 
29
28
  def series_for( slots )
@@ -3,7 +3,7 @@ require File.join(File.dirname(__FILE__), %w[.. .. spec_helper])
3
3
  describe Wackamole::SearchFilter do
4
4
  before( :each ) do
5
5
  @filter = Wackamole::SearchFilter.new
6
- now = Time.now
6
+ now = Time.now
7
7
  @test_time = Chronic.parse( "%d/%2d/%2d 17:00:00" % [now.year,now.month,now.day] )
8
8
  end
9
9
 
@@ -67,7 +67,7 @@ describe Wackamole::SearchFilter do
67
67
  conds = @filter.to_conds
68
68
  conds.should have(1).item
69
69
  conds.key?( '$where' ).should == true
70
- conds['$where'].should == "((this.did == '#{@test_time.to_date_id}' && this.tid >= '070001') || ( this.did == '#{(@test_time+24*60*60).to_date_id}' && this.tid <= '065959') )"
70
+ conds['$where'].should == "((this.did == '#{@test_time.to_date_id}' && this.tid >= '060001') || ( this.did == '#{(@test_time+24*60*60).to_date_id}' && this.tid <= '055959') )"
71
71
  end
72
72
 
73
73
  it "should include browser if specified correctly" do
@@ -98,9 +98,8 @@ describe Wackamole::SearchFilter do
98
98
 
99
99
  describe "search terms" do
100
100
  before( :all ) do
101
- Wackamole::Control.init_config( File.join(File.dirname(__FILE__), %w[.. .. config test.yml]), 'test' )
102
- Wackamole::Control.connection.should_not be_nil
103
- Wackamole::Control.db( "mole_app1_test_mdb" )
101
+ Wackamole::Control.init_config( File.join(File.dirname(__FILE__), %w[.. .. config test.yml]) )
102
+ Wackamole::Control.current_db( "test", "app1", "test", true )
104
103
  end
105
104
 
106
105
  it "should retrieve features correctly" do
@@ -3,9 +3,8 @@ require 'chronic'
3
3
 
4
4
  describe Wackamole::User do
5
5
  before( :all ) do
6
- Wackamole::Control.init_config( File.join(File.dirname(__FILE__), %w[.. .. config test.yml]), 'test' )
7
- Wackamole::Control.connection.should_not be_nil
8
- Wackamole::Control.db( "mole_app1_test_mdb" )
6
+ Wackamole::Control.init_config( File.join(File.dirname(__FILE__), %w[.. .. config test.yml]) )
7
+ Wackamole::Control.current_db( "test", "app1", "test", true )
9
8
  end
10
9
 
11
10
  it "should paginate a user collection correctly" do
@@ -14,7 +14,7 @@
14
14
  <% count=0;@features.each do |row| %>
15
15
  <% color = count % 2 == 0 ? 'transparent' : 'transparent url(/images/fade.png) repeat-x' %>
16
16
  <tr style="background:<%=color%>">
17
- <td><b><%=display_context( row[:name] )%></b></td>
17
+ <td><%=link_to display_context( row[:name] ), "/logs/feature/#{row[:fid]}", :class => 'nav_link'%></td>
18
18
  <td align="right"><b><%=row[:total]%></b></td>
19
19
  </tr>
20
20
  <% count+=1;end %>
@@ -9,54 +9,46 @@
9
9
  <%= javascripts %w[jquery_min jquery_ui_min] %>
10
10
  </head>
11
11
 
12
- <style>
13
- span#version {
14
- position: relative;
15
- top: -12px;
16
- left: 32px;
17
- font-weight: bold;
18
- color: #316071;
19
- }
20
- a.logout {
21
- font-size: 0.8em;
22
- }
23
- </style>
24
12
  <body id="body">
25
13
  <div id="overall">
26
14
  <div id="logo">
27
15
  <span id="version"><%=Wackamole.version%></span>
28
16
  <%= link_to image_tag( 'wackamole_logo.png', :border => 0 ), '/mission' %>
29
17
  </div>
30
- <div id="app_info">
18
+ <div id="links">
31
19
  <% if console_auth? and !root_path? %>
32
20
  <%= link_to "log out", "/session/delete", :class => "site_link logout" %>
33
21
  <% end %>
34
22
 
35
- <% if @app_info %>
36
- <ul>
37
- <li>&laquo;<span><%=@app_info[:app_name]%></span>&raquo;</li>
38
- <li id="env"><%=@app_info[:stage]%></li>
39
- <ul>
40
- <% end %>
41
23
  <% unless root_path? %>
42
24
  <p><span id="timestamp"><%=partial :'shared/timestamp'%></span></p>
43
25
  <% end %>
26
+
27
+ <% if @app_info and authenticated? %>
28
+ <ul id="app_info">
29
+ <li>zone<span class="zone"><%=@app_info[:zone]%></span></li>
30
+ <li><span class="app"><%=@app_info[:app]%></span><span class="stage"><%=@app_info[:stage]%></span></li>
31
+ </ul>
32
+ <% end %>
44
33
  </div>
45
34
  <div id="main">
46
35
  <div class="flash"></div>
47
36
 
48
- <% if @app_info %>
37
+ <% if @app_info and authenticated? %>
49
38
  <div id='navigation' class='corners'>
50
39
  <% unless Wackamole::Control.single_app? %>
51
40
  <%=link_to "mission control", "/mission", :class => "site_link land" %>&nbsp;&bull;&nbsp;
52
41
  <% end %>
53
- <%=link_to "dashboard" , "/dashboard/#{@app_info[:app_name]}/#{@app_info[:stage]}", :class => "site_link dash" %>&nbsp;&bull;&nbsp;
54
- <%=link_to "logs" , "/logs/1" , :class => "site_link logs" %>&nbsp;&bull;&nbsp;
55
- <%=link_to "features" , "/features/1" , :class => "site_link features" %>&nbsp;&bull;&nbsp;
56
- <%=link_to "users" , "/users/1" , :class => "site_link users" %>
42
+ <%=link_to "dashboard", "/dashboard/#{@app_info[:zone]}/#{@app_info[:app]}/#{@app_info[:stage]}",
43
+ :class => "site_link dash" %>&nbsp;&bull;&nbsp;
44
+ <%=link_to "logs", "/logs/1",
45
+ :class => "site_link logs" %>&nbsp;&bull;&nbsp;
46
+ <%=link_to "features", "/features/1",
47
+ :class => "site_link features" %>&nbsp;&bull;&nbsp;
48
+ <%=link_to "users", "/users/1",
49
+ :class => "site_link users" %>
57
50
  </div>
58
- <% end %>
59
-
51
+ <% end %>
60
52
  <%= yield %>
61
53
  </div>
62
54
 
@@ -13,6 +13,12 @@
13
13
  <td><%=@log['pat']%></td>
14
14
  </tr>
15
15
  <% end %>
16
+ <% if @log['msg'] %>
17
+ <tr>
18
+ <td class="label" valign="top">Error</td>
19
+ <td><%=truncate( @log['msg'], 300 )%></td>
20
+ </tr>
21
+ <% end %>
16
22
  <tr>
17
23
  <td class="label">User</td>
18
24
  <td><%=user_name_for( {}, @log['uid'] ) %></td>
@@ -55,10 +61,6 @@
55
61
  </tr>
56
62
  <% end %>
57
63
  <% if @log['msg'] %>
58
- <tr>
59
- <td class="label" valign="top">Error</td>
60
- <td><%=truncate( @log['msg'], 300 )%></td>
61
- </tr>
62
64
  <tr>
63
65
  <td class="label" valign="top">Stack [<%=@log['sta'].size%>]</td>
64
66
  <td><%=partial :'logs/array', :object => @log['sta']%></td>
@@ -1,54 +1,54 @@
1
- <% applications = extract_applications( @pulse ) %>
2
- <% if applications.empty? == 0 %>
1
+ <% if @zones.empty? == 0 %>
3
2
  <div class="doh">
4
- <p>Unable to find a Rackamole MongoDb database on this connection <%=Wackamole::Control.connection.host%>:<%=Wackamole::Control.connection.port%>.</p>
5
- <p>Make sure you moled database follows this naming convention</p>
6
- <p>mole_{<i>application name in lower case</i>}_{<i>environment</i>}_mdb</p>
3
+ <p>Unable to locate zone information please double check your zones file in ~/.wackamole/zones.yml/p>
7
4
  </div>
8
5
  <% else %>
9
6
  <table class="logs" id="mission">
10
7
  <thead>
11
- <tr>
12
- <th width="25%">application</th>
13
- <th width="10%">environment</th>
8
+ <tr>
9
+ <th width="20%">application</th>
10
+ <th width="10%">zone</th>
11
+ <th width="10%">env</th>
14
12
  <th width="20%">to date</th>
15
13
  <th width="20%">today</th>
16
14
  <th width="20%">last tick</th>
17
15
  </tr>
18
16
  </thead>
19
17
  <tbody>
20
- <% applications.each_pair do |app_name, envs| %>
21
- <% envs.each do |env| %>
22
- <tr class="app_info" id="<%=app_name%>_<%=env%>">
23
- <td valign="top"><%= link_to app_name, "/dashboard/#{app_name}/#{env}", :class => 'site_link' %></td>
24
- <td valign="top"><%= env %></td>
25
- <% %w(to_date today last_tick).each do |period| %>
26
- <% info = @pulse[period.to_sym][app_name][env] %>
27
- <td>
28
- <table border="0" width="100%">
29
- <tbody>
30
- <% info.each_pair do |type, count| %>
31
- <tr>
32
- <% clazz = ( (count > 0 and %w(last_tick today).include?(period)) ? assign_class( type, count ) : nil) %>
33
- <td width="25px">
34
- <% if( %w(last_tick today).include?( period ) and count > 0 ) %>
35
- <%= link_to Wackamole::Mission.to_type_name(type), "/mission/logs/#{app_name}/#{env}/#{type}", :class => "site_link", :id => "#{app_name}_#{env}_#{type}" %>:
36
- <% else %>
37
- <%=Wackamole::Mission.to_type_name(type)%>:
38
- <% end %>
39
- </td>
40
- <td align='right'>
41
- <span class="<%= (clazz and count > 0 ? "#{period}_#{clazz}" : '') %>">
42
- &nbsp;<%= format_number(count) %>&nbsp;
43
- </span>
44
- </td>
45
- </tr>
46
- <% end %>
47
- </tbody>
48
- </table>
49
- </td>
18
+ <% @zones.each_pair do |zone, app_info| %>
19
+ <% app_info.each_pair do |app_name, env_info| %>
20
+ <% env_info.each_pair do |env_name, totals| %>
21
+ <tr class="app_info" id="<%=zone%>" >
22
+ <td valign="top"><%= link_to app_name, "/dashboard/#{zone}/#{app_name}/#{env_name}", :class => 'site_link' %></td>
23
+ <td valign="top"><%= zone %></td>
24
+ <td valign="top"><%= env_name %></td>
25
+ <% %w(to_date today last_tick).each do |period| %>
26
+ <td>
27
+ <table border="0" width="100%">
28
+ <tbody>
29
+ <% totals[period.to_sym].each_pair do |type, count| %>
30
+ <tr>
31
+ <% clazz = ( (count > 0 and %w(last_tick today).include?(period)) ? assign_class( type, count ) : nil) %>
32
+ <td width="25px">
33
+ <% if( %w(last_tick today).include?( period ) and count > 0 ) %>
34
+ <%= link_to Wackamole::Mission.to_type_name(type), "/mission/logs/#{zone}/#{app_name}/#{env_name}/#{type}", :class => "site_link", :id => "#{app_name}_#{env}_#{type}" %>:
35
+ <% else %>
36
+ <%=Wackamole::Mission.to_type_name(type)%>:
37
+ <% end %>
38
+ </td>
39
+ <td align='right'>
40
+ <span class="<%= (clazz and count > 0 ? "#{period}_#{clazz}" : '') %>">
41
+ &nbsp;<%= format_number(count) %>&nbsp;
42
+ </span>
43
+ </td>
44
+ </tr>
45
+ <% end %>
46
+ </tbody>
47
+ </table>
48
+ </td>
50
49
  <% end %>
51
- </tr>
50
+ </tr>
51
+ <% end %>
52
52
  <% end %>
53
53
  <% end %>
54
54
  </tbody>