Files
wekan/client/components/settings/adminProblems.jade
T
Lauri Ojansivu 760bd09044 Admin Panel / Problems: one active pane, instead of eleven booleans saying the same thing.
Every pane on the Problems page had a ReactiveVar of its own -
`this.showSummary`, `this.showSecurity`, `this.showIntegrity` and eight more -
on top of `activeReport`, which already held the id of the open pane. The
booleans could only ever be "activeReport equals my id", so they were forty-four
lines restating one value, and keeping them in step was manual: opening a pane
reset all eleven and set one.

That cost a pane four wiring points instead of one, and missing any of them
failed SILENTLY. Filesystem integrity got three of the four - menu entry, setter
and template branch - and no helper, and in Blaze an undefined helper is not an
error but a falsy value, so the pane drew a blank page while Summary went on
counting the problems it could not show. The Offices pane added in this release
had the same shape of hole in a different place: it set no `loading.set(false)`,
so opening it would have spun for ever.

The template asks `else if isPane 'report-integrity'` now, against one helper.
Panes that fetch through a method rather than a subscription are a list -
SELF_LOADING_PANES - which is also what fixes Offices: it is in the list, so the
spinner clears. Adding a pane is a menu entry, a branch, and one line saying how
it loads.

The guards move with it. tests/adminPaneHelpers.test.cjs, written when the
integrity pane was blank, now pins both halves of the new mechanism: the helper
must exist, and every id the template branches on must be an id the menu sets -
a typo either way is dead template or a blank pane, and neither says anything at
runtime. tests/problemsMenuOrder.test.cjs checks the invariant for EVERY pane
rather than three named ones: each menu entry must be rendered, and must either
load itself or have a report config, so a pane that spins for ever cannot ship
again. A negative test fails if a `this.showX = new ReactiveVar` comes back.

Thanks to xet7 !
2026-08-16 16:51:33 +03:00

134 lines
5.5 KiB
Plaintext

template(name="adminProblems")
.setting-content.admin-reports-content
unless currentUser.isAdmin
| {{_ 'error-notAuthorized'}}
else
.content-body
+leftMenu(menuItems)
.main-body
//- Every Admin Panel pane opens with the same heading, and it is the
//- open menu entry's own label (docs/Features/Page/Left-Menu.md).
+paneTitle(paneTitleData)
if loading.get
+spinner
else if isPane 'report-summary'
+problemsSummary
else if isPane 'features-performance'
+featuresPerformance
else if isPane 'features-security'
+featuresSecurity
else if isPane 'features-notifications'
+featuresNotifications
else if isPane 'report-security'
+eventStreamReport(stream="security")
else if isPane 'report-speed'
+eventStreamReport(stream="speed")
else if isPane 'report-tests'
+eventStreamReport(stream="tests")
else if isPane 'report-cpu'
+eventStreamReport(stream="cpu")
else if isPane 'report-database'
+eventStreamReport(stream="database")
else if isPane 'report-integrity'
+eventStreamReport(stream="integrity")
else if isPane 'report-office'
+officeReport
else if tablePageData
+tablePage(tablePageData)
template(name="officeReport")
//- Where people log in from, grouped. Through the shared table page like every
//- other report here (docs/Features/Page/Table.md).
+tablePage(tablePageData)
template(name="eventStreamReport")
//- Security / Speed / Tests / CPU usage all render through the shared table
//- page (docs/Features/Page/Table.md). CPU usage additionally passes the live
//- figure as the status row between the title and the controls.
+tablePage(tablePageData)
template(name="cpuCurrentStatus")
.admin-cpu-current(class="{{#if high}}admin-cpu-high{{/if}}")
span.admin-cpu-label {{_ 'cpu-usage-current'}}
span.admin-cpu-percent {{percent}}%
span.quiet
| {{cores}} {{_ 'cpu-cores-suffix'}} · {{_ 'cpu-load-average'}} {{loadAverage}}
if activity
span.quiet · {{activity}}
//- Performance, Security and Notifications. They were the whole of Admin Panel /
//- Features, which is gone; they are Problems panes now and live with the page that
//- renders them. Each is its own template so its helpers and handlers can live ON it -
//- Blaze resolves both against the template an element is IN, never an enclosing one.
//- Admin Panel / Problems / Performance.
template(name="featuresPerformance")
ul.setting-detail
li.layout-form
.title {{_ 'cards-loading'}}
p.description {{_ 'cards-loading-description'}}
//- Admin Panel / Problems / Security.
template(name="featuresSecurity")
ul.setting-detail
li
a.flex.js-toggle-render-links-as-plain-text
.materialCheckBox(class="{{#if renderLinksAsPlainText}}is-checked{{/if}}")
span {{_ 'render-links-as-plain-text'}}
p.description {{_ 'render-links-as-plain-text-description'}}
li
a.flex.js-toggle-always-show-code-as-text
.materialCheckBox(class="{{#if alwaysShowCodeAsText}}is-checked{{/if}}")
span {{_ 'always-show-code-as-text'}}
p.description {{_ 'always-show-code-as-text-description'}}
li
a.flex.js-toggle-disable-all-import
.materialCheckBox(class="{{#if disableAllImport}}is-checked{{/if}}")
span {{_ 'disable-all-import'}}
p.description {{_ 'disable-all-import-description'}}
li
a.flex.js-toggle-disable-all-export
.materialCheckBox(class="{{#if disableAllExport}}is-checked{{/if}}")
span {{_ 'disable-all-export'}}
p.description {{_ 'disable-all-export-description'}}
li
a.flex.js-toggle-disable-import-avatars
.materialCheckBox(class="{{#if disableImportAvatars}}is-checked{{/if}}")
span {{_ 'disable-import-avatars'}}
p.description {{_ 'disable-import-avatars-description'}}
li
a.flex.js-toggle-disable-export-avatars
.materialCheckBox(class="{{#if disableExportAvatars}}is-checked{{/if}}")
span {{_ 'disable-export-avatars'}}
p.description {{_ 'disable-export-avatars-description'}}
li
a.flex.js-toggle-anonymize-import-users
.materialCheckBox(class="{{#if anonymizeImportUsers}}is-checked{{/if}}")
span {{_ 'anonymize-import-users'}}
p.description {{_ 'anonymize-import-users-description'}}
li
a.flex.js-toggle-anonymize-export-users
.materialCheckBox(class="{{#if anonymizeExportUsers}}is-checked{{/if}}")
span {{_ 'anonymize-export-users'}}
p.description {{_ 'anonymize-export-users-description'}}
//- Admin Panel / Problems / Notifications.
template(name="featuresNotifications")
ul.setting-detail
li
a.flex.js-toggle-disable-activities
.materialCheckBox(class="{{#if disableActivities}}is-checked{{/if}}")
span {{_ 'disable-activities'}}
p.description {{_ 'disable-activities-description'}}
li
a.flex.js-toggle-disable-notifications
.materialCheckBox(class="{{#if disableNotifications}}is-checked{{/if}}")
span {{_ 'disable-notifications'}}
p.description {{_ 'disable-notifications-description'}}
li
a.flex.js-toggle-disable-watch
.materialCheckBox(class="{{#if disableWatch}}is-checked{{/if}}")
span {{_ 'disable-watch'}}
p.description {{_ 'disable-watch-description'}}