Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade for Netbox V4 #5

Merged
merged 2 commits into from
May 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading