Fixing loading indicators and storage for stats pages (bug 578411)

This commit is contained in:
Matt Claypotch 2011-04-29 16:04:41 -07:00
Родитель 91261c58a2
Коммит 76de7c47fe
7 изменённых файлов: 29 добавлений и 21 удалений

Просмотреть файл

@ -25,7 +25,7 @@ def report_menu(context, addon, report):
{
'name': 'sources',
'url': '/downloads/sources/',
'title': _('by Download Source'),
'title': _('by Source'),
},
]
},

Просмотреть файл

@ -1,6 +1,6 @@
{% set show_contributions = false %}
<div class="secondary-item-list report-menu">
<h3>{{ _('Add-On Statistics') }}</h3>
<h3>{{ _('Add-on Statistics') }}</h3>
<ul>
{% for item in report_tree %}
{% if item.name != 'contributions' or show_contributions %}

Просмотреть файл

@ -22,16 +22,19 @@
<div class="criteria range">
<ul>
<li>{{ _('For Last:') }}</li>
<li>{{ _('For last:') }}</li>
<li data-range="7 days"
{% if range=='7' %}class="selected"{% endif %}>
<a href="#">{{ _('7 Days') }}</a></li>
<a href="#">{{ _('7 days') }}</a></li>
<li data-range="30 days"
{% if range=='30' %}class="selected"{% endif %}>
<a href="#">{{ _('30 Days') }}</a></li>
<a href="#">{{ _('30 days') }}</a></li>
<li data-range="90 days"
{% if range=='90' %}class="selected"{% endif %}>
<a href="#">{{ _('90 Days') }}</a></li>
<a href="#">{{ _('90 days') }}</a></li>
<li data-range="365 days"
{% if range=='365' %}class="selected"{% endif %}>
<a href="#">{{ _('365 days') }}</a></li>
<li class="divider"></li>
<li data-range="custom"
{% if range=='custom' %}class="selected"{% endif %}>
@ -122,14 +125,8 @@
{% endblock %}
{% block js %}
<script src="{{ media('js/lib/jquery-datepicker.js') }}"></script>
<script src="{{ media('js/lib/highcharts.src.js') }}"></script>
<!--[if IE]>
<script src="{{ media('js/lib/excanvas.compiled.js" type="text/javascript') }}"></script>
<![endif]-->
<script src="{{ media('js/zamboni/stats/csv_keys.js') }}"></script>
<script src="{{ media('js/zamboni/stats/helpers.js') }}"></script>
<script src="{{ media('js/zamboni/stats/stats_manager.js') }}"></script>
<script src="{{ media('js/zamboni/stats/stats_tables.js') }}"></script>
<script src="{{ media('js/zamboni/stats/stats.js') }}"></script>
{{ js('stats') }}
{% endblock %}

Просмотреть файл

@ -110,7 +110,7 @@ div.statbox {
.criteria.range {
float: right;
position: relative;
top: -18px;
top: -2px;
z-index: 1000;
}
.criteria li {

Просмотреть файл

@ -249,6 +249,7 @@ function SeriesChart() {
this.render = function(view) {
var newView = $.extend({}, currentView, view);
dbg("rendering", newView);
set_loading(chartObj.container);
Series.get(newView, function(seriesSet) {
var s = chartObj.series;
while(chartObj.series.length) {
@ -266,6 +267,7 @@ function SeriesChart() {
if ('time' in view) {
drawFieldMenu();
}
$(chartObj.container).addClass("loaded");
});
};
this.chart = function() { return chartObj; };

Просмотреть файл

@ -1,7 +1,7 @@
// (function () {
// Versioning for offline storage
var version = "11";
var version = "12";
// where all the time-series data for the page is kept
var datastore = {};
@ -53,7 +53,7 @@
// Worker pool for Web Worker management
var stats_worker_url = z.media_url+"js/workers/stats_worker.js";
var stats_worker_url = '/media/js/workers/stats_worker.js';
var StatsWorkerPool = new WorkerPool(4);
@ -245,7 +245,7 @@
init: function () {
dbg("looking for local data");
if (AMO.StatsManager.verify_local()) {
var cacheObject = storageCache.get(AMO.getAddonId());
var cacheObject = AMO.StatsManager.storageCache.get(AMO.getAddonId());
if (cacheObject) {
dbg("found local data, loading...");
cacheObject = JSON.parse(cacheObject);
@ -258,18 +258,18 @@
write_local: function () {
dbg("saving local data");
storageCache.set(AMO.getAddonId(), JSON.stringify(datastore));
storage.set("version", version);
AMO.StatsManager.storageCache.set(AMO.getAddonId(), JSON.stringify(datastore));
AMO.StatsManager.storage.set("version", version);
dbg("saved local data");
},
clear_local: function () {
storageCache.remove(AMO.getAddonId());
AMO.StatsManager.storageCache.remove(AMO.getAddonId());
dbg("cleared local data");
},
verify_local: function () {
if (storage.get("version") == version) {
if (AMO.StatsManager.storage.get("version") == version) {
return true;
} else {
dbg("wrong offline data verion");

Просмотреть файл

@ -556,6 +556,15 @@ MINIFY_BUNDLES = {
'js/zamboni/truncation.js',
'js/zamboni/mobile.js',
),
'stats': (
'js/lib/jquery-datepicker.js',
'js/lib/highcharts.src.js',
'js/zamboni/stats/csv_keys.js',
'js/zamboni/stats/helpers.js',
'js/zamboni/stats/stats_manager.js',
'js/zamboni/stats/stats_tables.js',
'js/zamboni/stats/stats.js',
),
# This is included when DEBUG is True. Bundle in <head>.
'debug': (
'js/debug/less_setup.js',