Skip to content

Commit

Permalink
Upgrade for Netbox V4
Browse files Browse the repository at this point in the history
  • Loading branch information
minitriga committed May 8, 2024
1 parent 83970b5 commit 1f450c1
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 8 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ systemctl restart netbox

| netbox version | plugin version |
| -------------- | ----------------------------- |
| >= 3.7.0 | >= v1.0.0 |
| >= 4.0.0 | >= v1.1.0 |
| <= 4.0.0 | = v1.0.0 |

### Update

Expand Down
4 changes: 2 additions & 2 deletions netbox_reorder_rack/__init__.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
from extras.plugins import PluginConfig
from netbox.plugins import PluginConfig


class NetboxReorderRackConfig(PluginConfig):
name = "netbox_reorder_rack"
verbose_name = "NetBox Reorder Rack"
description = "NetBox plugin to reorder rack layouts."
version = "1.0.0"
version = "1.1.0"
base_url = "reorder"


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@
{% if device.device.face == face %}
<div class='grid-stack-item' gs-w='2' gs-h='{{ device.height|rack_unit_to_int|mul:2 }}' gs-x='0' gs-y='{{device|calculate_u_position:object}}' gs-id='{{device.device.id}}' gs-locked='false' data-item-color="{{device.device.role.color}}" data-item-text-color="{% if device.device.role.color %}{{ device.device.role.color|text_color }}{% else %}000000{% endif %}" data-full-depth="{{device.device.device_type.is_full_depth}}" data-item-face="{{ face }}">
<div class='grid-stack-item-content' style="background-color: #{{device.device.role.color}}; color: #{% if device.device.role.color %}{{ device.device.role.color|text_color }}{% else %}000000{% endif %};">
{{device.device.name}}
{{ device.device | device_name }}
</div>
</div>
{% else %}
<div class='grid-stack-item' gs-w='2' gs-h='{{ device.height|rack_unit_to_int|mul:2 }}' gs-x='0' gs-y='{{device|calculate_u_position:object}}' gs-id='{{device.device.id}}' gs-locked='false' data-item-color="{{device.device.role.color}}" data-item-text-color="{% if device.device.role.color %}{{ device.device.role.color|text_color }}{% else %}000000{% endif %}" data-full-depth="{{device.device.device_type.is_full_depth}}" data-item-face="back">
<div class='grid-stack-item-content device_rear' style="color: #000000">
{{device.device.name}}
{{ device.device.name }}
</div>
</div>
{% endif %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@

{% block subtitle %}
<div class="object-subtitle">
<span>Created {{ object.created|annotated_date }}</span>
<span>Created {{ object.created|isodatetime }}</span>
<span class="separator">&middot;</span>
<span>Updated <span title="{{ object.last_updated }}">{{ object.last_updated|timesince }}</span> ago</span>
</div>
Expand Down
8 changes: 7 additions & 1 deletion netbox_reorder_rack/templatetags/rack.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from dcim.svg.racks import get_device_name
from django import template
from utilities.utils import foreground_color
from utilities.html import foreground_color

register = template.Library()

Expand Down Expand Up @@ -40,3 +41,8 @@ def mul(value, mul_value):
@register.filter()
def text_color(value):
return foreground_color(value)


@register.filter()
def device_name(device):
return get_device_name(device)
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

setup(
name="netbox_reorder_rack",
version="1.0.0",
version="1.1.0",
author="Alex Gittings",
author_email="[email protected]",
description="NetBox plugin to reorder rack layouts.",
Expand Down

0 comments on commit 1f450c1

Please sign in to comment.