wackamole 0.0.1
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/.bnsignore +16 -0
- data/.gitignore +2 -0
- data/History.txt +4 -0
- data/README.rdoc +88 -0
- data/Rakefile +42 -0
- data/aa.rb +25 -0
- data/aaa.txt +13 -0
- data/bin/wackamole +77 -0
- data/lib/app.rb +63 -0
- data/lib/controllers/dashboard.rb +30 -0
- data/lib/controllers/features.rb +41 -0
- data/lib/controllers/logs.rb +49 -0
- data/lib/controllers/mission.rb +27 -0
- data/lib/controllers/users.rb +41 -0
- data/lib/helpers/dashboard_helper.rb +32 -0
- data/lib/helpers/features_helper.rb +13 -0
- data/lib/helpers/flash_helper.rb +16 -0
- data/lib/helpers/logs_helper.rb +116 -0
- data/lib/helpers/main_helper.rb +182 -0
- data/lib/helpers/mission_helper.rb +59 -0
- data/lib/helpers/rails_helper.rb +7 -0
- data/lib/wackamole.rb +47 -0
- data/lib/wackamole/core_ext/date_time.rb +8 -0
- data/lib/wackamole/core_ext/time.rb +9 -0
- data/lib/wackamole/models/control.rb +132 -0
- data/lib/wackamole/models/feature.rb +74 -0
- data/lib/wackamole/models/log.rb +45 -0
- data/lib/wackamole/models/mission.rb +164 -0
- data/lib/wackamole/models/mole_info.rb +94 -0
- data/lib/wackamole/models/search_filter.rb +192 -0
- data/lib/wackamole/models/user.rb +46 -0
- data/public/favicon.ico +0 -0
- data/public/images/.DS_Store +0 -0
- data/public/images/browsers/.DS_Store +0 -0
- data/public/images/browsers/MSIE 6.png +0 -0
- data/public/images/browsers/MSIE 8.0 +0 -0
- data/public/images/browsers/MSIE 8.0.png +0 -0
- data/public/images/browsers/chrome.png +0 -0
- data/public/images/browsers/firefox.png +0 -0
- data/public/images/browsers/ie 6.0.png +0 -0
- data/public/images/browsers/ie6.jpg +0 -0
- data/public/images/browsers/ie7.jpg +0 -0
- data/public/images/browsers/ie7.png +0 -0
- data/public/images/browsers/msie 6.0.png +0 -0
- data/public/images/browsers/msie 7.0.png +0 -0
- data/public/images/browsers/opera.jpg +0 -0
- data/public/images/browsers/opera.png +0 -0
- data/public/images/browsers/safari.jpg +0 -0
- data/public/images/browsers/safari.png +0 -0
- data/public/images/browsers/unknown_browser.png +0 -0
- data/public/images/close.png +0 -0
- data/public/images/error.png +0 -0
- data/public/images/fade.png +0 -0
- data/public/images/fault_big.png +0 -0
- data/public/images/fault_small.png +0 -0
- data/public/images/feature.png +0 -0
- data/public/images/h300.png +0 -0
- data/public/images/hori_large.png +0 -0
- data/public/images/info_big.png +0 -0
- data/public/images/info_small.png +0 -0
- data/public/images/loading.gif +0 -0
- data/public/images/loading1.gif +0 -0
- data/public/images/mole_error.png +0 -0
- data/public/images/more.gif +0 -0
- data/public/images/next.png +0 -0
- data/public/images/perf_big.png +0 -0
- data/public/images/perf_small.png +0 -0
- data/public/images/powered_by.png +0 -0
- data/public/images/prev.png +0 -0
- data/public/images/row_fade.png +0 -0
- data/public/images/search.png +0 -0
- data/public/images/small_logo.png +0 -0
- data/public/images/spaceball.gif +0 -0
- data/public/images/tick.png +0 -0
- data/public/images/users.png +0 -0
- data/public/images/wackamole_logo.png +0 -0
- data/public/javascripts/.DS_Store +0 -0
- data/public/javascripts/application.js +28 -0
- data/public/javascripts/g.dot.min.js +7 -0
- data/public/javascripts/g.raphael.min.js +7 -0
- data/public/javascripts/jit.js +9052 -0
- data/public/javascripts/jit.min.js +1 -0
- data/public/javascripts/jquery-ui.js +188 -0
- data/public/javascripts/jquery.example.js +160 -0
- data/public/javascripts/jquery.js +19 -0
- data/public/javascripts/jquery.tools.min.js +38 -0
- data/public/javascripts/jquery_ba-url.js +9 -0
- data/public/javascripts/jquery_min.js +19 -0
- data/public/javascripts/jquery_ui_min.js +298 -0
- data/public/javascripts/raphael.min.js +7 -0
- data/public/stylesheets/tabs-slideshow.css +95 -0
- data/public/stylesheets/wackamole.css +684 -0
- data/spec/config/bogus_test.yml +3 -0
- data/spec/config/test.yml +3 -0
- data/spec/core_ext/date_time_spec.rb +8 -0
- data/spec/core_ext/time_spec.rb +12 -0
- data/spec/data/fixtures.rb +92 -0
- data/spec/models/control_spec.rb +98 -0
- data/spec/models/feature_spec.rb +52 -0
- data/spec/models/log_spec.rb +43 -0
- data/spec/models/mission_spec.rb +225 -0
- data/spec/models/moled_info_spec.rb +30 -0
- data/spec/models/search_filter_spec.rb +151 -0
- data/spec/models/user_spec.rb +44 -0
- data/spec/spec_helper.rb +14 -0
- data/spec/wackamole_spec.rb +20 -0
- data/tasks/bones.rake +20 -0
- data/tasks/fixtures.rake +13 -0
- data/tasks/gem.rake +201 -0
- data/tasks/git.rake +40 -0
- data/tasks/notes.rake +27 -0
- data/tasks/post_load.rake +32 -0
- data/tasks/rdoc.rake +54 -0
- data/tasks/rubyforge.rake +55 -0
- data/tasks/setup.rb +290 -0
- data/tasks/spec.rake +54 -0
- data/tasks/svn.rake +46 -0
- data/views/dashboard/_report.erb +118 -0
- data/views/dashboard/index.erb +4 -0
- data/views/dashboard/refresh_js.erb +3 -0
- data/views/features/_rows.erb +26 -0
- data/views/features/filter.js.erb +2 -0
- data/views/features/index.erb +24 -0
- data/views/features/index.js.erb +2 -0
- data/views/layout.erb +47 -0
- data/views/logs/_array.erb +12 -0
- data/views/logs/_hash.erb +14 -0
- data/views/logs/_rows.erb +65 -0
- data/views/logs/filter.js.erb +4 -0
- data/views/logs/index.erb +13 -0
- data/views/logs/index.js.erb +2 -0
- data/views/logs/show.erb +66 -0
- data/views/mission/_report.erb +49 -0
- data/views/mission/index.erb +7 -0
- data/views/mission/refresh_js.erb +3 -0
- data/views/shared/_filter.erb +63 -0
- data/views/shared/_flash.erb +3 -0
- data/views/shared/_search.erb +25 -0
- data/views/shared/_timestamp.erb +1 -0
- data/views/shared/_wait.erb +1 -0
- data/views/shared/flash.js.erb +10 -0
- data/views/users/_rows.erb +26 -0
- data/views/users/filter.js.erb +4 -0
- data/views/users/index.erb +24 -0
- data/views/users/index.js.erb +2 -0
- metadata +347 -0
data/.bnsignore
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# The list of files that should be ignored by Mr Bones.
|
|
2
|
+
# Lines that start with '#' are comments.
|
|
3
|
+
#
|
|
4
|
+
# A .gitignore file can be used instead by setting it as the ignore
|
|
5
|
+
# file in your Rakefile:
|
|
6
|
+
#
|
|
7
|
+
# PROJ.ignore_file = '.gitignore'
|
|
8
|
+
#
|
|
9
|
+
# For a project with a C extension, the following would be a good set of
|
|
10
|
+
# exclude patterns (uncomment them if you want to use them):
|
|
11
|
+
# *.[oa]
|
|
12
|
+
# *~
|
|
13
|
+
announcement.txt
|
|
14
|
+
coverage
|
|
15
|
+
doc
|
|
16
|
+
pkg
|
data/.gitignore
ADDED
data/History.txt
ADDED
data/README.rdoc
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
== Wackamole
|
|
2
|
+
Observe your web applications in the wild!
|
|
3
|
+
|
|
4
|
+
== DESCRIPTION:
|
|
5
|
+
|
|
6
|
+
This is a companion sinatra app for the Rackamole framework which provides for recording
|
|
7
|
+
interactions with your rack applications. Wackamole allows you to view, filter and drilldown
|
|
8
|
+
on the collected moled information, hence allowing you to observe your
|
|
9
|
+
applications live in the wild...
|
|
10
|
+
|
|
11
|
+
== PROJECT INFORMATION
|
|
12
|
+
|
|
13
|
+
* Developer: Fernand Galiana
|
|
14
|
+
* Site: http://www.rackamole.com
|
|
15
|
+
* Twitter: http://twitter.com/rackamole
|
|
16
|
+
* Forum: http://groups.google.com/group/rackamole
|
|
17
|
+
* Git: git://github.com/derailed/wackamole.git
|
|
18
|
+
|
|
19
|
+
== FEATURES
|
|
20
|
+
|
|
21
|
+
* Self bundled sinatra app
|
|
22
|
+
* View daily activity
|
|
23
|
+
* Search and filter on any info collected by the mole
|
|
24
|
+
* Reports performance and exceptions that might occur in your applications
|
|
25
|
+
|
|
26
|
+
== ROAD MAP
|
|
27
|
+
|
|
28
|
+
Rewrite as sinatra gem - done
|
|
29
|
+
|
|
30
|
+
== DEPENDENCIES
|
|
31
|
+
|
|
32
|
+
mongo + mongo-ext
|
|
33
|
+
sinatra
|
|
34
|
+
agnostic-will_paginate
|
|
35
|
+
memcache-client
|
|
36
|
+
mongo_rack
|
|
37
|
+
main
|
|
38
|
+
|
|
39
|
+
== INSTALL
|
|
40
|
+
|
|
41
|
+
> gem install wackamole
|
|
42
|
+
|
|
43
|
+
== USAGE
|
|
44
|
+
|
|
45
|
+
IMPORTANT: You moled database naming is important here, as Wackamole is setup to snif out the moled application
|
|
46
|
+
databases using the prefix 'mole_'. So you must name your mole databases according to this convention. ie
|
|
47
|
+
mole_{app_name}_{environment}_mdb ie mole_fred_development_mdb
|
|
48
|
+
|
|
49
|
+
=== Configure It!
|
|
50
|
+
|
|
51
|
+
You will need to give wackamole some information about your rackamole configuration.
|
|
52
|
+
In order to do so create a .wackamole directory in your home directory and create
|
|
53
|
+
a file wackamole.yml. You will need to specify the envs, host and ports specific
|
|
54
|
+
to your configuration, but here is a sample.
|
|
55
|
+
|
|
56
|
+
wackamole.yml
|
|
57
|
+
development:
|
|
58
|
+
host: localhost
|
|
59
|
+
port: 27017
|
|
60
|
+
|
|
61
|
+
beta:
|
|
62
|
+
host: beta_host_name
|
|
63
|
+
port: 27017
|
|
64
|
+
user: bobo
|
|
65
|
+
password: secret
|
|
66
|
+
|
|
67
|
+
=== Launch It!
|
|
68
|
+
|
|
69
|
+
Watch your creation live!
|
|
70
|
+
|
|
71
|
+
Please checkout the forum and send us feedback and issues. This is still work in progress so your
|
|
72
|
+
feedback will be very much appreciated!
|
|
73
|
+
|
|
74
|
+
== LICENSE:
|
|
75
|
+
|
|
76
|
+
Copyright 2009-2010 LiquidRail LLC
|
|
77
|
+
|
|
78
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
79
|
+
you may not use this file except in compliance with the License.
|
|
80
|
+
You may obtain a copy of the License at
|
|
81
|
+
|
|
82
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
83
|
+
|
|
84
|
+
Unless required by applicable law or agreed to in writing, software
|
|
85
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
86
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
87
|
+
See the License for the specific language governing permissions and
|
|
88
|
+
limitations under the License.
|
data/Rakefile
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# Look in the tasks/setup.rb file for the various options that can be
|
|
2
|
+
# configured in this Rakefile. The .rake files in the tasks directory
|
|
3
|
+
# are where the options are used.
|
|
4
|
+
begin
|
|
5
|
+
require 'tasks/bones'
|
|
6
|
+
Bones.setup
|
|
7
|
+
rescue LoadError
|
|
8
|
+
begin
|
|
9
|
+
load File.join(File.dirname(__FILE__), %w[tasks setup.rb] )
|
|
10
|
+
rescue LoadError
|
|
11
|
+
raise RuntimeError, '### please install the "bones" gem ###'
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
ensure_in_path 'lib'
|
|
16
|
+
require 'wackamole'
|
|
17
|
+
|
|
18
|
+
PROJ.name = 'wackamole'
|
|
19
|
+
PROJ.authors = 'Fernand Galiana'
|
|
20
|
+
PROJ.summary = 'A companion web app to Rackamole'
|
|
21
|
+
PROJ.email = 'fernand.galiana@gmail.com'
|
|
22
|
+
PROJ.url = 'http://www.rackamole.com'
|
|
23
|
+
PROJ.version = Wackamole::VERSION
|
|
24
|
+
PROJ.ruby_opts = %w[-W0]
|
|
25
|
+
PROJ.readme = 'README.rdoc'
|
|
26
|
+
PROJ.rcov.opts = ["--sort", "coverage", "-T"]
|
|
27
|
+
PROJ.ignore_file = "*.log"
|
|
28
|
+
PROJ.spec.opts << '--color'
|
|
29
|
+
PROJ.rdoc.include = %w[.rb]
|
|
30
|
+
|
|
31
|
+
# Dependencies
|
|
32
|
+
depend_on "mongo" , ">= 0.18.1"
|
|
33
|
+
depend_on "mongo_ext" , ">= 0.18.1"
|
|
34
|
+
depend_on "agnostic-will_paginate", ">= 3.0.0"
|
|
35
|
+
depend_on "memcache-client" , ">= 1.5.0"
|
|
36
|
+
depend_on "mongo_rack" , ">= 0.0.1"
|
|
37
|
+
depend_on "main" , ">= 4.2.0"
|
|
38
|
+
depend_on "sinatra" , ">= 0.9.4"
|
|
39
|
+
depend_on "mongo_rack" , ">= 0.0.3"
|
|
40
|
+
|
|
41
|
+
# Rake
|
|
42
|
+
task :default => ['fixtures:load','spec:run']
|
data/aa.rb
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
require 'rubygems'
|
|
2
|
+
require 'mongo'
|
|
3
|
+
|
|
4
|
+
puts BSON.serialize( {:a => [10, 20, 30]}, true ).inspect
|
|
5
|
+
|
|
6
|
+
class Fred
|
|
7
|
+
attr_accessor :a, :b
|
|
8
|
+
|
|
9
|
+
def initialize( a, b )
|
|
10
|
+
@a = a
|
|
11
|
+
@b = b
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def to_bson
|
|
15
|
+
puts "YO"
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def serialize
|
|
19
|
+
puts "Hello"
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
f = Fred.new( 10, 20 )
|
|
24
|
+
|
|
25
|
+
BSON.serialize( { :blee => f }, true )
|
data/aaa.txt
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<form id="filter_form"
|
|
2
|
+
style="text-align: left; height: 30px; float: left; width: 75%;"
|
|
3
|
+
onsubmit="
|
|
4
|
+
jQuery.ajax({beforeSend:function(request){$('#loading' ).show();},
|
|
5
|
+
complete:function(request){$('#loading' ).hide();},
|
|
6
|
+
data:jQuery.param(jQuery(this).serializeArray()) + '
|
|
7
|
+
&authenticity_token=' +
|
|
8
|
+
encodeURIComponent('h++MWbNXSamQ44OE0+9e9gvC2VUyH5yoeKt4m60N1/g='),
|
|
9
|
+
dataType:'script',
|
|
10
|
+
type:'post',
|
|
11
|
+
url:'/logs/filter'}); return false;"
|
|
12
|
+
method="post"
|
|
13
|
+
action="/logs/filter">
|
data/bin/wackamole
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
require 'rubygems'
|
|
3
|
+
require 'main'
|
|
4
|
+
|
|
5
|
+
URI_MATCH = /(mongo|memcache):\/\/(.+?)\:(\d+)\/(\w+)\/{0,1}(\w*)/
|
|
6
|
+
|
|
7
|
+
Main {
|
|
8
|
+
option( 'pool=[pool]', 'p' ) {
|
|
9
|
+
validate { |pool| pool =~ URI_MATCH }
|
|
10
|
+
description "specify session server uri. Must be of the form {[mongo|memcache]}://{host}:{port}/{[database_name|namespace]}[/{collection_name}]"
|
|
11
|
+
}
|
|
12
|
+
environment( 'RACK_ENV' ) {
|
|
13
|
+
default 'production'
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
@@options = {}
|
|
17
|
+
|
|
18
|
+
# Enter main loop
|
|
19
|
+
def run
|
|
20
|
+
require File.expand_path( File.join(File.dirname(__FILE__), %w[.. lib wackamole]))
|
|
21
|
+
|
|
22
|
+
@@options = parse_args( params[:pool].value )
|
|
23
|
+
ENV['RACK_ENV'] = params['RACK_ENV'].value
|
|
24
|
+
|
|
25
|
+
Thread.new do
|
|
26
|
+
puts "-"*100
|
|
27
|
+
puts "Initializing Wackamole -- Version #{Wackamole::VERSION}"
|
|
28
|
+
puts "-"*100
|
|
29
|
+
puts "\n"*2
|
|
30
|
+
puts ">>> Waiting for Franky to warm up..."
|
|
31
|
+
puts "\n"*2
|
|
32
|
+
sleep( sleep_time )
|
|
33
|
+
puts "\n"*2
|
|
34
|
+
puts ">>> Opening console..."
|
|
35
|
+
puts "\n"*2
|
|
36
|
+
open( "http://localhost:#{default_port}/mission" )
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
# Clearing args for franky!
|
|
40
|
+
ARGV.clear
|
|
41
|
+
require 'sinatra'
|
|
42
|
+
require File.join(File.dirname(__FILE__), %w[.. lib app.rb])
|
|
43
|
+
Sinatra::Application.run! :port => default_port, :environment => 'production'
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
# default wackamole port
|
|
47
|
+
def default_port() 7777; end
|
|
48
|
+
|
|
49
|
+
# sleepy time...
|
|
50
|
+
def sleep_time() 3; end
|
|
51
|
+
|
|
52
|
+
# open console...
|
|
53
|
+
def open(path)
|
|
54
|
+
case RUBY_PLATFORM
|
|
55
|
+
when /darwin/
|
|
56
|
+
system 'open', path
|
|
57
|
+
when /mswin(?!ce)|mingw|cygwin|bccwin/
|
|
58
|
+
system 'start', path
|
|
59
|
+
else
|
|
60
|
+
system 'firefox', path
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
# parse uri into sub components
|
|
65
|
+
def parse_args( server_uri )
|
|
66
|
+
return unless server_uri
|
|
67
|
+
tokens = server_uri.match( URI_MATCH ).captures
|
|
68
|
+
opts = { :protocol => tokens.first, :host => tokens[1], :port => tokens[2] }
|
|
69
|
+
if opts[:protocol] == "mongo"
|
|
70
|
+
opts[:db_name] = tokens[3]
|
|
71
|
+
opts[:cltn_name] = tokens[4]
|
|
72
|
+
else
|
|
73
|
+
opts[:namespace] = tokens[3]
|
|
74
|
+
end
|
|
75
|
+
opts
|
|
76
|
+
end
|
|
77
|
+
}
|
data/lib/app.rb
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
require 'rubygems'
|
|
2
|
+
require 'sinatra'
|
|
3
|
+
require 'forwardable'
|
|
4
|
+
require 'mongo'
|
|
5
|
+
gem 'agnostic-will_paginate'
|
|
6
|
+
require 'will_paginate'
|
|
7
|
+
require 'mongo_rack'
|
|
8
|
+
require 'rackamole'
|
|
9
|
+
require File.expand_path( File.join( File.dirname(__FILE__), 'wackamole.rb' ) )
|
|
10
|
+
|
|
11
|
+
set :public, File.join( File.dirname(__FILE__), %w[.. public] )
|
|
12
|
+
set :views , File.join( File.dirname(__FILE__), %w[.. views] )
|
|
13
|
+
|
|
14
|
+
def default_config
|
|
15
|
+
File.join( ENV['HOME'], %w[.wackamole wackamole.yml] )
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
# -----------------------------------------------------------------------------
|
|
19
|
+
# Configurations
|
|
20
|
+
|
|
21
|
+
configure :production do
|
|
22
|
+
set :logging, false
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
configure do
|
|
26
|
+
set :sessions, false
|
|
27
|
+
|
|
28
|
+
Wackamole.load_all_libs_relative_to(__FILE__, 'helpers' )
|
|
29
|
+
Wackamole.load_all_libs_relative_to(__FILE__, 'controllers' )
|
|
30
|
+
|
|
31
|
+
#Pick up command line args if any?
|
|
32
|
+
if defined? @@options and @@options
|
|
33
|
+
if @@options[:protocol] == 'mongo'
|
|
34
|
+
use Rack::Session::Mongo,
|
|
35
|
+
:server => "%s:%d/%s/%s" % [@@options[:host], @@options[:port], @@options[:db_name], @@options[:cltn_name]]
|
|
36
|
+
else
|
|
37
|
+
use Rack::Session::Memcache,
|
|
38
|
+
:memcache_server => "%s:%d" % [@@options[:host], @@options[:port]],
|
|
39
|
+
:namespace => @@options[:namespace]
|
|
40
|
+
end
|
|
41
|
+
else
|
|
42
|
+
# Default is a mongo session store
|
|
43
|
+
use Rack::Session::Mongo, :server => "%s:%d/%s/%s" % ['localhost', '27017', 'wackamole_ses', 'sessions']
|
|
44
|
+
end
|
|
45
|
+
set :con, Wackamole::Control.init_config( default_config, Sinatra::Application.environment.to_s )
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
# -----------------------------------------------------------------------------
|
|
49
|
+
# Before filters
|
|
50
|
+
before do
|
|
51
|
+
unless request.path =~ /\.[css gif png js]/
|
|
52
|
+
@filter = session[:filter]
|
|
53
|
+
unless @filter
|
|
54
|
+
@filter = Wackamole::SearchFilter.new
|
|
55
|
+
session[:filter] = @filter
|
|
56
|
+
end
|
|
57
|
+
@updated_on = Time.now
|
|
58
|
+
@refresh_rate = 15
|
|
59
|
+
|
|
60
|
+
@app_info = session[:app_info]
|
|
61
|
+
Wackamole::Control.switch_mole_db!( @app_info[:app_name].downcase, @app_info[:stage] ) if @app_info
|
|
62
|
+
end
|
|
63
|
+
end
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
require 'chronic'
|
|
2
|
+
require 'json'
|
|
3
|
+
|
|
4
|
+
module Dashboard
|
|
5
|
+
|
|
6
|
+
# ---------------------------------------------------------------------------
|
|
7
|
+
# Show application dashboard
|
|
8
|
+
get '/dashboard/:app_name/:stage' do
|
|
9
|
+
Wackamole::Control.switch_mole_db!( params[:app_name].downcase, params[:stage] )
|
|
10
|
+
|
|
11
|
+
ensure_indexes!
|
|
12
|
+
load_app_details
|
|
13
|
+
|
|
14
|
+
# Reset app info
|
|
15
|
+
load_app_info
|
|
16
|
+
|
|
17
|
+
# Reset filters
|
|
18
|
+
@filter.reset!
|
|
19
|
+
|
|
20
|
+
erb :'dashboard/index'
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
# ---------------------------------------------------------------------------
|
|
24
|
+
# Refresh dashboard
|
|
25
|
+
get '/dashboard/refresh' do
|
|
26
|
+
load_app_details
|
|
27
|
+
erb :'dashboard/refresh_js', :layout => false
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
end
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
module Features
|
|
2
|
+
|
|
3
|
+
# ---------------------------------------------------------------------------
|
|
4
|
+
# paginate top features
|
|
5
|
+
get "/features/:page" do
|
|
6
|
+
page = params[:page] ? params[:page].to_i : 1
|
|
7
|
+
|
|
8
|
+
@features = Wackamole::Feature.paginate_tops( @filter.to_conds, page )
|
|
9
|
+
@search_path = "/features/search"
|
|
10
|
+
@filter_path = "/features/filter"
|
|
11
|
+
|
|
12
|
+
if request.xhr?
|
|
13
|
+
erb :'features/index.js', :layout => false
|
|
14
|
+
else
|
|
15
|
+
erb :'features/index'
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
# ---------------------------------------------------------------------------
|
|
20
|
+
# Search - must specify a context ie ses: fred
|
|
21
|
+
post "/features/search" do
|
|
22
|
+
begin
|
|
23
|
+
@filter.search_terms = params[:search_filter][:search_terms]
|
|
24
|
+
@features = Wackamole::Feature.paginate_tops( @filter.to_conds )
|
|
25
|
+
rescue => boom
|
|
26
|
+
logger.error boom
|
|
27
|
+
flash[:error] = boom
|
|
28
|
+
@features = [].paginate
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
erb :"features/filter.js", :layout => false
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
# ---------------------------------------------------------------------------
|
|
35
|
+
# Filter
|
|
36
|
+
post "/features/filter" do
|
|
37
|
+
@filter.from_options( params[:filter] )
|
|
38
|
+
@features = Wackamole::Feature.paginate_tops( @filter.to_conds )
|
|
39
|
+
erb :"features/filter.js", :layout => false
|
|
40
|
+
end
|
|
41
|
+
end
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
module Logs
|
|
2
|
+
|
|
3
|
+
# ---------------------------------------------------------------------------
|
|
4
|
+
get "/logs/:page" do
|
|
5
|
+
page = params[:page] ? params[:page].to_i : 1
|
|
6
|
+
|
|
7
|
+
@logs = Wackamole::Log.paginate( @filter.to_conds, page)
|
|
8
|
+
@search_path = "/logs/search"
|
|
9
|
+
@filter_path = "/logs/filter"
|
|
10
|
+
|
|
11
|
+
if request.xhr?
|
|
12
|
+
erb :'logs/index.js', :layout => false
|
|
13
|
+
else
|
|
14
|
+
erb :'logs/index'
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
# ---------------------------------------------------------------------------
|
|
19
|
+
# Search logs - must specify a context ie ses: fred
|
|
20
|
+
post "/logs/search" do
|
|
21
|
+
begin
|
|
22
|
+
@filter.search_terms = params[:search_filter][:search_terms]
|
|
23
|
+
@logs = Wackamole::Log.paginate( @filter.to_conds )
|
|
24
|
+
rescue => boom
|
|
25
|
+
puts boom
|
|
26
|
+
flash_it!( :error, boom )
|
|
27
|
+
@logs = [].paginate
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
erb :"logs/filter.js", :layout => false
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# ---------------------------------------------------------------------------
|
|
34
|
+
# Fecth info about a particular log
|
|
35
|
+
get "/logs/:id/show" do
|
|
36
|
+
@log = Wackamole::Log.find_one( Mongo::ObjectID.from_string( params[:id] ) )
|
|
37
|
+
erb :"logs/show", :layout => false
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
# ---------------------------------------------------------------------------
|
|
41
|
+
# Filter logs
|
|
42
|
+
post "/logs/filter" do
|
|
43
|
+
@filter = Wackamole::SearchFilter.new
|
|
44
|
+
@filter.from_options( params[:filter] )
|
|
45
|
+
session[:filter] = @filter
|
|
46
|
+
@logs = Wackamole::Log.paginate( @filter.to_conds )
|
|
47
|
+
erb :"logs/filter.js", :layout => false
|
|
48
|
+
end
|
|
49
|
+
end
|