Files
wekan/client/components/settings/settingHeader.js
T
Lauri Ojansivu 0085f7fbfa Admin Panel: Problems button + page (Summary/Security/Speed/Tests), replaces banner & Reports button.
- 2nd header bar: add a Problems button (warning icon) to the RIGHT of the Info
  (version) button; it turns red when there are new problems (settingHeader.js
  polls eventLogProblemAreas). Remove the old Reports button; the Admin Panel
  still opens on Settings.
- The former Reports page is now the Problems page: left menu Summary / Security /
  Speed / Tests, then a separator, then the moved Broken Cards/Files/Rules/Boards/
  Cards/Impersonation items.
- Summary (problemsSummary, renamed from the removed top banner): the checkbox
  list + one Acknowledge button — the ONLY place to acknowledge.
- Security/Speed/Tests: read-only, paginated, searchable event tables via new
  admin-only eventLogPage/eventLogCount methods; acknowledgeEventLog now takes a
  stream or array.
- i18n keys + CSS + source-guard tests + design doc updated.
2026-07-19 13:42:47 +03:00

49 lines
1.6 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.settingHeaderBar.onCreated(function () {
refreshProblems();
problemsTimer = Meteor.setInterval(refreshProblems, 30000);
});
Template.settingHeaderBar.onDestroyed(function () {
if (problemsTimer) Meteor.clearInterval(problemsTimer);
});
Template.settingHeaderBar.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' : '';
},
isFeaturesActive() {
return FlowRouter.getRouteName() === 'admin-features' ? 'active' : '';
},
isAttachmentsActive() {
return FlowRouter.getRouteName() === 'attachments' ? 'active' : '';
},
isTranslationActive() {
return FlowRouter.getRouteName() === 'translation' ? 'active' : '';
},
isInformationActive() {
return FlowRouter.getRouteName() === 'information' ? 'active' : '';
},
});