Files
wekan/client/components/settings/settingHeader.js
T
Lauri Ojansivu f83234f0d8 Admin Panel: its four tabs are icons in the first header bar.
Fifth of the header restructure, and the answer to the question I had left open:
the panel's tabs are navigation BETWEEN its four pages rather than controls of
one, so they do not belong in a right sidebar with a page's controls. They
belong where you can always see which of the four you are on - the first header
bar, immediately left of the notification bell.

Icon only, each named by a translated tooltip, because that bar is a single row
shared with the logo, the starred boards, the notification bell and the user
menu; four labelled buttons would not fit beside them. They link by route NAME,
as they did.

The tab bar goes with them, and its four route references. "Admin Panel" is
already what the first bar says on all four routes - models/lib/pageTitles.js
has mapped them since the first step - so the panel is named once, there, rather
than by an h1 of its own.

Which routes ARE the Admin Panel is read from the one place that already lists
them, adminUrls.js, rather than spelled out again in the header.

Three guards followed. The same mistake as last time was caught by the same
guard: settingHeader.js still registered onCreated, onDestroyed and helpers on a
template that no longer existed, which throws at module load and aborts every
module after it - they are on adminPanelTabs now. The security-log guard checked
for a `.setting-header-btn.problems`, and the multitenancy guard checked that
Settings and Problems sit behind the site-admin check; both properties are
unchanged and both now read the markup where it is.

Remaining: the board's own second header bar, which is the last one with
controls in it.

Thanks to xet7 !
2026-07-31 13:22:28 +03:00

40 lines
1.3 KiB
JavaScript

import { FlowRouter } from 'meteor/ostrio:flow-router-extra';
// Reactive "are there any new problems?" flag, polled from the admin-only
// eventLogProblemAreas method, so the Problems button turns red when there are
// unacknowledged Security/Speed/Tests problems.
const hasProblemsVar = new ReactiveVar(false);
let problemsTimer = null;
function refreshProblems() {
Meteor.call('eventLogProblemAreas', (err, res) => {
hasProblemsVar.set(!err && Array.isArray(res) && res.length > 0);
});
}
Template.adminPanelTabs.onCreated(function () {
refreshProblems();
problemsTimer = Meteor.setInterval(refreshProblems, 30000);
});
Template.adminPanelTabs.onDestroyed(function () {
if (problemsTimer) Meteor.clearInterval(problemsTimer);
});
Template.adminPanelTabs.helpers({
isProblemsActive() {
return FlowRouter.getRouteName() === 'admin-reports' ? 'active' : '';
},
// 'has-problems' → red background (see settingHeader.css) when there are new problems.
problemsClass() {
return hasProblemsVar.get() ? 'has-problems' : '';
},
isSettingsActive() {
return FlowRouter.getRouteName() === 'setting' ? 'active' : '';
},
isPeopleActive() {
return FlowRouter.getRouteName() === 'people' ? 'active' : '';
},
isAttachmentsActive() {
return FlowRouter.getRouteName() === 'attachments' ? 'active' : '';
},
});