-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Fixes #11460 - Fix unterminated cable exception when editing cable #15813
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
jeremystretch
merged 7 commits into
develop
from
11460-fix_unterminated_cable_throws_exception
May 1, 2024
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
91efa14
Fix cable edit form with single unterminated cable
DanSheps 7a54302
Minor tweaks
DanSheps f37cb9b
Instead of skipping HTMX, override the template & move form template …
DanSheps fc3e52d
Use HTMXSelect widget for A/B type selection
jeremystretch 297ab4a
Infer A/B termination types from POST data
jeremystretch a16564f
Fix saving cable which results in resetting of the termination type f…
DanSheps b8a2c62
Condense view logic
jeremystretch File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,90 +1,5 @@ | ||
| {% extends 'generic/object_edit.html' %} | ||
| {% load static %} | ||
| {% load helpers %} | ||
| {% load form_helpers %} | ||
| {% load i18n %} | ||
|
|
||
| {% block form %} | ||
|
|
||
| {# A side termination #} | ||
| <div class="field-group mb-5"> | ||
| <div class="row mb-2"> | ||
| <h5 class="offset-sm-3">{% trans "A Side" %}</h5> | ||
| </div> | ||
| {% if 'termination_a_device' in form.fields %} | ||
| {% render_field form.termination_a_device %} | ||
| {% endif %} | ||
| {% if 'termination_a_powerpanel' in form.fields %} | ||
| {% render_field form.termination_a_powerpanel %} | ||
| {% endif %} | ||
| {% if 'termination_a_circuit' in form.fields %} | ||
| {% render_field form.termination_a_circuit %} | ||
| {% endif %} | ||
| {% render_field form.a_terminations %} | ||
| </div> | ||
|
|
||
| {# B side termination #} | ||
| <div class="field-group mb-5"> | ||
| <div class="row mb-2"> | ||
| <h5 class="offset-sm-3">{% trans "B Side" %}</h5> | ||
| </div> | ||
| {% if 'termination_b_device' in form.fields %} | ||
| {% render_field form.termination_b_device %} | ||
| {% endif %} | ||
| {% if 'termination_b_powerpanel' in form.fields %} | ||
| {% render_field form.termination_b_powerpanel %} | ||
| {% endif %} | ||
| {% if 'termination_b_circuit' in form.fields %} | ||
| {% render_field form.termination_b_circuit %} | ||
| {% endif %} | ||
| {% render_field form.b_terminations %} | ||
| </div> | ||
|
|
||
| {# Cable attributes #} | ||
| <div class="field-group mb-5"> | ||
| <div class="row mb-2"> | ||
| <h5 class="offset-sm-3">{% trans "Cable" %}</h5> | ||
| </div> | ||
| {% render_field form.status %} | ||
| {% render_field form.type %} | ||
| {% render_field form.label %} | ||
| {% render_field form.description %} | ||
| {% render_field form.color %} | ||
| <div class="row mb-3"> | ||
| <label class="col-sm-3 col-form-label text-lg-end">{{ form.length.label }}</label> | ||
| <div class="col-md-5"> | ||
| {{ form.length }} | ||
| </div> | ||
| <div class="col-md-4"> | ||
| {{ form.length_unit }} | ||
| </div> | ||
| <div class="invalid-feedback"></div> | ||
| </div> | ||
| {% render_field form.tags %} | ||
| </div> | ||
|
|
||
| <div class="field-group mb-5"> | ||
| <div class="row mb-2"> | ||
| <h5 class="offset-sm-3">{% trans "Tenancy" %}</h5> | ||
| </div> | ||
| {% render_field form.tenant_group %} | ||
| {% render_field form.tenant %} | ||
| </div> | ||
|
|
||
| {% if form.custom_fields %} | ||
| <div class="field-group mb-5"> | ||
| <div class="row mb-2"> | ||
| <h5 class="offset-sm-3">{% trans "Custom Fields" %}</h5> | ||
| </div> | ||
| {% render_custom_fields form %} | ||
| </div> | ||
| {% endif %} | ||
|
|
||
| {% if form.comments %} | ||
| <div class="field-group mb-5"> | ||
| <h5 class="text-center">{% trans "Comments" %}</h5> | ||
| {% render_field form.comments %} | ||
| </div> | ||
| {% endif %} | ||
|
|
||
| {% include 'dcim/htmx/cable_edit.html' %} | ||
| {% endblock %} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,92 @@ | ||
| {% load static %} | ||
| {% load helpers %} | ||
| {% load form_helpers %} | ||
| {% load i18n %} | ||
|
|
||
|
|
||
| {# A side termination #} | ||
| <div id="a_termination_block" class="field-group mb-5"> | ||
| <div class="row mb-2"> | ||
| <h5 class="offset-sm-3">{% trans "A Side" %}</h5> | ||
| </div> | ||
| {% render_field form.a_terminations_type %} | ||
| {% if 'termination_a_device' in form.fields %} | ||
| {% render_field form.termination_a_device %} | ||
| {% endif %} | ||
| {% if 'termination_a_powerpanel' in form.fields %} | ||
| {% render_field form.termination_a_powerpanel %} | ||
| {% endif %} | ||
| {% if 'termination_a_circuit' in form.fields %} | ||
| {% render_field form.termination_a_circuit %} | ||
| {% endif %} | ||
| {% if 'a_terminations' in form.fields %} | ||
| {% render_field form.a_terminations %} | ||
| {% endif %} | ||
| </div> | ||
|
|
||
| {# B side termination #} | ||
| <div id="b_termination_block" class="field-group mb-5"> | ||
| <div class="row mb-2"> | ||
| <h5 class="offset-sm-3">{% trans "B Side" %}</h5> | ||
| </div> | ||
| {% render_field form.b_terminations_type %} | ||
| {% if 'termination_b_device' in form.fields %} | ||
| {% render_field form.termination_b_device %} | ||
| {% endif %} | ||
| {% if 'termination_b_powerpanel' in form.fields %} | ||
| {% render_field form.termination_b_powerpanel %} | ||
| {% endif %} | ||
| {% if 'termination_b_circuit' in form.fields %} | ||
| {% render_field form.termination_b_circuit %} | ||
| {% endif %} | ||
| {% if 'b_terminations' in form.fields %} | ||
| {% render_field form.b_terminations %} | ||
| {% endif %} | ||
| </div> | ||
|
|
||
| {# Cable attributes #} | ||
| <div class="field-group mb-5"> | ||
| <div class="row mb-2"> | ||
| <h5 class="offset-sm-3">{% trans "Cable" %}</h5> | ||
| </div> | ||
| {% render_field form.status %} | ||
| {% render_field form.type %} | ||
| {% render_field form.label %} | ||
| {% render_field form.description %} | ||
| {% render_field form.color %} | ||
| <div class="row mb-3"> | ||
| <label class="col-sm-3 col-form-label text-lg-end">{{ form.length.label }}</label> | ||
| <div class="col-md-5"> | ||
| {{ form.length }} | ||
| </div> | ||
| <div class="col-md-4"> | ||
| {{ form.length_unit }} | ||
| </div> | ||
| <div class="invalid-feedback"></div> | ||
| </div> | ||
| {% render_field form.tags %} | ||
| </div> | ||
|
|
||
| <div class="field-group mb-5"> | ||
| <div class="row mb-2"> | ||
| <h5 class="offset-sm-3">{% trans "Tenancy" %}</h5> | ||
| </div> | ||
| {% render_field form.tenant_group %} | ||
| {% render_field form.tenant %} | ||
| </div> | ||
|
|
||
| {% if form.custom_fields %} | ||
| <div class="field-group mb-5"> | ||
| <div class="row mb-2"> | ||
| <h5 class="offset-sm-3">{% trans "Custom Fields" %}</h5> | ||
| </div> | ||
| {% render_custom_fields form %} | ||
| </div> | ||
| {% endif %} | ||
|
|
||
| {% if form.comments %} | ||
| <div class="field-group mb-5"> | ||
| <h5 class="text-center">{% trans "Comments" %}</h5> | ||
| {% render_field form.comments %} | ||
| </div> | ||
| {% endif %} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.