mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-05-06 12:27:15 +02:00
feat: topics dashboard details subpage
This commit is contained in:
@@ -76,5 +76,10 @@
|
||||
"graphs.registered-users": "Registered Users",
|
||||
"graphs.anonymous-users": "Anonymous Users",
|
||||
"last-restarted-by": "Last restarted by",
|
||||
"no-users-browsing": "No users browsing"
|
||||
"no-users-browsing": "No users browsing",
|
||||
|
||||
"back-to-dashboard": "Back to Dashboard",
|
||||
"details.no-users": "No users have joined within the selected timeframe",
|
||||
"details.no-topics": "No topics have been posted within the selected timeframe",
|
||||
"details.no-logins": "No logins have been recorded within the selected timeframe"
|
||||
}
|
||||
|
||||
@@ -1,14 +1,32 @@
|
||||
'use strict';
|
||||
|
||||
define('admin/dashboard/topics', ['admin/modules/dashboard-line-graph'], (graph) => {
|
||||
define('admin/dashboard/topics', ['admin/modules/dashboard-line-graph', 'hooks'], (graph, hooks) => {
|
||||
const ACP = {};
|
||||
|
||||
ACP.init = () => {
|
||||
graph.init({
|
||||
set: 'topics',
|
||||
dataset: ajaxify.data.dataset,
|
||||
}).then(() => {
|
||||
hooks.onPage('action:admin.dashboard.updateGraph', ACP.updateTable);
|
||||
});
|
||||
};
|
||||
|
||||
ACP.updateTable = () => {
|
||||
if (window.fetch) {
|
||||
fetch(`${config.relative_path}/api${ajaxify.data.url}${window.location.search}`, { credentials: 'include' }).then((response) => {
|
||||
if (response.ok) {
|
||||
response.json().then(function (payload) {
|
||||
app.parseAndTranslate(ajaxify.data.template.name, 'topics', payload, function (html) {
|
||||
const tbodyEl = document.querySelector('.topics-list tbody');
|
||||
tbodyEl.innerHTML = '';
|
||||
tbodyEl.append(...html.map((idx, el) => el));
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
return ACP;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user