1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Merge pull request #5897 from wobcom/feature/device_components_custom_links

Activate custom links on device components
This commit is contained in:
Jeremy Stretch
2021-03-01 16:01:35 -05:00
committed by GitHub
2 changed files with 13 additions and 9 deletions

View File

@ -198,7 +198,7 @@ class PathEndpoint(models.Model):
# Console ports # Console ports
# #
@extras_features('export_templates', 'webhooks') @extras_features('export_templates', 'webhooks', 'custom_links')
class ConsolePort(CableTermination, PathEndpoint, ComponentModel): class ConsolePort(CableTermination, PathEndpoint, ComponentModel):
""" """
A physical console port within a Device. ConsolePorts connect to ConsoleServerPorts. A physical console port within a Device. ConsolePorts connect to ConsoleServerPorts.
@ -234,7 +234,7 @@ class ConsolePort(CableTermination, PathEndpoint, ComponentModel):
# Console server ports # Console server ports
# #
@extras_features('webhooks') @extras_features('webhooks', 'custom_links')
class ConsoleServerPort(CableTermination, PathEndpoint, ComponentModel): class ConsoleServerPort(CableTermination, PathEndpoint, ComponentModel):
""" """
A physical port within a Device (typically a designated console server) which provides access to ConsolePorts. A physical port within a Device (typically a designated console server) which provides access to ConsolePorts.
@ -270,7 +270,7 @@ class ConsoleServerPort(CableTermination, PathEndpoint, ComponentModel):
# Power ports # Power ports
# #
@extras_features('export_templates', 'webhooks') @extras_features('export_templates', 'webhooks', 'custom_links')
class PowerPort(CableTermination, PathEndpoint, ComponentModel): class PowerPort(CableTermination, PathEndpoint, ComponentModel):
""" """
A physical power supply (intake) port within a Device. PowerPorts connect to PowerOutlets. A physical power supply (intake) port within a Device. PowerPorts connect to PowerOutlets.
@ -379,7 +379,7 @@ class PowerPort(CableTermination, PathEndpoint, ComponentModel):
# Power outlets # Power outlets
# #
@extras_features('webhooks') @extras_features('webhooks', 'custom_links')
class PowerOutlet(CableTermination, PathEndpoint, ComponentModel): class PowerOutlet(CableTermination, PathEndpoint, ComponentModel):
""" """
A physical power outlet (output) within a Device which provides power to a PowerPort. A physical power outlet (output) within a Device which provides power to a PowerPort.
@ -479,7 +479,7 @@ class BaseInterface(models.Model):
return super().save(*args, **kwargs) return super().save(*args, **kwargs)
@extras_features('export_templates', 'webhooks') @extras_features('export_templates', 'webhooks', 'custom_links')
class Interface(CableTermination, PathEndpoint, ComponentModel, BaseInterface): class Interface(CableTermination, PathEndpoint, ComponentModel, BaseInterface):
""" """
A network interface within a Device. A physical Interface can connect to exactly one other Interface. A network interface within a Device. A physical Interface can connect to exactly one other Interface.
@ -624,7 +624,7 @@ class Interface(CableTermination, PathEndpoint, ComponentModel, BaseInterface):
# Pass-through ports # Pass-through ports
# #
@extras_features('webhooks') @extras_features('webhooks', 'custom_links')
class FrontPort(CableTermination, ComponentModel): class FrontPort(CableTermination, ComponentModel):
""" """
A pass-through port on the front of a Device. A pass-through port on the front of a Device.
@ -687,7 +687,7 @@ class FrontPort(CableTermination, ComponentModel):
}) })
@extras_features('webhooks') @extras_features('webhooks', 'custom_links')
class RearPort(CableTermination, ComponentModel): class RearPort(CableTermination, ComponentModel):
""" """
A pass-through port on the rear of a Device. A pass-through port on the rear of a Device.
@ -740,7 +740,7 @@ class RearPort(CableTermination, ComponentModel):
# Device bays # Device bays
# #
@extras_features('webhooks') @extras_features('webhooks', 'custom_links')
class DeviceBay(ComponentModel): class DeviceBay(ComponentModel):
""" """
An empty space within a Device which can house a child device An empty space within a Device which can house a child device
@ -800,7 +800,7 @@ class DeviceBay(ComponentModel):
# Inventory items # Inventory items
# #
@extras_features('export_templates', 'webhooks') @extras_features('export_templates', 'webhooks', 'custom_links')
class InventoryItem(MPTTModel, ComponentModel): class InventoryItem(MPTTModel, ComponentModel):
""" """
An InventoryItem represents a serialized piece of hardware within a Device, such as a line card or power supply. An InventoryItem represents a serialized piece of hardware within a Device, such as a line card or power supply.

View File

@ -1,6 +1,7 @@
{% extends 'base.html' %} {% extends 'base.html' %}
{% load helpers %} {% load helpers %}
{% load perms %} {% load perms %}
{% load custom_links %}
{% load plugins %} {% load plugins %}
{% block header %} {% block header %}
@ -30,6 +31,9 @@
{% endif %} {% endif %}
</div> </div>
<h1>{% block title %}{{ object.device }} / {{ object }}{% endblock %}</h1> <h1>{% block title %}{{ object.device }} / {{ object }}{% endblock %}</h1>
<div class="pull-right noprint">
{% custom_links object %}
</div>
<ul class="nav nav-tabs"> <ul class="nav nav-tabs">
<li role="presentation"{% if not active_tab %} class="active"{% endif %}> <li role="presentation"{% if not active_tab %} class="active"{% endif %}>
<a href="{{ object.get_absolute_url }}">{{ object|meta:"verbose_name"|bettertitle }}</a> <a href="{{ object.get_absolute_url }}">{{ object|meta:"verbose_name"|bettertitle }}</a>