mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-02 03:55:55 +01:00
feat: update user list in dashboard/users on graph update
This commit is contained in:
@@ -1,14 +1,32 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
define('admin/dashboard/users', ['admin/modules/dashboard-line-graph'], (graph) => {
|
define('admin/dashboard/users', ['admin/modules/dashboard-line-graph', 'hooks'], (graph, hooks) => {
|
||||||
const ACP = {};
|
const ACP = {};
|
||||||
|
|
||||||
ACP.init = () => {
|
ACP.init = () => {
|
||||||
graph.init({
|
graph.init({
|
||||||
set: 'registrations',
|
set: 'registrations',
|
||||||
dataset: ajaxify.data.dataset,
|
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, 'users', payload, function (html) {
|
||||||
|
const tbodyEl = document.querySelector('.users-list tbody');
|
||||||
|
tbodyEl.innerHTML = '';
|
||||||
|
tbodyEl.append(...html.map((idx, el) => el));
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
return ACP;
|
return ACP;
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
<!-- IMPORT admin/partials/dashboard/graph.tpl -->
|
<!-- IMPORT admin/partials/dashboard/graph.tpl -->
|
||||||
<!-- IMPORT admin/partials/dashboard/stats.tpl -->
|
<!-- IMPORT admin/partials/dashboard/stats.tpl -->
|
||||||
|
|
||||||
<table class="table table-striped">
|
<table class="table table-striped users-list">
|
||||||
<thead>
|
<thead>
|
||||||
<th class="text-muted">[[admin/manage/users:users.uid]]</th>
|
<th class="text-muted">[[admin/manage/users:users.uid]]</th>
|
||||||
<th class="text-muted">[[admin/manage/users:users.username]]</th>
|
<th class="text-muted">[[admin/manage/users:users.username]]</th>
|
||||||
|
|||||||
Reference in New Issue
Block a user