mirror of
https://github.com/wekan/wekan.git
synced 2026-11-26 01:49:41 -05:00
- 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.
53 lines
1.7 KiB
JavaScript
53 lines
1.7 KiB
JavaScript
import { TAPi18n } from '/imports/i18n';
|
|
|
|
// Admin Panel → Problems → Summary page: a checkbox list of problem areas
|
|
// (Security / Speed / Tests) with each area's menu path and its count of NEW
|
|
// (unacknowledged) problems, plus ONE Acknowledge button that acknowledges every
|
|
// checked area. This is the ONLY place problems are acknowledged — the Security /
|
|
// Speed / Tests detail pages are read-only.
|
|
// Design: docs/Security/Remediation/WeKan.md. Data: the admin-only
|
|
// eventLogProblemAreas / acknowledgeEventLog methods (models/eventLog.js).
|
|
|
|
const STREAM_LABEL_KEY = {
|
|
security: 'securityReportTitle',
|
|
speed: 'speedReportTitle',
|
|
tests: 'testsReportTitle',
|
|
};
|
|
|
|
Template.problemsSummary.onCreated(function () {
|
|
this.areas = new ReactiveVar([]);
|
|
this.reload = () => {
|
|
Meteor.call('eventLogProblemAreas', (err, res) => {
|
|
if (!err) this.areas.set(Array.isArray(res) ? res : []);
|
|
});
|
|
};
|
|
this.reload();
|
|
this.timer = Meteor.setInterval(this.reload, 30000);
|
|
});
|
|
|
|
Template.problemsSummary.onDestroyed(function () {
|
|
if (this.timer) Meteor.clearInterval(this.timer);
|
|
});
|
|
|
|
Template.problemsSummary.helpers({
|
|
areas() {
|
|
return Template.instance().areas.get();
|
|
},
|
|
hasProblems() {
|
|
return (Template.instance().areas.get() || []).length > 0;
|
|
},
|
|
areaLabel(stream) {
|
|
return TAPi18n.__(STREAM_LABEL_KEY[stream] || stream);
|
|
},
|
|
});
|
|
|
|
Template.problemsSummary.events({
|
|
'click .js-ack-checked'(event, templateInstance) {
|
|
const streams = Array.from(templateInstance.findAll('.js-problem-check:checked'))
|
|
.map(el => el.getAttribute('data-stream'))
|
|
.filter(Boolean);
|
|
if (!streams.length) return;
|
|
Meteor.call('acknowledgeEventLog', streams, () => templateInstance.reload());
|
|
},
|
|
});
|