mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-02-26 08:31:22 +01:00
fix: #8105, fix export json on page load
This commit is contained in:
@@ -465,7 +465,7 @@ define('admin/general/dashboard', ['semver', 'Chart', 'translator', 'benchpress'
|
|||||||
// Update the View as JSON button url
|
// Update the View as JSON button url
|
||||||
var apiEl = $('#view-as-json');
|
var apiEl = $('#view-as-json');
|
||||||
var newHref = $.param({
|
var newHref = $.param({
|
||||||
units: units,
|
units: units || 'hours',
|
||||||
until: until,
|
until: until,
|
||||||
count: amount,
|
count: amount,
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ const _ = require('lodash');
|
|||||||
const versions = require('../../admin/versions');
|
const versions = require('../../admin/versions');
|
||||||
const db = require('../../database');
|
const db = require('../../database');
|
||||||
const meta = require('../../meta');
|
const meta = require('../../meta');
|
||||||
const analytics = require('../../analytics').async;
|
const analytics = require('../../analytics');
|
||||||
const plugins = require('../../plugins');
|
const plugins = require('../../plugins');
|
||||||
const user = require('../../user');
|
const user = require('../../user');
|
||||||
const utils = require('../../utils');
|
const utils = require('../../utils');
|
||||||
@@ -93,7 +93,7 @@ dashboardController.getAnalytics = async (req, res, next) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const method = req.query.units === 'days' ? analytics.getDailyStatsForSet : analytics.getHourlyStatsForSet;
|
const method = req.query.units === 'days' ? analytics.getDailyStatsForSet : analytics.getHourlyStatsForSet;
|
||||||
let payload = await Promise.all(sets.map(async set => method('analytics:' + set, until, count)));
|
let payload = await Promise.all(sets.map(set => method('analytics:' + set, until, count)));
|
||||||
payload = _.zipObject(sets, payload);
|
payload = _.zipObject(sets, payload);
|
||||||
|
|
||||||
res.json({
|
res.json({
|
||||||
|
|||||||
Reference in New Issue
Block a user