Set default period to last 7 days

This commit is contained in:
Toby Zerner 2017-12-10 21:26:54 +10:30
parent 1780448e70
commit 410dd2c679
2 changed files with 11 additions and 8 deletions

View File

@ -2,10 +2,10 @@ var Chart=function(){"use strict";function t(t,e){return"string"==typeof t?(e||d
; ;
'use strict'; 'use strict';
System.register('flarum/statistics/components/StatisticsWidget', ['flarum/components/DashboardWidget', 'flarum/components/SelectDropdown', 'flarum/components/Button', 'flarum/helpers/icon', 'flarum/helpers/listItems', 'flarum/utils/ItemList'], function (_export, _context) { System.register('flarum/statistics/components/StatisticsWidget', ['flarum/components/DashboardWidget', 'flarum/components/SelectDropdown', 'flarum/components/Button', 'flarum/helpers/icon', 'flarum/helpers/listItems', 'flarum/utils/ItemList', 'flarum/utils/abbreviateNumber'], function (_export, _context) {
"use strict"; "use strict";
var DashboardWidget, SelectDropdown, Button, icon, listItems, ItemList, StatisticsWidget; var DashboardWidget, SelectDropdown, Button, icon, listItems, ItemList, abbreviateNumber, StatisticsWidget;
return { return {
setters: [function (_flarumComponentsDashboardWidget) { setters: [function (_flarumComponentsDashboardWidget) {
DashboardWidget = _flarumComponentsDashboardWidget.default; DashboardWidget = _flarumComponentsDashboardWidget.default;
@ -19,6 +19,8 @@ System.register('flarum/statistics/components/StatisticsWidget', ['flarum/compon
listItems = _flarumHelpersListItems.default; listItems = _flarumHelpersListItems.default;
}, function (_flarumUtilsItemList) { }, function (_flarumUtilsItemList) {
ItemList = _flarumUtilsItemList.default; ItemList = _flarumUtilsItemList.default;
}, function (_flarumUtilsAbbreviateNumber) {
abbreviateNumber = _flarumUtilsAbbreviateNumber.default;
}], }],
execute: function () { execute: function () {
StatisticsWidget = function (_DashboardWidget) { StatisticsWidget = function (_DashboardWidget) {
@ -44,7 +46,7 @@ System.register('flarum/statistics/components/StatisticsWidget', ['flarum/compon
}; };
this.selectedEntity = 'users'; this.selectedEntity = 'users';
this.selectedPeriod = 'last_12_months'; this.selectedPeriod = 'last_7_days';
} }
}, { }, {
key: 'className', key: 'className',
@ -86,6 +88,7 @@ System.register('flarum/statistics/components/StatisticsWidget', ['flarum/compon
) )
), ),
this.entities.map(function (entity) { this.entities.map(function (entity) {
var totalCount = _this2.getTotalCount(entity);
var thisPeriodCount = _this2.getPeriodCount(entity, thisPeriod); var thisPeriodCount = _this2.getPeriodCount(entity, thisPeriod);
var lastPeriodCount = _this2.getPeriodCount(entity, _this2.getLastPeriod(thisPeriod)); var lastPeriodCount = _this2.getPeriodCount(entity, _this2.getLastPeriod(thisPeriod));
var periodChange = lastPeriodCount > 0 && (thisPeriodCount - lastPeriodCount) / lastPeriodCount * 100; var periodChange = lastPeriodCount > 0 && (thisPeriodCount - lastPeriodCount) / lastPeriodCount * 100;
@ -100,13 +103,13 @@ System.register('flarum/statistics/components/StatisticsWidget', ['flarum/compon
), ),
m( m(
'div', 'div',
{ className: 'StatisticsWidget-total' }, { className: 'StatisticsWidget-total', title: totalCount },
_this2.getTotalCount(entity) abbreviateNumber(totalCount)
), ),
m( m(
'div', 'div',
{ className: 'StatisticsWidget-period' }, { className: 'StatisticsWidget-period', title: thisPeriodCount },
thisPeriodCount, abbreviateNumber(thisPeriodCount),
' ', ' ',
periodChange ? m( periodChange ? m(
'span', 'span',

View File

@ -29,7 +29,7 @@ export default class StatisticsWidget extends DashboardWidget {
}; };
this.selectedEntity = 'users'; this.selectedEntity = 'users';
this.selectedPeriod = 'last_12_months'; this.selectedPeriod = 'last_7_days';
} }
className() { className() {