[PR #5672] [MERGED] Indicate when cable length is not definitive #13046

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

📋 Pull Request Information

Original PR: https://github.com/netbox-community/netbox/pull/5672
Author: @cpmills1975
Created: 1/22/2021
Status: Merged
Merged: 3/25/2021
Merged by: @jeremystretch

Base: developHead: 5650-render-incomplete-lengths


📝 Commits (1)

  • 02e8979 Changes to template, view and CablePath class to

📊 Changes

3 files changed (+12 additions, -4 deletions)

View changed files

📝 netbox/dcim/models/cables.py (+6 -2)
📝 netbox/dcim/views.py (+5 -1)
📝 netbox/templates/dcim/cable_trace.html (+1 -1)

📄 Description

indicate to users whether the cable length is
accurate or not.

Fixes: #5650

CablePath.get_total_length() retrieves Cable objects where _abs_length is not null as well as the id being in the list of IDs for the path. If the number of cables returned is equal to the number of cable IDs in the path, all cables have a length and the length is determined to be definitive.

The total length and whether it is definitive is returned in a tuple.

PathTraceView.get_extra_context handles the new is_definitive flag and returns that to the template.

The cable_trace template checks whether is_definitive is false and if it is, prefixes the total length with a greater than sign indicting that the length of the cable is at least as long as the length shown.

When cable length is definitive:

Screenshot 2021-01-22 at 16 57 44

When one or more cables have no length defined:

Screenshot 2021-01-22 at 16 58 08


🔄 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/5672 **Author:** [@cpmills1975](https://github.com/cpmills1975) **Created:** 1/22/2021 **Status:** ✅ Merged **Merged:** 3/25/2021 **Merged by:** [@jeremystretch](https://github.com/jeremystretch) **Base:** `develop` ← **Head:** `5650-render-incomplete-lengths` --- ### 📝 Commits (1) - [`02e8979`](https://github.com/netbox-community/netbox/commit/02e8979178783d562cc8a47cd6df097403b5fb6b) Changes to template, view and CablePath class to ### 📊 Changes **3 files changed** (+12 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `netbox/dcim/models/cables.py` (+6 -2) 📝 `netbox/dcim/views.py` (+5 -1) 📝 `netbox/templates/dcim/cable_trace.html` (+1 -1) </details> ### 📄 Description indicate to users whether the cable length is accurate or not. <!-- Thank you for your interest in contributing to NetBox! Please note that our contribution policy requires that a feature request or bug report be opened for approval prior to filing a pull request. This helps avoid wasting time and effort on something that we might not be able to accept. Please indicate the relevant feature request or bug report below. IF YOUR PULL REQUEST DOES NOT REFERENCE AN ACCEPTED BUG REPORT OR FEATURE REQUEST, IT WILL BE MARKED AS INVALID AND CLOSED. --> ### Fixes: #5650 <!-- Please include a summary of the proposed changes below. --> CablePath.get_total_length() retrieves Cable objects where _abs_length is not null as well as the id being in the list of IDs for the path. If the number of cables returned is equal to the number of cable IDs in the path, all cables have a length and the length is determined to be definitive. The total length and whether it is definitive is returned in a tuple. PathTraceView.get_extra_context handles the new is_definitive flag and returns that to the template. The cable_trace template checks whether is_definitive is false and if it is, prefixes the total length with a greater than sign indicting that the length of the cable is at least as long as the length shown. When cable length is definitive: ![Screenshot 2021-01-22 at 16 57 44](https://user-images.githubusercontent.com/1878544/105520850-1bd91b00-5cd3-11eb-9fd9-17e02bea138d.png) When one or more cables have no length defined: ![Screenshot 2021-01-22 at 16 58 08](https://user-images.githubusercontent.com/1878544/105520924-2f848180-5cd3-11eb-9417-76ae5d1e8621.png) --- <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:25:07 +01:00
adam closed this issue 2025-12-29 22:25:07 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#13046