Compare commits
10
Commits
v4.2.0
...
dreng-patch-1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9c8f5d728c | ||
|
|
6eb20004f9 | ||
|
|
836d9f40d7 | ||
|
|
607347ff18 | ||
|
|
0f6051731a | ||
|
|
3c9aebfd2f | ||
|
|
60a5fe1eae | ||
|
|
3fbeb97810 | ||
|
|
f3b822e18d | ||
|
|
555c1fac4c |
@@ -14,31 +14,15 @@ Options to export to xml (for draw.io/diagrams.net) or png.
|
|||||||
|
|
||||||
## Install
|
## Install
|
||||||
|
|
||||||
**_NOTE:_** For docker please see: [Docker install](https://github.com/netbox-community/netbox-docker/wiki/Using-Netbox-Plugins)
|
**_NOTE:_** For Docker please see: [Docker install](https://github.com/netbox-community/netbox-docker/wiki/Using-Netbox-Plugins)
|
||||||
|
|
||||||
**_NOTE:_** Add `RUN mkdir -p /opt/netbox/netbox/static/netbox_topology_views/img` to the Dockerfile-Plugins file to create the image folder
|
**_NOTE:_** Add `RUN mkdir -p /opt/netbox/netbox/static/netbox_topology_views/img` to the Dockerfile-Plugins file to create the image folder.
|
||||||
|
|
||||||
The plugin is available as a Python package and can be installed with pip.
|
The plugin is available as a Python package and can be installed with pip.
|
||||||
|
|
||||||
Run `pip install netbox-topology-views` in your virtual env.
|
|
||||||
|
|
||||||
To ensure NetBox Topology Views plugin is automatically re-installed during future upgrades, create a file named `local_requirements.txt` (if not already existing) in the NetBox root directory (alongside `requirements.txt`) and list the `netbox-topology-views` package:
|
|
||||||
|
|
||||||
```no-highlight
|
|
||||||
# echo netbox-topology-views >> local_requirements.txt
|
|
||||||
```
|
|
||||||
|
|
||||||
Once installed, the plugin needs to be enabled in your `configuration.py`
|
|
||||||
|
|
||||||
```python
|
|
||||||
# In your configuration.py
|
|
||||||
PLUGINS = ["netbox_topology_views"]
|
|
||||||
```
|
|
||||||
|
|
||||||
First run `source /opt/netbox/venv/bin/activate` to enter the Python virtual environment.
|
First run `source /opt/netbox/venv/bin/activate` to enter the Python virtual environment.
|
||||||
|
|
||||||
|
Then run:
|
||||||
Then run
|
|
||||||
```bash
|
```bash
|
||||||
cd /opt/netbox/netbox
|
cd /opt/netbox/netbox
|
||||||
pip3 install netbox-topology-views
|
pip3 install netbox-topology-views
|
||||||
@@ -46,6 +30,23 @@ python3 manage.py migrate netbox_topology_views
|
|||||||
python3 manage.py collectstatic --no-input
|
python3 manage.py collectstatic --no-input
|
||||||
```
|
```
|
||||||
|
|
||||||
|
To ensure NetBox Topology Views plugin is automatically re-installed during future upgrades, create a file named `local_requirements.txt` (if not already existing) in the NetBox root directory (alongside `requirements.txt`) and list the `netbox-topology-views` package:
|
||||||
|
|
||||||
|
```no-highlight
|
||||||
|
echo netbox-topology-views >> local_requirements.txt
|
||||||
|
```
|
||||||
|
|
||||||
|
Once installed, the plugin needs to be enabled in your `configuration.py`:
|
||||||
|
|
||||||
|
```python
|
||||||
|
PLUGINS = ["netbox_topology_views"]
|
||||||
|
```
|
||||||
|
|
||||||
|
Finally, restart NetBox:
|
||||||
|
```no-highlight
|
||||||
|
systemctl restart netbox
|
||||||
|
```
|
||||||
|
|
||||||
### Versions
|
### Versions
|
||||||
|
|
||||||
> [!NOTE]
|
> [!NOTE]
|
||||||
@@ -53,6 +54,8 @@ python3 manage.py collectstatic --no-input
|
|||||||
|
|
||||||
| netbox version | netbox-topology-views version |
|
| netbox version | netbox-topology-views version |
|
||||||
| -------------- | ----------------------------- |
|
| -------------- | ----------------------------- |
|
||||||
|
| = 4.3.X | = v4.2.1 |
|
||||||
|
| = 4.2.1 | = v4.2.1 |
|
||||||
| = 4.2.0 | = v4.2.0 |
|
| = 4.2.0 | = v4.2.0 |
|
||||||
| = 4.1.X | = v4.1.0 |
|
| = 4.1.X | = v4.1.0 |
|
||||||
| = 4.0.X | = v4.0.0 |
|
| = 4.0.X | = v4.0.0 |
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ class TopologyViewsConfig(PluginConfig):
|
|||||||
name = "netbox_topology_views"
|
name = "netbox_topology_views"
|
||||||
verbose_name = "Topology views"
|
verbose_name = "Topology views"
|
||||||
description = "An plugin to render topology maps"
|
description = "An plugin to render topology maps"
|
||||||
version = "4.2.0"
|
version = "4.2.1"
|
||||||
author = "Mattijs Vanhaverbeke"
|
author = "Mattijs Vanhaverbeke"
|
||||||
author_email = "author@example.com"
|
author_email = "author@example.com"
|
||||||
base_url = "netbox_topology_views"
|
base_url = "netbox_topology_views"
|
||||||
|
|||||||
@@ -516,7 +516,6 @@ class IndividualOptionsForm(NetBoxModelForm):
|
|||||||
fieldsets = (
|
fieldsets = (
|
||||||
FieldSet
|
FieldSet
|
||||||
(
|
(
|
||||||
'user_id',
|
|
||||||
'ignore_cable_type',
|
'ignore_cable_type',
|
||||||
'preselected_device_roles',
|
'preselected_device_roles',
|
||||||
'preselected_tags',
|
'preselected_tags',
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -333,7 +333,7 @@ const coordSaveCheckbox = document.querySelector('#id_save_coords')
|
|||||||
// Extract node ids and node type ids from all nodes
|
// Extract node ids and node type ids from all nodes
|
||||||
for (let [key, value] of nodes._data) {
|
for (let [key, value] of nodes._data) {
|
||||||
if (value[typeId] != undefined) {
|
if (value[typeId] != undefined) {
|
||||||
nodesArray.push([value.id, value[typeId], value[type]]);
|
nodesArray.push([value.id, value[typeId], value[type], value.label_num_lines]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Split single array above into arrays grouped by node id
|
// Split single array above into arrays grouped by node id
|
||||||
@@ -390,16 +390,24 @@ const coordSaveCheckbox = document.querySelector('#id_save_coords')
|
|||||||
const rectangles = [];
|
const rectangles = [];
|
||||||
const xValues = [];
|
const xValues = [];
|
||||||
const yValues = [];
|
const yValues = [];
|
||||||
|
const yValuesWithLabel = [];
|
||||||
|
const labelLineHeight = 16;
|
||||||
|
|
||||||
for(let val of value[1]) {
|
// Get coordinates for every node in a given group
|
||||||
|
for(let val of value[1]) {
|
||||||
xValues.push(graph.getPosition(val[0]).x);
|
xValues.push(graph.getPosition(val[0]).x);
|
||||||
yValues.push(graph.getPosition(val[0]).y);
|
yValues.push(graph.getPosition(val[0]).y);
|
||||||
|
yValuesWithLabel.push(yValues[yValues.length -1] + val[3] * labelLineHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
const rectX = Math.min(...xValues) - rectParams.paddingX;
|
const minX = Math.min(...xValues);
|
||||||
const rectY = Math.min(...yValues) - rectParams.paddingY;
|
const maxX = Math.max(...xValues);
|
||||||
const rectSizeX = Math.max(...xValues) - Math.min(...xValues) + 2*rectParams.paddingX;
|
const minY = Math.min(...yValues);
|
||||||
const rectSizeY = Math.max(...yValues) - Math.min(...yValues) + 2*rectParams.paddingY;
|
const maxY = Math.max(...yValuesWithLabel);
|
||||||
|
const rectX = minX - rectParams.paddingX;
|
||||||
|
const rectY = minY - rectParams.paddingY;
|
||||||
|
const rectSizeX = maxX - minX + 2*rectParams.paddingX;
|
||||||
|
const rectSizeY = maxY - minY + 2*rectParams.paddingY;
|
||||||
|
|
||||||
rectangles.push({
|
rectangles.push({
|
||||||
ctx: canvascontext,
|
ctx: canvascontext,
|
||||||
|
|||||||
+978
-372
File diff suppressed because it is too large
Load Diff
@@ -15,8 +15,8 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@egjs/hammerjs": "^2.0.0",
|
"@egjs/hammerjs": "^2.0.0",
|
||||||
"component-emitter": "^1.3.0",
|
"component-emitter": "^1.3.0",
|
||||||
"esbuild": "^0.12.24",
|
"esbuild": "^0.25.0",
|
||||||
"esbuild-sass-plugin": "^1.5.2",
|
"esbuild-sass-plugin": "^3.3.1",
|
||||||
"keycharm": "^0.4.0",
|
"keycharm": "^0.4.0",
|
||||||
"timsort": "^0.3.0",
|
"timsort": "^0.3.0",
|
||||||
"uuid": "^8.0.0"
|
"uuid": "^8.0.0"
|
||||||
|
|||||||
@@ -3,16 +3,16 @@ from netbox.plugins import PluginTemplateExtension
|
|||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from packaging import version
|
from packaging import version
|
||||||
|
|
||||||
NETBOX_CURRENT_VERSION = version.parse(settings.VERSION)
|
NETBOX_CURRENT_VERSION = version.parse(settings.RELEASE.version)
|
||||||
|
|
||||||
|
|
||||||
class SiteButtons(PluginTemplateExtension):
|
class SiteButtons(PluginTemplateExtension):
|
||||||
model = 'dcim.site'
|
models = ('dcim.site', )
|
||||||
def buttons(self):
|
def buttons(self):
|
||||||
return self.render('netbox_topology_views/site_button.html')
|
return self.render('netbox_topology_views/site_button.html')
|
||||||
|
|
||||||
class LocationButtons(PluginTemplateExtension):
|
class LocationButtons(PluginTemplateExtension):
|
||||||
model = 'dcim.location'
|
models = ('dcim.location', )
|
||||||
def buttons(self):
|
def buttons(self):
|
||||||
return self.render('netbox_topology_views/location_button.html')
|
return self.render('netbox_topology_views/location_button.html')
|
||||||
|
|
||||||
|
|||||||
@@ -251,6 +251,7 @@ def create_node(
|
|||||||
node["shape"] = "image"
|
node["shape"] = "image"
|
||||||
node["href"] = device.get_absolute_url()
|
node["href"] = device.get_absolute_url()
|
||||||
node["image"] = get_image_for_entity(device)
|
node["image"] = get_image_for_entity(device)
|
||||||
|
node["label_num_lines"] = len(label_items)
|
||||||
|
|
||||||
return node
|
return node
|
||||||
|
|
||||||
@@ -443,14 +444,14 @@ def get_topology_data(
|
|||||||
termination_b = create_circuit_termination(
|
termination_b = create_circuit_termination(
|
||||||
circuit_termination.cable.b_terminations[0]
|
circuit_termination.cable.b_terminations[0]
|
||||||
)
|
)
|
||||||
elif circuit_termination.provider_network is not None:
|
elif circuit_termination.termination is not None:
|
||||||
if (
|
if (
|
||||||
circuit_termination.provider_network_id
|
circuit_termination.termination_id
|
||||||
not in nodes_provider_networks
|
not in nodes_provider_networks
|
||||||
):
|
):
|
||||||
nodes_provider_networks[
|
nodes_provider_networks[
|
||||||
circuit_termination.provider_network.pk
|
circuit_termination.termination.pk
|
||||||
] = circuit_termination.provider_network
|
] = circuit_termination.termination
|
||||||
|
|
||||||
if bool(termination_a) and bool(termination_b):
|
if bool(termination_a) and bool(termination_b):
|
||||||
circuit_model = {
|
circuit_model = {
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ long_description = readme.read_text()
|
|||||||
|
|
||||||
setup(
|
setup(
|
||||||
name="netbox-topology-views",
|
name="netbox-topology-views",
|
||||||
version="4.2.0",
|
version="4.2.1",
|
||||||
description="An NetBox plugin to create Topology maps",
|
description="An NetBox plugin to create Topology maps",
|
||||||
long_description=long_description,
|
long_description=long_description,
|
||||||
long_description_content_type="text/markdown",
|
long_description_content_type="text/markdown",
|
||||||
|
|||||||
Reference in New Issue
Block a user