netbox-cable-canvas 0.10.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- netbox_cable_canvas/__init__.py +22 -0
- netbox_cable_canvas/forms.py +44 -0
- netbox_cable_canvas/navigation.py +30 -0
- netbox_cable_canvas/static/netbox_cable_canvas/canvas.css +171 -0
- netbox_cable_canvas/static/netbox_cable_canvas/canvas.js +2181 -0
- netbox_cable_canvas/static/netbox_cable_canvas/common.js +515 -0
- netbox_cable_canvas/static/netbox_cable_canvas/health.css +21 -0
- netbox_cable_canvas/static/netbox_cable_canvas/health.js +348 -0
- netbox_cable_canvas/static/netbox_cable_canvas/tracemap.css +83 -0
- netbox_cable_canvas/static/netbox_cable_canvas/tracemap.js +997 -0
- netbox_cable_canvas/template_content.py +24 -0
- netbox_cable_canvas/templates/netbox_cable_canvas/canvas.html +267 -0
- netbox_cable_canvas/templates/netbox_cable_canvas/health.html +67 -0
- netbox_cable_canvas/templates/netbox_cable_canvas/tracemap.html +134 -0
- netbox_cable_canvas/urls.py +9 -0
- netbox_cable_canvas/version.py +1 -0
- netbox_cable_canvas/views.py +200 -0
- netbox_cable_canvas-0.10.0.dist-info/METADATA +142 -0
- netbox_cable_canvas-0.10.0.dist-info/RECORD +23 -0
- netbox_cable_canvas-0.10.0.dist-info/WHEEL +5 -0
- netbox_cable_canvas-0.10.0.dist-info/entry_points.txt +2 -0
- netbox_cable_canvas-0.10.0.dist-info/licenses/LICENSE +201 -0
- netbox_cable_canvas-0.10.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
from netbox.plugins import PluginConfig
|
|
2
|
+
|
|
3
|
+
from .version import __version__
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class CableCanvasConfig(PluginConfig):
|
|
7
|
+
name = "netbox_cable_canvas"
|
|
8
|
+
verbose_name = "Cable Canvas"
|
|
9
|
+
description = "Visualize two devices' ports and create cables between them with the mouse"
|
|
10
|
+
version = __version__
|
|
11
|
+
author = "Jan Krupa"
|
|
12
|
+
base_url = "cable-canvas"
|
|
13
|
+
min_version = "4.7.0"
|
|
14
|
+
# Developed and tested against 4.7; raise this only after testing a newer release.
|
|
15
|
+
max_version = "4.7.99"
|
|
16
|
+
default_settings = {
|
|
17
|
+
# Default cable label template; users can save their own in the Cable Canvas.
|
|
18
|
+
"label_template": "{site|upper}-{seq:05}",
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
config = CableCanvasConfig
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Device filters rendered with NetBox's own dynamic select widget (the same
|
|
3
|
+
searchable dropdown used for "Site" on the device creation form).
|
|
4
|
+
"""
|
|
5
|
+
from django import forms
|
|
6
|
+
|
|
7
|
+
from dcim.models import DeviceRole, Location, Manufacturer, Rack, Site
|
|
8
|
+
from tenancy.models import Tenant
|
|
9
|
+
from utilities.forms.fields import DynamicModelChoiceField
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class DeviceFilterForm(forms.Form):
|
|
13
|
+
site = DynamicModelChoiceField(
|
|
14
|
+
queryset=Site.objects.all(),
|
|
15
|
+
required=False,
|
|
16
|
+
label="Site",
|
|
17
|
+
)
|
|
18
|
+
location = DynamicModelChoiceField(
|
|
19
|
+
queryset=Location.objects.all(),
|
|
20
|
+
required=False,
|
|
21
|
+
label="Location",
|
|
22
|
+
query_params={"site_id": "$site"},
|
|
23
|
+
)
|
|
24
|
+
rack = DynamicModelChoiceField(
|
|
25
|
+
queryset=Rack.objects.all(),
|
|
26
|
+
required=False,
|
|
27
|
+
label="Rack",
|
|
28
|
+
query_params={"site_id": "$site", "location_id": "$location"},
|
|
29
|
+
)
|
|
30
|
+
role = DynamicModelChoiceField(
|
|
31
|
+
queryset=DeviceRole.objects.all(),
|
|
32
|
+
required=False,
|
|
33
|
+
label="Role",
|
|
34
|
+
)
|
|
35
|
+
manufacturer = DynamicModelChoiceField(
|
|
36
|
+
queryset=Manufacturer.objects.all(),
|
|
37
|
+
required=False,
|
|
38
|
+
label="Manufacturer",
|
|
39
|
+
)
|
|
40
|
+
tenant = DynamicModelChoiceField(
|
|
41
|
+
queryset=Tenant.objects.all(),
|
|
42
|
+
required=False,
|
|
43
|
+
label="Tenant",
|
|
44
|
+
)
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
from netbox.plugins import PluginMenu, PluginMenuItem
|
|
2
|
+
|
|
3
|
+
# A `menu` makes the plugin its own top-level section in the left navigation,
|
|
4
|
+
# instead of an entry under the shared "Plugins" menu.
|
|
5
|
+
menu = PluginMenu(
|
|
6
|
+
label="Cabling",
|
|
7
|
+
icon_class="mdi mdi-cable-data",
|
|
8
|
+
groups=(
|
|
9
|
+
(
|
|
10
|
+
"Cabling",
|
|
11
|
+
(
|
|
12
|
+
PluginMenuItem(
|
|
13
|
+
link="plugins:netbox_cable_canvas:canvas",
|
|
14
|
+
link_text="Cable Canvas",
|
|
15
|
+
permissions=["dcim.view_device"],
|
|
16
|
+
),
|
|
17
|
+
PluginMenuItem(
|
|
18
|
+
link="plugins:netbox_cable_canvas:tracemap",
|
|
19
|
+
link_text="Cable Trace Map",
|
|
20
|
+
permissions=["dcim.view_device", "dcim.view_cable"],
|
|
21
|
+
),
|
|
22
|
+
PluginMenuItem(
|
|
23
|
+
link="plugins:netbox_cable_canvas:health",
|
|
24
|
+
link_text="Cabling Health",
|
|
25
|
+
permissions=["dcim.view_device", "dcim.view_cable"],
|
|
26
|
+
),
|
|
27
|
+
),
|
|
28
|
+
),
|
|
29
|
+
),
|
|
30
|
+
)
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
#cc-app {
|
|
2
|
+
--cc-free: #3fb950;
|
|
3
|
+
--cc-linked: #2f6fde;
|
|
4
|
+
--cc-elsewhere: #d29922;
|
|
5
|
+
--cc-marked: #8b949e;
|
|
6
|
+
--cc-select: #e5534b;
|
|
7
|
+
--cc-draft: #a371f7;
|
|
8
|
+
--cc-side1: #e5534b;
|
|
9
|
+
--cc-side2: #1f9ed1;
|
|
10
|
+
--cc-trace: #f0883e;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.cc-picker { position: relative; }
|
|
14
|
+
.cc-picker .cc-results {
|
|
15
|
+
position: absolute; z-index: 1060; left: 0; right: 0; top: calc(100% + 2px);
|
|
16
|
+
max-height: 360px; overflow-y: auto;
|
|
17
|
+
/* Solid background: NetBox's theme makes list-group items translucent. */
|
|
18
|
+
background-color: var(--bs-body-bg, #fff);
|
|
19
|
+
border: 1px solid var(--bs-border-color, #ccc); border-radius: 6px;
|
|
20
|
+
box-shadow: 0 8px 24px rgba(0, 0, 0, .25);
|
|
21
|
+
}
|
|
22
|
+
.cc-picker .cc-results .list-group-item {
|
|
23
|
+
background-color: var(--bs-body-bg, #fff); color: var(--bs-body-color, #222);
|
|
24
|
+
border-left: 0; border-right: 0; opacity: 1;
|
|
25
|
+
}
|
|
26
|
+
.cc-picker .cc-results .list-group-item:first-child { border-top: 0; }
|
|
27
|
+
.cc-picker .cc-results .list-group-item-action:hover,
|
|
28
|
+
.cc-picker .cc-results .list-group-item-action:focus {
|
|
29
|
+
background-color: var(--bs-tertiary-bg, #eef1f5);
|
|
30
|
+
}
|
|
31
|
+
.cc-kinds { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .4rem; }
|
|
32
|
+
.cc-kinds .cc-kind { padding: .1rem .5rem; font-size: .78rem; }
|
|
33
|
+
.cc-kinds .badge { font-size: .7rem; }
|
|
34
|
+
@media (min-width: 768px) { .cc-btncol { padding-top: 1.9rem; } }
|
|
35
|
+
.cc-picker .cc-results:empty { display: none; }
|
|
36
|
+
.cc-picker .list-group-item { cursor: pointer; }
|
|
37
|
+
.cc-picker .cc-sub { font-size: .8em; opacity: .7; }
|
|
38
|
+
|
|
39
|
+
.cc-legend span { margin-right: 1rem; white-space: nowrap; }
|
|
40
|
+
.cc-swatch {
|
|
41
|
+
display: inline-block; width: 12px; height: 12px; border-radius: 2px;
|
|
42
|
+
vertical-align: -1px; margin-right: 3px;
|
|
43
|
+
}
|
|
44
|
+
.cc-swatch.cc-free { background: var(--cc-free); }
|
|
45
|
+
.cc-swatch.cc-linked { background: var(--cc-linked); }
|
|
46
|
+
.cc-swatch.cc-elsewhere { background: var(--cc-elsewhere); }
|
|
47
|
+
.cc-swatch.cc-marked { background: var(--cc-marked); }
|
|
48
|
+
.cc-swatch.cc-draft { background: var(--cc-draft); }
|
|
49
|
+
|
|
50
|
+
#cc-stage { overflow-x: auto; }
|
|
51
|
+
#cc-stage svg { display: block; user-select: none; }
|
|
52
|
+
|
|
53
|
+
.cc-device-bg { fill: var(--bs-tertiary-bg, #f5f6f8); stroke: var(--bs-border-color, #ccc); }
|
|
54
|
+
.cc-device-title { font-weight: 600; font-size: 14px; fill: var(--bs-body-color, #222); cursor: pointer; }
|
|
55
|
+
.cc-device-sub { font-size: 11px; fill: var(--bs-secondary-color, #666); }
|
|
56
|
+
.cc-section-label { font-size: 11px; fill: var(--bs-secondary-color, #666); text-transform: uppercase; letter-spacing: .04em; }
|
|
57
|
+
|
|
58
|
+
.cc-port .cc-box { stroke-width: 1.5; rx: 3; ry: 3; transition: opacity .1s; }
|
|
59
|
+
.cc-port text { font-size: 10px; pointer-events: none; text-anchor: middle; dominant-baseline: central; }
|
|
60
|
+
.cc-port { cursor: pointer; }
|
|
61
|
+
.cc-port.cc-free .cc-box { fill: color-mix(in srgb, var(--cc-free) 18%, transparent); stroke: var(--cc-free); }
|
|
62
|
+
.cc-port.cc-linked .cc-box { fill: var(--cc-linked); stroke: var(--cc-linked); }
|
|
63
|
+
.cc-port.cc-linked text { fill: #fff; }
|
|
64
|
+
.cc-port.cc-elsewhere .cc-box { fill: var(--cc-elsewhere); stroke: var(--cc-elsewhere); }
|
|
65
|
+
.cc-port.cc-elsewhere text { fill: #111; }
|
|
66
|
+
.cc-port.cc-marked .cc-box { fill: var(--cc-marked); stroke: var(--cc-marked); }
|
|
67
|
+
.cc-port.cc-marked text { fill: #fff; }
|
|
68
|
+
.cc-port.cc-free text { fill: var(--bs-body-color, #222); }
|
|
69
|
+
.cc-port:hover .cc-box { stroke-width: 3; }
|
|
70
|
+
.cc-port text.cc-pname {
|
|
71
|
+
fill: var(--bs-body-color, #222) !important; font-size: 12px; pointer-events: auto;
|
|
72
|
+
}
|
|
73
|
+
.cc-port text.cc-pname.cc-end { text-anchor: end; }
|
|
74
|
+
.cc-port text.cc-pname.cc-start { text-anchor: start; }
|
|
75
|
+
.cc-port .cc-pdesc { fill: var(--bs-secondary-color, #777) !important; font-size: 10px; }
|
|
76
|
+
.cc-port:hover text.cc-pname { font-weight: 600; }
|
|
77
|
+
.cc-port.cc-selected .cc-box { stroke: var(--cc-select); stroke-width: 3.5; }
|
|
78
|
+
.cc-port.cc-dim { opacity: .22; cursor: not-allowed; }
|
|
79
|
+
.cc-port.cc-candidate .cc-box { stroke-width: 2.5; stroke-dasharray: 3 2; }
|
|
80
|
+
|
|
81
|
+
.cc-cable { fill: none; stroke: var(--cc-linked); stroke-width: 3; opacity: .85; pointer-events: none; }
|
|
82
|
+
.cc-cable:hover, .cc-cable.cc-hot { stroke-width: 6; opacity: 1; }
|
|
83
|
+
.cc-cable-hit { fill: none; stroke: transparent; stroke-width: 12; cursor: pointer; }
|
|
84
|
+
.cc-cable.cc-planned { stroke-dasharray: 8 5; }
|
|
85
|
+
.cc-cable.cc-decommissioning { stroke-dasharray: 2 4; }
|
|
86
|
+
.cc-rubber { fill: none; stroke: var(--cc-select); stroke-width: 2; stroke-dasharray: 5 4; pointer-events: none; }
|
|
87
|
+
|
|
88
|
+
.cc-tooltip {
|
|
89
|
+
position: absolute; z-index: 30; pointer-events: none;
|
|
90
|
+
background: var(--bs-body-bg, #fff); color: var(--bs-body-color, #222);
|
|
91
|
+
border: 1px solid var(--bs-border-color, #ccc); border-radius: 4px;
|
|
92
|
+
padding: 4px 8px; font-size: 12px; box-shadow: 0 2px 6px rgba(0,0,0,.15);
|
|
93
|
+
max-width: 320px;
|
|
94
|
+
}
|
|
95
|
+
.cc-popover { position: absolute; z-index: 40; min-width: 240px; max-width: 340px; font-size: 13px; }
|
|
96
|
+
.cc-popover .card-body { padding: .75rem; }
|
|
97
|
+
|
|
98
|
+
.cc-toasts { position: fixed; right: 1rem; bottom: 1rem; z-index: 1100; display: flex; flex-direction: column; gap: .5rem; }
|
|
99
|
+
.cc-toasts .alert { margin: 0; min-width: 260px; max-width: 440px; box-shadow: 0 2px 8px rgba(0,0,0,.2); }
|
|
100
|
+
|
|
101
|
+
.cc-picker input { padding-right: 1.8rem; }
|
|
102
|
+
.cc-picker .cc-clear {
|
|
103
|
+
position: absolute; right: .4rem; top: 50%; transform: translateY(-50%);
|
|
104
|
+
border: 0; background: transparent; color: var(--bs-secondary-color, #777);
|
|
105
|
+
font-size: 1.1rem; line-height: 1; padding: 0 .2rem; cursor: pointer;
|
|
106
|
+
}
|
|
107
|
+
.cc-picker .cc-clear:hover { color: var(--bs-body-color, #222); }
|
|
108
|
+
.cc-picker .cc-clear[hidden] { display: none; }
|
|
109
|
+
.cc-picker .cc-results { min-width: 260px; }
|
|
110
|
+
|
|
111
|
+
/* ---- v0.5: drafts, bulk sides, trace, search, warnings ---- */
|
|
112
|
+
.cc-port.cc-draft .cc-box { fill: color-mix(in srgb, var(--cc-draft) 35%, transparent); stroke: var(--cc-draft); stroke-dasharray: 4 2; }
|
|
113
|
+
.cc-port.cc-draft text { fill: var(--bs-body-color, #222); }
|
|
114
|
+
.cc-draftline { stroke: var(--cc-draft) !important; stroke-dasharray: 7 5; opacity: .9; }
|
|
115
|
+
.cc-port.cc-sel1 .cc-box { stroke: var(--cc-side1); stroke-width: 3.5; fill: color-mix(in srgb, var(--cc-side1) 25%, transparent); }
|
|
116
|
+
.cc-port.cc-sel2 .cc-box { stroke: var(--cc-side2); stroke-width: 3.5; fill: color-mix(in srgb, var(--cc-side2) 25%, transparent); }
|
|
117
|
+
.cc-port.cc-mapped .cc-box { stroke: var(--cc-trace); stroke-width: 3; stroke-dasharray: 2 2; }
|
|
118
|
+
.cc-port.cc-nomatch { opacity: .25; }
|
|
119
|
+
.cc-port.cc-match .cc-box { stroke: #f2cc60; stroke-width: 3.5; }
|
|
120
|
+
.cc-tracing .cc-port:not(.cc-trace) { opacity: .3; }
|
|
121
|
+
.cc-tracing .cc-cable:not(.cc-traced) { opacity: .12; }
|
|
122
|
+
.cc-port.cc-trace .cc-box { stroke: var(--cc-trace); stroke-width: 4; }
|
|
123
|
+
.cc-cable.cc-traced { stroke: var(--cc-trace) !important; stroke-width: 5; opacity: 1; }
|
|
124
|
+
.cc-module-label { font-size: 10px; fill: var(--bs-secondary-color, #777); font-style: italic; }
|
|
125
|
+
.cc-warn { color: #b8860b; }
|
|
126
|
+
[data-bs-theme=dark] .cc-warn { color: #e3b341; }
|
|
127
|
+
.cc-text-draft { color: var(--cc-draft); }
|
|
128
|
+
.cc-colorchip { display: inline-block; width: 10px; height: 10px; border-radius: 2px; border: 1px solid rgba(0,0,0,.3); vertical-align: -1px; margin-right: 4px; }
|
|
129
|
+
.cc-hops { padding-left: 1.2rem; margin: 0; }
|
|
130
|
+
.cc-hops li { margin-bottom: .25rem; }
|
|
131
|
+
.cc-chip { font-weight: 500; margin: 1px 0; }
|
|
132
|
+
.cc-chip a { color: inherit; text-decoration: none; margin-left: 2px; }
|
|
133
|
+
.cc-chip1 { background: color-mix(in srgb, var(--cc-side1) 80%, black) !important; color: #fff; }
|
|
134
|
+
.cc-chip2 { background: color-mix(in srgb, var(--cc-side2) 80%, black) !important; color: #fff; }
|
|
135
|
+
.cc-side-label { display: inline-block; width: 18px; text-align: center; border-radius: 3px; color: #fff; font-weight: 700; margin-right: 4px; }
|
|
136
|
+
.cc-preview { max-width: 760px; font-size: .85rem; }
|
|
137
|
+
.cc-preview td, .cc-preview th { padding: .15rem .4rem; }
|
|
138
|
+
.cc-work-card .table { font-size: .85rem; }
|
|
139
|
+
.cc-find { width: 180px; }
|
|
140
|
+
.btn-xs { padding: 0 .4rem; font-size: .72rem; }
|
|
141
|
+
.cc-unit { max-width: 4.2rem; }
|
|
142
|
+
@media (min-width: 768px) { .cc-btncol-sm { padding-top: 1.9rem; } }
|
|
143
|
+
.cc-port .cc-hitrow { fill: transparent; stroke: none; }
|
|
144
|
+
.cc-port:hover .cc-hitrow { fill: color-mix(in srgb, var(--bs-body-color, #000) 7%, transparent); }
|
|
145
|
+
.cc-popover:has(.cc-circuit-form) { width: 420px; max-width: 420px; }
|
|
146
|
+
.cc-circuit-form .form-label { font-size: .75rem; }
|
|
147
|
+
|
|
148
|
+
/* ---- v0.7: rack elevation, label templates ---- */
|
|
149
|
+
.cc-rack-frame { fill: var(--bs-tertiary-bg, #f4f5f7); stroke: var(--bs-border-color, #aaa); stroke-width: 2; }
|
|
150
|
+
.cc-rack-manager { fill: color-mix(in srgb, var(--bs-tertiary-bg, #f4f5f7) 60%, transparent); stroke: var(--bs-border-color, #ccc); stroke-dasharray: 3 3; }
|
|
151
|
+
.cc-u-num { font-size: 9px; text-anchor: end; fill: var(--bs-secondary-color, #888); }
|
|
152
|
+
.cc-u-line { stroke: var(--bs-border-color, #ddd); stroke-width: .5; opacity: .6; }
|
|
153
|
+
.cc-elev-dev { fill: var(--bs-body-bg, #fff); stroke: var(--bs-secondary-color, #777); stroke-width: 1.2; }
|
|
154
|
+
.cc-elev-name { font-size: 10.5px; font-weight: 600; fill: var(--bs-body-color, #222); cursor: pointer; }
|
|
155
|
+
.cc-elev .cc-port text { display: none; }
|
|
156
|
+
.cc-elev .cc-port .cc-box { stroke-width: 1; rx: 1.5; ry: 1.5; }
|
|
157
|
+
.cc-elev .cc-cable { stroke-width: 2; opacity: .75; }
|
|
158
|
+
.cc-elev .cc-cable.cc-hot, .cc-elev .cc-cable.cc-traced { stroke-width: 4; opacity: 1; }
|
|
159
|
+
.cc-popover.cc-pop-wide { width: 520px; max-width: 520px; }
|
|
160
|
+
.cc-tpl .cc-tokens { display: flex; flex-wrap: wrap; gap: 3px; }
|
|
161
|
+
.cc-tpl code { white-space: nowrap; }
|
|
162
|
+
.cc-stage-wrap { position: relative; }
|
|
163
|
+
|
|
164
|
+
/* ---- support coverage overlay (inventory-monitor) ---- */
|
|
165
|
+
.cc-elev-dev.cc-cov-valid { fill: color-mix(in srgb, #3fb950 14%, var(--bs-body-bg, #fff)); stroke: #3fb950; }
|
|
166
|
+
.cc-elev-dev.cc-cov-expiring { fill: color-mix(in srgb, #e3a008 18%, var(--bs-body-bg, #fff)); stroke: #e3a008; }
|
|
167
|
+
.cc-elev-dev.cc-cov-expired { fill: color-mix(in srgb, #d73a49 16%, var(--bs-body-bg, #fff)); stroke: #d73a49; stroke-width: 2; }
|
|
168
|
+
.cc-elev-dev.cc-cov-none { fill: color-mix(in srgb, #9aa4ae 14%, var(--bs-body-bg, #fff)); stroke: #9aa4ae; stroke-dasharray: 4 3; }
|
|
169
|
+
.cc-cov-flag { stroke: none; pointer-events: none; }
|
|
170
|
+
.cc-cov-flag.cc-cov-valid { fill: #3fb950; } .cc-cov-flag.cc-cov-expiring { fill: #e3a008; }
|
|
171
|
+
.cc-cov-flag.cc-cov-expired { fill: #d73a49; } .cc-cov-flag.cc-cov-none { fill: #9aa4ae; }
|