diff --git a/Gemfile.lock b/Gemfile.lock index adafb6dc3..d1d21e9f3 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -3,12 +3,12 @@ GEM specs: SystemTimer (1.2.3) abstract (1.0.0) - actionmailer (3.0.7) - actionpack (= 3.0.7) - mail (~> 2.2.15) - actionpack (3.0.7) - activemodel (= 3.0.7) - activesupport (= 3.0.7) + actionmailer (3.0.9) + actionpack (= 3.0.9) + mail (~> 2.2.19) + actionpack (3.0.9) + activemodel (= 3.0.9) + activesupport (= 3.0.9) builder (~> 2.1.2) erubis (~> 2.6.6) i18n (~> 0.5.0) @@ -16,25 +16,25 @@ GEM rack-mount (~> 0.6.14) rack-test (~> 0.5.7) tzinfo (~> 0.3.23) - activemodel (3.0.7) - activesupport (= 3.0.7) + activemodel (3.0.9) + activesupport (= 3.0.9) builder (~> 2.1.2) i18n (~> 0.5.0) - activerecord (3.0.7) - activemodel (= 3.0.7) - activesupport (= 3.0.7) - arel (~> 2.0.2) + activerecord (3.0.9) + activemodel (= 3.0.9) + activesupport (= 3.0.9) + arel (~> 2.0.10) tzinfo (~> 0.3.23) - activeresource (3.0.7) - activemodel (= 3.0.7) - activesupport (= 3.0.7) - activesupport (3.0.7) + activeresource (3.0.9) + activemodel (= 3.0.9) + activesupport (= 3.0.9) + activesupport (3.0.9) arel (2.0.10) bson (1.3.1) bson_ext (1.3.1) builder (2.1.2) chronic (0.3.0) - ci_reporter (1.6.4) + ci_reporter (1.6.5) builder (>= 2.1.2) daemon_controller (0.2.6) database_cleaner (0.6.7) @@ -49,7 +49,7 @@ GEM activesupport builder i18n (0.5.0) - json (1.5.1) + json (1.5.3) machinist (1.0.6) machinist_mongo (1.2.0) machinist (~> 1.0.6) @@ -67,35 +67,37 @@ GEM mongo (~> 1.3) tzinfo (~> 0.3.22) will_paginate (~> 3.0.pre) - newrelic_rpm (3.0.1) + newrelic_rpm (3.1.0) passenger (3.0.7) daemon_controller (>= 0.2.5) fastthread (>= 1.0.1) rack rake (>= 0.8.1) polyglot (0.3.1) - pony (1.2) + pony (1.3) mail (> 2.0) rack (1.2.3) rack-mount (0.6.14) rack (>= 1.0.0) rack-test (0.5.7) rack (>= 1.0) - rails (3.0.7) - actionmailer (= 3.0.7) - actionpack (= 3.0.7) - activerecord (= 3.0.7) - activeresource (= 3.0.7) - activesupport (= 3.0.7) + rails (3.0.9) + actionmailer (= 3.0.9) + actionpack (= 3.0.9) + activerecord (= 3.0.9) + activeresource (= 3.0.9) + activesupport (= 3.0.9) bundler (~> 1.0) - railties (= 3.0.7) - railties (3.0.7) - actionpack (= 3.0.7) - activesupport (= 3.0.7) + railties (= 3.0.9) + railties (3.0.9) + actionpack (= 3.0.9) + activesupport (= 3.0.9) rake (>= 0.8.7) + rdoc (~> 3.4) thor (~> 0.14.4) rake (0.8.7) - rpm_contrib (2.1.2) + rdoc (3.8) + rpm_contrib (2.1.3) newrelic_rpm (>= 3.0.0) shoulda (2.11.3) shoulda-activemodel (0.0.2) @@ -104,7 +106,7 @@ GEM timecop (0.3.5) treetop (1.4.9) polyglot (>= 0.3.1) - tzinfo (0.3.27) + tzinfo (0.3.29) will_paginate (3.0.pre2) PLATFORMS diff --git a/app/controllers/analytics_controller.rb b/app/controllers/analytics_controller.rb index 474f3339f..e9dcba6f7 100644 --- a/app/controllers/analytics_controller.rb +++ b/app/controllers/analytics_controller.rb @@ -18,7 +18,11 @@ def shell ms = sprintf("%#.2f", time*1000); - html_result = render_to_string(decide_result_partial(@result[:operation]), :layout => false) + if @result[:operation] == "find" + html_result = render_to_string("_find_result", :layout => false) + else + html_result = "" + end render_success(ms, html_result, shell.operator, @result[:result]) rescue => e @@ -27,13 +31,6 @@ def shell end private - def decide_result_partial(type) - case type - when "count" then return "_count_result" - when "find" then return "_find_result" - when "distinct" then return "_distinct_result" - end - end def render_error(reason) res = { diff --git a/app/views/analytics/_count_result.html.erb b/app/views/analytics/_count_result.html.erb deleted file mode 100644 index ca085c7ad..000000000 --- a/app/views/analytics/_count_result.html.erb +++ /dev/null @@ -1,3 +0,0 @@ -

Count result: <%= @result[:result].to_i %>

- -<%= render :partial => "shelldebug" %> diff --git a/app/views/analytics/_distinct_result.html.erb b/app/views/analytics/_distinct_result.html.erb deleted file mode 100644 index 4a60e52f6..000000000 --- a/app/views/analytics/_distinct_result.html.erb +++ /dev/null @@ -1,13 +0,0 @@ -

Distinct result

- - - -<%= render :partial => "shelldebug" %> diff --git a/public/javascripts/shell.js b/public/javascripts/shell.js index 64d4546a8..e8c4b0599 100644 --- a/public/javascripts/shell.js +++ b/public/javascripts/shell.js @@ -128,16 +128,27 @@ var Shell = new function() { switch (res.op) { case "count": - x += " - Count result: " + res.result + x += " - Count result: " + "" + res.result + ""; break; case "distinct": - x += " - Distinct result: " + res.result + x += " - Distinct result: " + ""; + if (res.result.length == 0) { + x += "No matches."; + } else { + for (key in res.result) { + x += res.result[key] + ", "; + } + x = x.substring(0, x.length - 2); // Remove last comma and whitespace. + x += "" + } break; } output(x); - render_result_content(res); + if (res.op == "find") { + render_result_content(res); + } } else { output("Error: " + res.reason); } diff --git a/public/stylesheets/shell.css b/public/stylesheets/shell.css index 2c3e0afdf..84ca01d0d 100644 --- a/public/stylesheets/shell.css +++ b/public/stylesheets/shell.css @@ -42,3 +42,7 @@ position: relative; top: -3px; } + +.shell-result-string { + color: #fd0c99; +}