Skip to content

feature: make the tags graph drilldown button an Enable/Disable Tags toggle - #25

Merged
TheWitness merged 3 commits into
developfrom
fix/shorten-tags-graph-button-title
Oct 13, 2026
Merged

TheWitness merged 3 commits into
developfrom
fix/shorten-tags-graph-button-title

Conversation

@TheWitness

@TheWitness TheWitness commented Oct 12, 2026 •

Copy link
Copy Markdown
Member

Summary

Reworks this plugin's graph drilldown action button from a static link into a stateful Enable Tags / Disable Tags toggle, mirroring the Thold VRULE toggle pattern.

Cacti's graph action (drilldown) menu now renders each registered button's title as a visible text label. Rather than a static Tags link to the tags page, the button now toggles whether this plugin's tag legend lines are drawn on graphs, and its label reflects the current session state.

Changes

  • include/functions.php - plugin_tags_graph_button(): now flips a session draw-state (sess_config_array['tags_draw']) via a tags_draw request var and renders Enable Tags / Disable Tags (two complete i18n strings, not an appended On/Off fragment) with a toggle URL. Any existing tags_draw parameter is stripped first so a click never duplicates it.
  • include/functions.php - plugin_tags_rrd_graph_graph_options(): skips drawing the tag legend lines when the toggle is off. Tags are drawn by default, preserving prior behaviour.
  • tests/Unit/TagsGraphButtonTest.php - rewritten to cover every toggle branch, the URL dedup (including the first-parameter case), and the legend-draw gate; full standard GPL header.
  • tests/bootstrap-unit.php - add an isset_request_var stub (function_exists-guarded).
  • locales/po/cacti.pot - regenerated for the new Enable Tags / Disable Tags strings.
  • CHANGELOG.md - entry under develop.

Note on scope

This supersedes the original "shorten the title to Tags" scope: per maintainer direction the button becomes a state toggle instead of a navigation link. The Tags management page remains reachable from the console menu.

Testing

  • php -l - clean on all changed PHP files.
  • php tests/bin/check-i18n-pot.php origin/develop - OK (pot included).
  • Unit tests drive all toggle states, URL dedup across parameter positions, and the legend gate.

The graph action menu now renders each drilldown button's title as a visible label, so 'Show tags for this graph' reads as an overlong menu entry. Shorten it to 'Tags', add a unit test exercising plugin_tags_graph_button() so the changed line stays covered, and regenerate locales/po/cacti.pot.
@TheWitness
TheWitness requested review from bmfmancini and xmacan and a balanced review from Copilot October 12, 2026 20:24

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The new PHP test file omits the repository-required standard GPL license header.

1 open finding
What changed in this PR

Shortens the graph drilldown label to “Tags” and adds corresponding coverage and localization updates.

Changes:

  • Replaces the verbose graph-button title.
  • Adds unit coverage and regenerates the gettext template.
  • Documents the change in the changelog.
File Description
include/​functions.php Shortens the graph-button title.
tests/​Unit/​TagsGraphButtonTest.php Tests rendered title, icon, and link.
locales/​po/​cacti.pot Updates translation references.
CHANGELOG.md Records the label change.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread tests/Unit/TagsGraphButtonTest.php
xmacan
xmacan previously approved these changes Oct 13, 2026
Mirror thold's VRULE toggle: the graph drilldown button now flips a
session draw-state (sess_config_array['tags_draw']) and shows 'Enable Tags'
or 'Disable Tags' per that state, and plugin_tags_rrd_graph_graph_options()
skips drawing the tag legend lines when the toggle is off. Two complete
i18n strings (not an appended On/Off fragment) so the label stays
grammatical across translations. Rewrite the unit test to cover all toggle
branches + the legend gate, add the isset_request_var bootstrap stub, use
the full GPL header, and regenerate cacti.pot.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The implementation contradicts the stated scope and generates conflicting query parameters in a common navigation path.

2 open findings
1 resolved since last review

🧠 Review effort: Balanced

Comment thread include/functions.php Outdated
Comment thread include/functions.php
@TheWitness TheWitness changed the title issue: shorten tags graph drilldown button title to 'Tags' feature: make the tags graph drilldown button an Enable/Disable Tags toggle Oct 13, 2026
@TheWitness
TheWitness requested a balanced review from Copilot October 13, 2026 15:07

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

The new test file still lacks the required complete GPL header.

0 open findings

2 resolved since last review
Previously missed (1)

In code that hasn't changed since last review

Low severity Restore complete standard GPL header in new test

tests/​Unit/​TagsGraphButtonTest.php:15

The new test still omits the warranty and Cacti Group attribution paragraphs from the required standard PHP GPL header; compare setup.php:2-23 and tests/Unit/CspNonceTest.php:2-23. Replace this abbreviated block with the complete repository header.

🧠 Review effort: Balanced

@TheWitness
TheWitness merged commit 67754eb into develop Oct 13, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants