Refactor manual dictionary mutation for state_timeline panels#28
Conversation
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>
|
👋 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 New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
Refactored manual patching of uptime mappings, displayName, and bar text suppression into the
state_timelinehelper function arguments.Changes:
state_timelinehelper function inscripts/build_dashboard.pyto include parameters fordisplay_name,show_value,mappings, andthresholds.display_name, it defaults toNoneso that thedisplayNamekey is only added to thedefaultsdictionary when explicitly provided. This prevents overriding Grafana's default label inference with an empty string, which causes visual regressions.p_uptime,p_power, andp_roamingto directly pass their configuration intostate_timeline, appending the returned panel to the dashboard directly without manual dictionary mutations.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