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

Closes #8469: Move BaseTable, columns to netbox core app

This commit is contained in:
jeremystretch
2022-01-27 15:00:10 -05:00
parent 083d1acb81
commit 4a1b4e0485
33 changed files with 321 additions and 349 deletions

View File

@@ -1,7 +1,7 @@
import django_tables2 as tables
from dcim.models import PowerFeed, PowerPanel
from utilities.tables import BaseTable, ChoiceFieldColumn, LinkedCountColumn, MarkdownColumn, TagColumn, ToggleColumn
from netbox.tables import BaseTable, columns
from .devices import CableTerminationTable
__all__ = (
@@ -15,19 +15,19 @@ __all__ = (
#
class PowerPanelTable(BaseTable):
pk = ToggleColumn()
pk = columns.ToggleColumn()
name = tables.Column(
linkify=True
)
site = tables.Column(
linkify=True
)
powerfeed_count = LinkedCountColumn(
powerfeed_count = columns.LinkedCountColumn(
viewname='dcim:powerfeed_list',
url_params={'power_panel_id': 'pk'},
verbose_name='Feeds'
)
tags = TagColumn(
tags = columns.TagColumn(
url_name='dcim:powerpanel_list'
)
@@ -44,7 +44,7 @@ class PowerPanelTable(BaseTable):
# We're not using PathEndpointTable for PowerFeed because power connections
# cannot traverse pass-through ports.
class PowerFeedTable(CableTerminationTable):
pk = ToggleColumn()
pk = columns.ToggleColumn()
name = tables.Column(
linkify=True
)
@@ -54,16 +54,16 @@ class PowerFeedTable(CableTerminationTable):
rack = tables.Column(
linkify=True
)
status = ChoiceFieldColumn()
type = ChoiceFieldColumn()
status = columns.ChoiceFieldColumn()
type = columns.ChoiceFieldColumn()
max_utilization = tables.TemplateColumn(
template_code="{{ value }}%"
)
available_power = tables.Column(
verbose_name='Available power (VA)'
)
comments = MarkdownColumn()
tags = TagColumn(
comments = columns.MarkdownColumn()
tags = columns.TagColumn(
url_name='dcim:powerfeed_list'
)