Repository navigation
intropage: Panel Library status pills, column order, and add-panel prefix - #476
Conversation
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are reported for the dashboard status and source-label updates.
No open issues 🎉
What changed in this PR
Updates the Intropage dashboard UI to make panel status clearer and source labels consistent between the Panel Library and add-panel menu.
Changes:
- Moves Status immediately after Source and Update Function before Refresh.
- Displays status as centered green Enabled or red Disabled pills.
- Adds source prefixes to add-panel option labels, including options marked “no permission.”
| File | Description |
|---|---|
intropage_panels.php |
Reorders columns and renders escaped status labels as centered pills. |
includes/functions.php |
Applies source prefixes to add-panel dropdown labels. |
css/common.css |
Adds shared styling for enabled and disabled status pills. |
Review effort: Balanced
somethingwithproof
left a comment
There was a problem hiding this comment.
- Blocker: CI is red on two coverage gates. PHP patch coverage is 0/5:
includes/functions.php:2528,2533,2536,2541,2544are uncovered, andintropage_panels.phpis missing from Clover. The theme browser job reportscss/common.css218-236 (the new pill rules) as 0/15 covered. Both need tests: a unit case forintropage_addpanel_select()asserting the prefixed labels, and an e2e pass over the Panel Library page that renders an enabled and a disabled pill. - Suggestion: The
(no permission)options print__('%s (no permission)', $label, 'intropage')unescaped, while the enabled branches usehtml_escape($label).$labelnow also includes a prefix derived from the registering plugin's name. Use__esc()there so all four branches escape the same way. - Suggestion: The add-panel query still sorts with
ORDER BY pd.name, but the labels are now prefixed. Third-party panels therefore interleave withCore - ...entries by their unprefixed names, and the dropdown no longer reads as sorted. Sort$add_panelsby the computed label in PHP, or group by source.
4743327 to
8a086cf
Compare
Still work in progress.
8a086cf to
0c5ad4b
Compare
|
Addressed the CI failures on this PR: SonarCloud quality gate (was failing):
PHP integration (patch coverage gate):
Cacti theme browser regressions (changed-CSS coverage gate):
All checks are green now. |
somethingwithproof
left a comment
There was a problem hiding this comment.
No blockers found. CI is green, and the new IntropageAddPanelSelectTest and the pill contrast assertion in cacti-theme.spec.cjs cover the changed lines.
Two non-blocking leftovers from the last round, fine as a follow-up:
- The
(no permission)options still print__('%s (no permission)', $panel['name'], 'intropage')unescaped, while the enabled options usehtml_escape(). Since the label now carries the source prefix,__esc()there would make all four branches consistent. ORDER BY pd.namestill sorts on the unprefixed name, so<Plugin> - ...options interleave withCore - ...ones in the dropdown.
0c5ad4b to
f164622
Compare
|
Thanks @somethingwithproof — all three points addressed in the latest push ( Blocker (coverage gates): resolved. Reworked the change to keep CI green — PHP patch coverage is back to 100% and the new pill CSS is exercised:
Suggestion 1 (escaping): done. Both Suggestion 2 (sort order): done. Dropped As a side effect of an earlier Sonar duplication finding, the Panel Library column table was also collapsed into a compact definition loop rather than a repeated per-column array. |
…efix Panel Library list page: - Move the Status column to sit immediately after Source. - Swap the Update Function and Refresh columns so Update Function comes first (matches the requested layout). - Render Status as Enabled/Disabled pills (green/red) and center the column, with the pill styles added to css/common.css. Add-panel menu: - Prefix each option label with the panel's source via intropage_prefix_panel_name(), so the dropdown matches the Panel Library list. The name is prefixed once at the top of the loop so every option (including the '(no permission)' entries) stays consistent without duplicating the render branches. Tests: - Unit coverage for the add-panel source prefix (tests/Unit/IntropageAddPanelSelectTest.php). - Exercise the Enabled/Disabled pill styles and assert their label contrast across every theme in the e2e status-contrast test. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
f164622 to
1375a19
Compare
|
|
Follow-up on the escaping fix (@somethingwithproof): I switched away from Instead, the source-prefixed label is now HTML-escaped once (right after it is built, before the sort), and the four option branches consume that pre-escaped value:
Net result: the disabled options are escaped the same way as the enabled ones (your original concern), the i18n template needs no change, and SonarCloud stays green (reliability A, 0 issues, 0% duplication). All PHP/theme/coverage checks pass. |
somethingwithproof
left a comment
There was a problem hiding this comment.
LGTM. Clean, focused change; column/cell order lines up, the reference loop is unset correctly, and centralizing the escape also closes the raw name in the (no permission) branches. Matrix is green. Two optional follow-ups: usort runs on the html_escaped label (cosmetic ordering for names with entities), and the (string) cast on the name is inconsistent with intropage_panels.php.



Panel Library list page
css/common.css(reusing the existing intropage green/red palette), so they load on every page via thepage_headhook.[display, tip, align?, sort?]table rather than a repeated per-column array.Add-panel menu (dashboard toolbar)
Panels ...dropdown now appliesintropage_prefix_panel_name()to its option labels, so the source prefix (e.g.Core -,<Plugin> -) shows there too, matching the Panel Library list. The name is prefixed once at the top of the loop, so every option (including the(no permission)entries) stays consistent without duplicating the render branches.Tests
tests/Unit/IntropageAddPanelSelectTest.phpcovers the add-panel source prefix.Notes
#cc0000) and enabled use the intropage green (rgba(148,179,107,1)); easy to switch Disabled to grey if preferred.