Skip to content
This repository has been archived by the owner on Mar 15, 2018. It is now read-only.

Commit

Permalink
move site-events UI behind waffle-flag
Browse files Browse the repository at this point in the history
  • Loading branch information
potch committed Jan 26, 2012
1 parent cd37ff0 commit 1fb4010
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
5 changes: 4 additions & 1 deletion apps/stats/templates/stats/stats.html
Expand Up @@ -2,7 +2,10 @@

{% set range = view.range %}

{% block bodyclass %}statistics{% endblock %}
{% block bodyclass %}
statistics
{{ 'waffle-site-events' if waffle.switch('site-events') else '' }}
{% endblock %}

{% block extrahead %}
{{ css('zamboni/stats') }}
Expand Down
6 changes: 4 additions & 2 deletions media/js/impala/stats/manager.js
Expand Up @@ -22,6 +22,7 @@ z.StatsManager = (function() {
addonId = parseInt($(".primary").attr("data-addon_id"), 10),
baseURL = $(".primary").attr("data-base_url"),
pendingFetches = 0,
siteEventsEnabled = $('body').hasClass('waffle-site-events'),
writeInterval = false;

// It's a bummer, but we need to know which metrics have breakdown fields.
Expand Down Expand Up @@ -102,14 +103,14 @@ z.StatsManager = (function() {
// Update our internal view state.
currentView = $.extend(currentView, newView);
// Fetch the data from the server or storage, and notify other components.
$.when( getDataRange(currentView) )
$.when( getDataRange(currentView), getSiteEvents(currentView) )
.then( function(data, events) {
setTimeout(function() {
$(window).trigger("dataready", {
'view' : currentView,
'fields': getAvailableFields(currentView),
'data' : data,
'events': [] //TODO potch fix this when site events are re-enabled.
'events': events
});
}, 0);
});
Expand All @@ -119,6 +120,7 @@ z.StatsManager = (function() {

// Retrieves a list of site-wide events that may impact statistics data.
function getSiteEvents(view) {
if (!siteEventsEnabled) return [];
var range = normalizeRange(view.range),
urlStart = Highcharts.dateFormat('%Y%m%d', range.start),
urlEnd = Highcharts.dateFormat('%Y%m%d', range.end),
Expand Down
1 change: 1 addition & 0 deletions migrations/299-site-events-waffle.sql
@@ -0,0 +1 @@
INSERT INTO waffle_switch (name, active) VALUES ('site-events', 0);

0 comments on commit 1fb4010

Please sign in to comment.