mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-23 04:22:01 -06:00
Compare commits
8 Commits
3c137aa3e0
...
6f7e9f8692
Author | SHA1 | Date | |
---|---|---|---|
![]() |
6f7e9f8692 | ||
![]() |
f61a2964c8 | ||
![]() |
ee94fb0b94 | ||
![]() |
8fb8f4c75b | ||
![]() |
5f58fe1eb5 | ||
![]() |
5fb81e9943 | ||
![]() |
e8891f770c | ||
![]() |
4739f27c14 |
@ -19,7 +19,8 @@ def load_initial_data(apps, schema_editor):
|
|||||||
'gpu',
|
'gpu',
|
||||||
'hard_disk',
|
'hard_disk',
|
||||||
'memory',
|
'memory',
|
||||||
'power_supply'
|
'power_supply',
|
||||||
|
'expansion_card'
|
||||||
)
|
)
|
||||||
|
|
||||||
for name in initial_profiles:
|
for name in initial_profiles:
|
||||||
|
@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"name": "Expansion card",
|
||||||
|
"schema": {
|
||||||
|
"properties": {
|
||||||
|
"connector_type": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "Connector type e.g. PCIe x4"
|
||||||
|
},
|
||||||
|
"bandwidth": {
|
||||||
|
"type": "integer",
|
||||||
|
"description": "Total Bandwidth for this module"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -220,6 +220,7 @@ class Cable(PrimaryModel):
|
|||||||
b_terminations = {ct.termination: ct for ct in self.terminations.filter(cable_end='B')}
|
b_terminations = {ct.termination: ct for ct in self.terminations.filter(cable_end='B')}
|
||||||
|
|
||||||
# Delete stale CableTerminations
|
# Delete stale CableTerminations
|
||||||
|
|
||||||
if self._terminations_modified:
|
if self._terminations_modified:
|
||||||
for termination, ct in a_terminations.items():
|
for termination, ct in a_terminations.items():
|
||||||
if termination.pk and termination not in self.a_terminations:
|
if termination.pk and termination not in self.a_terminations:
|
||||||
@ -312,6 +313,12 @@ class CableTermination(ChangeLoggedModel):
|
|||||||
def __str__(self):
|
def __str__(self):
|
||||||
return f'Cable {self.cable} to {self.termination}'
|
return f'Cable {self.cable} to {self.termination}'
|
||||||
|
|
||||||
|
def __init__(self, *args, **kwargs):
|
||||||
|
super().__init__(*args, **kwargs)
|
||||||
|
|
||||||
|
self._orig_cable = self.__dict__.get('cable')
|
||||||
|
self._orig_cable_end = self.__dict__.get('cable_end')
|
||||||
|
|
||||||
def clean(self):
|
def clean(self):
|
||||||
super().clean()
|
super().clean()
|
||||||
|
|
||||||
@ -349,6 +356,7 @@ class CableTermination(ChangeLoggedModel):
|
|||||||
|
|
||||||
# Cache objects associated with the terminating object (for filtering)
|
# Cache objects associated with the terminating object (for filtering)
|
||||||
self.cache_related_objects()
|
self.cache_related_objects()
|
||||||
|
created = self.pk is None
|
||||||
|
|
||||||
super().save(*args, **kwargs)
|
super().save(*args, **kwargs)
|
||||||
|
|
||||||
@ -359,6 +367,28 @@ class CableTermination(ChangeLoggedModel):
|
|||||||
termination.cable_end = self.cable_end
|
termination.cable_end = self.cable_end
|
||||||
termination.save()
|
termination.save()
|
||||||
|
|
||||||
|
# figure out which cable terminations changed
|
||||||
|
if not created:
|
||||||
|
update_cable_termination = False
|
||||||
|
update_orig_cable_termination = False
|
||||||
|
|
||||||
|
if self._orig_cable and self._orig_cable != self.cable:
|
||||||
|
update_cable_termination = True
|
||||||
|
update_orig_cable_termination = True
|
||||||
|
elif self._orig_cable_end and self._orig_cable_end != self.cable_end:
|
||||||
|
update_cable_termination = True
|
||||||
|
|
||||||
|
if update_cable_termination:
|
||||||
|
self.cable._terminations_modified = True
|
||||||
|
trace_paths.send(Cable, instance=self.cable, created=False)
|
||||||
|
|
||||||
|
if update_orig_cable_termination:
|
||||||
|
self._orig_cable._terminations_modified = True
|
||||||
|
trace_paths.send(Cable, instance=self._orig_cable, created=False)
|
||||||
|
|
||||||
|
self._orig_cable_end = self.cable_end
|
||||||
|
self._orig_cable = self.cable
|
||||||
|
|
||||||
def delete(self, *args, **kwargs):
|
def delete(self, *args, **kwargs):
|
||||||
|
|
||||||
# Delete the cable association on the terminating object
|
# Delete the cable association on the terminating object
|
||||||
@ -369,6 +399,7 @@ class CableTermination(ChangeLoggedModel):
|
|||||||
termination.save()
|
termination.save()
|
||||||
|
|
||||||
super().delete(*args, **kwargs)
|
super().delete(*args, **kwargs)
|
||||||
|
trace_paths.send(Cable, instance=self.cable, created=False)
|
||||||
|
|
||||||
def cache_related_objects(self):
|
def cache_related_objects(self):
|
||||||
"""
|
"""
|
||||||
|
BIN
netbox/project-static/dist/netbox.css
vendored
BIN
netbox/project-static/dist/netbox.css
vendored
Binary file not shown.
4
netbox/project-static/styles/custom/racks.scss
Normal file
4
netbox/project-static/styles/custom/racks.scss
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
.rack-loading-container {
|
||||||
|
min-height: 200px;
|
||||||
|
margin-left: 30px;
|
||||||
|
}
|
@ -27,3 +27,4 @@
|
|||||||
@import 'custom/markdown';
|
@import 'custom/markdown';
|
||||||
@import 'custom/misc';
|
@import 'custom/misc';
|
||||||
@import 'custom/notifications';
|
@import 'custom/notifications';
|
||||||
|
@import 'custom/racks';
|
||||||
|
@ -1,6 +1,17 @@
|
|||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
<div style="margin-left: -30px">
|
<div style="margin-left: -30px">
|
||||||
<object data="{% url 'dcim-api:rack-elevation' pk=object.pk %}?face={{face}}&render=svg{% if extra_params %}&{{ extra_params }}{% endif %}" class="rack_elevation" aria-label="{% trans "Rack elevation" %}"></object>
|
<div
|
||||||
|
hx-get="{% url 'dcim-api:rack-elevation' pk=object.pk %}?face={{ face }}&render=svg{% if extra_params %}&{{ extra_params }}{% endif %}"
|
||||||
|
hx-trigger="intersect"
|
||||||
|
hx-swap="outerHTML"
|
||||||
|
aria-label="{% trans "Rack elevation" %}"
|
||||||
|
>
|
||||||
|
<div class="d-flex justify-content-center align-items-center rack-loading-container">
|
||||||
|
<div class="spinner-border" role="status">
|
||||||
|
<span class="visually-hidden">{% trans "Loading..." %}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="text-center mt-3">
|
<div class="text-center mt-3">
|
||||||
<a class="btn btn-outline-primary" href="{% url 'dcim-api:rack-elevation' pk=object.pk %}?face={{face}}&render=svg{% if extra_params %}&{{ extra_params }}{% endif %}" hx-boost="false">
|
<a class="btn btn-outline-primary" href="{% url 'dcim-api:rack-elevation' pk=object.pk %}?face={{face}}&render=svg{% if extra_params %}&{{ extra_params }}{% endif %}" hx-boost="false">
|
||||||
|
@ -8,7 +8,7 @@ msgid ""
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: PACKAGE VERSION\n"
|
"Project-Id-Version: PACKAGE VERSION\n"
|
||||||
"Report-Msgid-Bugs-To: \n"
|
"Report-Msgid-Bugs-To: \n"
|
||||||
"POT-Creation-Date: 2025-07-03 05:04+0000\n"
|
"POT-Creation-Date: 2025-07-09 05:04+0000\n"
|
||||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||||
@ -13021,7 +13021,7 @@ msgid "Cable Trace for %(object_type)s %(object)s"
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: netbox/templates/dcim/cable_trace.html:24
|
#: netbox/templates/dcim/cable_trace.html:24
|
||||||
#: netbox/templates/dcim/inc/rack_elevation.html:7
|
#: netbox/templates/dcim/inc/rack_elevation.html:18
|
||||||
msgid "Download SVG"
|
msgid "Download SVG"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
@ -13424,10 +13424,14 @@ msgstr ""
|
|||||||
msgid "Descending Units"
|
msgid "Descending Units"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: netbox/templates/dcim/inc/rack_elevation.html:3
|
#: netbox/templates/dcim/inc/rack_elevation.html:7
|
||||||
msgid "Rack elevation"
|
msgid "Rack elevation"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
#: netbox/templates/dcim/inc/rack_elevation.html:11
|
||||||
|
msgid "Loading..."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
#: netbox/templates/dcim/interface.html:17
|
#: netbox/templates/dcim/interface.html:17
|
||||||
msgid "Add Child Interface"
|
msgid "Add Child Interface"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
Loading…
Reference in New Issue
Block a user