diff --git a/src/api-umbrella/web-app/app/assets/javascripts/admin/templates/stats/_query_form.hbs b/src/api-umbrella/web-app/app/assets/javascripts/admin/templates/stats/_query_form.hbs
index 9fa700fb7..f8ea45b5f 100644
--- a/src/api-umbrella/web-app/app/assets/javascripts/admin/templates/stats/_query_form.hbs
+++ b/src/api-umbrella/web-app/app/assets/javascripts/admin/templates/stats/_query_form.hbs
@@ -4,7 +4,9 @@
{{t 'admin.stats.filter_results'}}
-
+ {{#if view.enableBetaAnalytics}}
+
+ {{/if}}
{{#if view.enableInterval}}
diff --git a/src/api-umbrella/web-app/app/assets/javascripts/admin/views/stats/query_form_view.js b/src/api-umbrella/web-app/app/assets/javascripts/admin/views/stats/query_form_view.js
index 4d5e8d4c2..9eb496caa 100644
--- a/src/api-umbrella/web-app/app/assets/javascripts/admin/views/stats/query_form_view.js
+++ b/src/api-umbrella/web-app/app/assets/javascripts/admin/views/stats/query_form_view.js
@@ -3,6 +3,8 @@ Admin.StatsQueryFormView = Ember.View.extend({
enableInterval: false,
+ enableBetaAnalytics: enableBetaAnalytics,
+
datePickerRanges: {
'Today': [
moment().startOf('day'),
diff --git a/src/api-umbrella/web-app/app/views/layouts/admin.html.erb b/src/api-umbrella/web-app/app/views/layouts/admin.html.erb
index 78f32f6c5..757cc830b 100644
--- a/src/api-umbrella/web-app/app/views/layouts/admin.html.erb
+++ b/src/api-umbrella/web-app/app/views/layouts/admin.html.erb
@@ -6,7 +6,8 @@
<%= stylesheet_link_tag "admin" %>
<%= javascript_tag do %>
webAdminAjaxApiKey = <%= web_admin_ajax_api_user.api_key.to_json.html_safe %>;
- currentAdmin = <%= current_admin.attributes.slice("username", "superuser").to_json.html_safe %>
+ currentAdmin = <%= current_admin.attributes.slice("username", "superuser").to_json.html_safe %>;
+ enableBetaAnalytics = <%= (ApiUmbrellaConfig[:analytics][:adapter] == "kylin" || (ApiUmbrellaConfig[:analytics][:outputs] && ApiUmbrellaConfig[:analytics][:outputs].include?("kylin"))).to_json.html_safe %>;
<% end %>
<%= javascript_include_tag "admin/locales/#{I18n.locale}" %>
diff --git a/src/api-umbrella/web-app/lib/tasks/jshint.rake b/src/api-umbrella/web-app/lib/tasks/jshint.rake
index 83bf6d8ab..9bf2630d5 100644
--- a/src/api-umbrella/web-app/lib/tasks/jshint.rake
+++ b/src/api-umbrella/web-app/lib/tasks/jshint.rake
@@ -36,6 +36,7 @@ begin
"CommonValidations",
"currentAdmin",
"Ember",
+ "enableBetaAnalytics",
"google",
"ic",
"inflection",
diff --git a/src/api-umbrella/web-app/spec/features/admin/stats_logs_spec.rb b/src/api-umbrella/web-app/spec/features/admin/stats_logs_spec.rb
index f6e44addf..39943f977 100644
--- a/src/api-umbrella/web-app/spec/features/admin/stats_logs_spec.rb
+++ b/src/api-umbrella/web-app/spec/features/admin/stats_logs_spec.rb
@@ -141,4 +141,22 @@
page.response_headers["Content-Type"].should eql("text/csv")
end
end
+
+ describe "beta analytics option" do
+ it "doesn't show the beta analytics option by default" do
+ visit "/admin/#/stats/logs/tz=America%2FDenver&search=&start_at=2015-01-12&end_at=2015-01-18&interval=day"
+ page.should_not have_content("Beta Analytics")
+ end
+
+ it "shows the beta analytics toggle if kylin analytics are enabled" do
+ original = ApiUmbrellaConfig[:analytics][:outputs]
+ begin
+ ApiUmbrellaConfig[:analytics][:outputs] = ["kylin"]
+ visit "/admin/#/stats/logs/tz=America%2FDenver&search=&start_at=2015-01-12&end_at=2015-01-18&interval=day"
+ page.should have_content("Beta Analytics")
+ ensure
+ ApiUmbrellaConfig[:analytics][:outputs] = original
+ end
+ end
+ end
end