mirror of
https://github.com/flarum/framework.git
synced 2025-03-24 07:35:14 +08:00
Set default period to last 7 days
This commit is contained in:
parent
1780448e70
commit
410dd2c679
17
extensions/statistics/js/admin/dist/extension.js
vendored
17
extensions/statistics/js/admin/dist/extension.js
vendored
@ -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',
|
||||||
|
@ -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() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user