[PR #3268] [MERGED] Cleaned up logic for calculating power draw #12535

Closed
opened 2025-12-29 22:22:08 +01:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/netbox-community/netbox/pull/3268
Author: @jeremystretch
Created: 6/19/2019
Status: Merged
Merged: 6/20/2019
Merged by: @jeremystretch

Base: develop-2.6Head: power-utilization-tweaks


📝 Commits (2)

  • 1a5aaf5 Cleaned up logic for calculating power draw
  • 625a097 minor tweaks to error handling to allow for defaulted values from pre v2.6 data

📊 Changes

7 files changed (+113 additions, -89 deletions)

View changed files

📝 netbox/dcim/models.py (+38 -49)
📝 netbox/dcim/tables.py (+10 -2)
📝 netbox/project-static/css/base.css (+1 -0)
📝 netbox/templates/dcim/device.html (+24 -12)
📝 netbox/templates/dcim/powerfeed.html (+13 -25)
📝 netbox/templates/dcim/rack.html (+7 -1)
📝 netbox/utilities/templatetags/helpers.py (+20 -0)

📄 Description

My attempt at cleaning up the power draw calculation logic. I've rewritten get_power_stats as get_power_draw to include only values relevant to the PowerPort itself; PowerFeed metrics are handled elsewhere.

I've also introduced two simple new template filters (divide and percentage) for convenience.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/netbox-community/netbox/pull/3268 **Author:** [@jeremystretch](https://github.com/jeremystretch) **Created:** 6/19/2019 **Status:** ✅ Merged **Merged:** 6/20/2019 **Merged by:** [@jeremystretch](https://github.com/jeremystretch) **Base:** `develop-2.6` ← **Head:** `power-utilization-tweaks` --- ### 📝 Commits (2) - [`1a5aaf5`](https://github.com/netbox-community/netbox/commit/1a5aaf54dd2a2bd05e9946260b76aefe920f4a35) Cleaned up logic for calculating power draw - [`625a097`](https://github.com/netbox-community/netbox/commit/625a09785a6558f2d9eb0c056a2cad11547e1e55) minor tweaks to error handling to allow for defaulted values from pre v2.6 data ### 📊 Changes **7 files changed** (+113 additions, -89 deletions) <details> <summary>View changed files</summary> 📝 `netbox/dcim/models.py` (+38 -49) 📝 `netbox/dcim/tables.py` (+10 -2) 📝 `netbox/project-static/css/base.css` (+1 -0) 📝 `netbox/templates/dcim/device.html` (+24 -12) 📝 `netbox/templates/dcim/powerfeed.html` (+13 -25) 📝 `netbox/templates/dcim/rack.html` (+7 -1) 📝 `netbox/utilities/templatetags/helpers.py` (+20 -0) </details> ### 📄 Description My attempt at cleaning up the power draw calculation logic. I've rewritten `get_power_stats` as `get_power_draw` to include only values relevant to the PowerPort itself; PowerFeed metrics are handled elsewhere. I've also introduced two simple new template filters (`divide` and `percentage`) for convenience. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
adam added the pull-request label 2025-12-29 22:22:08 +01:00
adam closed this issue 2025-12-29 22:22:08 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#12535