Skip to content

Commit c3019fb

Browse files
authored
Merge pull request #25 from cruse1977/master
NetBox 4.x Full PR
2 parents d411dc4 + 45ed6fa commit c3019fb

File tree

15 files changed

+277
-50
lines changed

15 files changed

+277
-50
lines changed

.gitignore

Lines changed: 162 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,162 @@
1-
.vscode/
2-
.vscode/settings.json
3-
.idea
4-
*.pyc
5-
venv
6-
build/**
7-
netbox_floorplan.egg-info/**
1+
*.py[cod]
2+
3+
# Byte-compiled / optimized / DLL files
4+
__pycache__/
5+
*.py[cod]
6+
*$py.class
7+
8+
# C extensions
9+
*.so
10+
11+
# Distribution / packaging
12+
.Python
13+
build/
14+
develop-eggs/
15+
dist/
16+
downloads/
17+
eggs/
18+
.eggs/
19+
lib/
20+
lib64/
21+
parts/
22+
sdist/
23+
var/
24+
wheels/
25+
share/python-wheels/
26+
*.egg-info/
27+
.installed.cfg
28+
*.egg
29+
MANIFEST
30+
31+
# PyInstaller
32+
# Usually these files are written by a python script from a template
33+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
34+
*.manifest
35+
*.spec
36+
37+
# Installer logs
38+
pip-log.txt
39+
pip-delete-this-directory.txt
40+
41+
# Unit test / coverage reports
42+
htmlcov/
43+
.tox/
44+
.nox/
45+
.coverage
46+
.coverage.*
47+
.cache
48+
nosetests.xml
49+
coverage.xml
50+
*.cover
51+
*.py,cover
52+
.hypothesis/
53+
.pytest_cache/
54+
cover/
55+
56+
# Translations
57+
*.mo
58+
*.pot
59+
60+
# Django stuff:
61+
*.log
62+
local_settings.py
63+
db.sqlite3
64+
db.sqlite3-journal
65+
66+
# Flask stuff:
67+
instance/
68+
.webassets-cache
69+
70+
# Scrapy stuff:
71+
.scrapy
72+
73+
# Sphinx documentation
74+
docs/_build/
75+
76+
# PyBuilder
77+
.pybuilder/
78+
target/
79+
80+
# Jupyter Notebook
81+
.ipynb_checkpoints
82+
83+
# IPython
84+
profile_default/
85+
ipython_config.py
86+
87+
# pyenv
88+
# For a library or package, you might want to ignore these files since the code is
89+
# intended to run in multiple environments; otherwise, check them in:
90+
# .python-version
91+
92+
# pipenv
93+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
94+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
95+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
96+
# install all needed dependencies.
97+
#Pipfile.lock
98+
99+
# poetry
100+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
101+
# This is especially recommended for binary packages to ensure reproducibility, and is more
102+
# commonly ignored for libraries.
103+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
104+
#poetry.lock
105+
106+
# pdm
107+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
108+
#pdm.lock
109+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
110+
# in version control.
111+
# https://pdm.fming.dev/#use-with-ide
112+
.pdm.toml
113+
114+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
115+
__pypackages__/
116+
117+
# Celery stuff
118+
celerybeat-schedule
119+
celerybeat.pid
120+
121+
# SageMath parsed files
122+
*.sage.py
123+
124+
# Environments
125+
.env
126+
.venv
127+
env/
128+
venv/
129+
ENV/
130+
env.bak/
131+
venv.bak/
132+
133+
# Spyder project settings
134+
.spyderproject
135+
.spyproject
136+
137+
# Rope project settings
138+
.ropeproject
139+
140+
# mkdocs documentation
141+
/site
142+
143+
# mypy
144+
.mypy_cache/
145+
.dmypy.json
146+
dmypy.json
147+
148+
# Pyre type checker
149+
.pyre/
150+
151+
# pytype static type analyzer
152+
.pytype/
153+
154+
# Cython debug symbols
155+
cython_debug/
156+
157+
# PyCharm
158+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
159+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
160+
# and can be added to the global gitignore or merged into this file. For a more nuclear
161+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
162+
#.idea/

README.md

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<img src="https://github.com/netboxlabs/netbox-floorplan-plugin/workflows/tests/badge.svg" alt="Tests"/>
44

5-
Forked from https://github.com/tbotnz/netbox_floorplan
5+
Originally Forked from https://github.com/tbotnz/netbox_floorplan
66

77
## Demo
88
![demo](/media/demo.gif)
@@ -15,30 +15,39 @@ A netbox plugin providing floorplan mapping capability for locations and sites
1515
- floorplan object mapped to sites or locations and click through rack/devices
1616
- keyboard controls supported
1717
- export to svg
18+
- NOTE: Background Images have been disabled.
1819

1920
## Compatibility
2021

21-
| | |
22+
| NetBox Version | Plugin Version |
2223
|-------------|-----------|
23-
| NetBox 3.5 | >= 0.3.2 |
24-
| NetBox 3.6 | >= 0.3.2 |
24+
| 3.5 | >= 0.3.2 |
25+
| 3.6 | >= 0.3.2 |
26+
| >4.0.2 | 0.4.0 |
2527

2628
## Installing
2729

2830
The plugin is available as a Python package in pypi and can be installed with pip
2931

32+
3033
```
31-
pip install netbox-floorplan-plugin
34+
sudo pip install netbox-floorplan-plugin
3235
```
3336
Enable the plugin in /opt/netbox/netbox/netbox/configuration.py:
3437
```
3538
PLUGINS = ['netbox_floorplan']
3639
```
40+
Enable Migrations:
41+
```
42+
cd /opt/netbox
43+
sudo ./venv/bin/python3 netbox/manage.py makemigrations netbox_floorplan_plugin
44+
sudo ./venv/bin/python3 netbox/manage.py migrate
45+
```
46+
3747
Restart NetBox and add `netbox-floorplan-plugin` to your local_requirements.txt
3848

3949
See [NetBox Documentation](https://docs.netbox.dev/en/stable/plugins/#installing-plugins) for details
4050

41-
4251
## Mentions
4352

4453
Forked from https://github.com/tbotnz/netbox_floorplan

netbox_floorplan/__init__.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
1-
from extras.plugins import PluginConfig
1+
from netbox.plugins import PluginConfig
22

33

44
class FloorplanConfig(PluginConfig):
5+
56
name = "netbox_floorplan"
67
verbose_name = "Netbox Floorplan"
78
description = ""
8-
version = "0.3.6"
9+
version = "0.4.0"
910
base_url = "floorplan"
10-
min_version = "3.4.1"
11+
min_version = "4.0.2"
12+
max_version = "4.0.99"
1113

1214

1315
config = FloorplanConfig

netbox_floorplan/admin.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +0,0 @@
1-
from django.contrib import admin
2-
from .models import Floorplan
3-
4-
5-
@admin.register(Floorplan)
6-
class FloorplanAdmin(admin.ModelAdmin):
7-
list_display = (
8-
"pk",
9-
)

netbox_floorplan/navigation.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
"""
2+
Define the plugin menu buttons & the plugin navigation bar enteries.
3+
"""
4+
5+
from netbox.plugins import PluginMenuItem
6+
7+
8+
#
9+
# Define plugin menu buttons
10+
#
11+
menu_buttons = (
12+
PluginMenuItem(
13+
link="plugins:netbox_floorplan:floorplan_list",
14+
link_text="Floorplans",
15+
),
16+
)
17+
18+
19+
menu_items = menu_buttons

netbox_floorplan/static/netbox_floorplan/floorplan/edit.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// start initial ----------------------------------------------------------------------------- !
22

3+
34
import {
45
resize_canvas,
56
export_svg,

netbox_floorplan/tables.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88

99
class FloorplanTable(NetBoxTable):
10+
1011
class Meta(NetBoxTable.Meta):
1112
model = Floorplan
1213
fields = ('pk', 'site', 'location',
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
{% extends 'generic/object.html' %}
2+
{% load render_table from django_tables2 %}
3+
4+
5+
6+
{% block content %}
7+
<div class="row mb-3">
8+
<div class="col col-md-6">
9+
<div class="card">
10+
<h5 class="card-header">Fabric</h5>
11+
<div class="card-body">
12+
<div class="card-body">
13+
{% render_table table 'inc/table.html' %}
14+
</div>
15+
</div>
16+
</div>
17+
</div>
18+
</div>
19+
<div class="col col-md-6">
20+
<div class="card">
21+
<h5 class="card-header">Free Fabric Ports</h5>
22+
<div class="card-body">
23+
<table class="table table-hover attr-table">
24+
<tr><th>Host</th><th>Free Ports</th></tr>
25+
{% for host, obj in object.get_free_leaf_port_count.items %}
26+
<tr>
27+
<td><a href="{{ host.get_absolute_url }}">{{ host }}</a></td>
28+
<td>{{ obj }}</td>
29+
</tr>
30+
{% endfor %}
31+
</table>
32+
</div>
33+
</div>
34+
</div>
35+
</div>
36+
37+
{% endblock content %}

0 commit comments

Comments
 (0)