Skip to content

Refactor manual dictionary mutation for state_timeline panels#28

Merged
arvarik merged 1 commit into
mainfrom
refactor-state-timeline-7472208433390717435
Mar 10, 2026
Merged

Refactor manual dictionary mutation for state_timeline panels#28
arvarik merged 1 commit into
mainfrom
refactor-state-timeline-7472208433390717435

Conversation

@arvarik

@arvarik arvarik commented Mar 10, 2026

Copy link
Copy Markdown
Owner

Refactored manual patching of uptime mappings, displayName, and bar text suppression into the state_timeline helper function arguments.

Changes:

  • Updated the state_timeline helper function in scripts/build_dashboard.py to include parameters for display_name, show_value, mappings, and thresholds.
  • These parameters use safe, backward-compatible default values. For display_name, it defaults to None so that the displayName key is only added to the defaults dictionary when explicitly provided. This prevents overriding Grafana's default label inference with an empty string, which causes visual regressions.
  • Refactored p_uptime, p_power, and p_roaming to directly pass their configuration into state_timeline, appending the returned panel to the dashboard directly without manual dictionary mutations.
  • Re-ran the generation script (python3 scripts/build_dashboard.py) and executed tests (make test) to ensure everything is working correctly.

PR created automatically by Jules for task 7472208433390717435 started by @arvarik

This commit updates the `state_timeline` helper function in
`scripts/build_dashboard.py` to accept arguments for
`display_name`, `show_value`, `mappings`, and `thresholds`.

This eliminates the need to manually mutate the dictionary
returned by `state_timeline` for specific panels (uptime,
power, roaming), making the panel creation code cleaner
and more robust. It uses backward-compatible defaults to
prevent altering unrefactored usages or breaking Grafana's
default behaviors when properties like `displayName` are missing.

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@arvarik
arvarik merged commit 29207da into main Mar 10, 2026
1 check passed
@arvarik
arvarik deleted the refactor-state-timeline-7472208433390717435 branch March 10, 2026 22:11
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.

1 participant