mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-10-26 06:32:49 +00:00
feat(dashboard): bug report, play key and system log pages update without reloading
reloadInPlace() and goTo(url) (common.js) show the page again or open another one through nav.js, or reload/load normally without it. Resolving a bug report updates the page in place; deleting a bug report or play key goes back to its list without leaving the deleted page in the history. The System Log's server and file pickers and its Refresh button swap the page in (Refresh keeps the scroll position). The AI helper's "open the account" goes through nav.js too. Check: resolve a bug report: the Resolved badge and text appear with no reload. Delete a play key: back on Play Keys, and Back doesn't return to the deleted key. System Log: picking a server or file and Refresh change the log without a white flash. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -206,7 +206,7 @@
|
||||
var prefill = { account: String(data.account_id), action: s.action, days: s.days, strike: s.strike,
|
||||
reason: s.action === 'note' ? clip(s.staff_explanation, 300) : s.player_reason, at: Date.now() };
|
||||
try { sessionStorage.setItem(PREFILL_KEY, JSON.stringify(prefill)); } catch (e) { return toast('Could not pass the suggestion on (browser storage is off)', 'warning'); }
|
||||
window.location.href = '/accounts/' + encodeURIComponent(data.account_id);
|
||||
goTo('/accounts/' + encodeURIComponent(data.account_id));
|
||||
}
|
||||
|
||||
// On an account page: fill in the form a suggestion was passed to. Nothing is submitted.
|
||||
|
||||
@@ -92,6 +92,21 @@
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Show this page again with what the server has now, after a change made from it: in place when nav.js is there
|
||||
* (Nav.refresh), otherwise a reload. goTo(url) opens another page the same way (Nav.go, or a normal load).
|
||||
*/
|
||||
window.reloadInPlace = function () {
|
||||
if (window.Nav && Nav.refresh) return Nav.refresh({ force: true });
|
||||
window.location.reload();
|
||||
return Promise.resolve();
|
||||
};
|
||||
window.goTo = function (url, options) {
|
||||
if (window.Nav && Nav.go) return Nav.go(url, options);
|
||||
if (options && options.replace) window.location.replace(url); else window.location.href = url;
|
||||
return Promise.resolve();
|
||||
};
|
||||
|
||||
window.toast = function (message, type) {
|
||||
var container = document.getElementById('toast-container');
|
||||
if (!container) {
|
||||
|
||||
Reference in New Issue
Block a user