예제 #1
0
class RackTable(BaseTable):
    pk = ToggleColumn()
    name = tables.Column(
        order_by=('_name',),
        linkify=True
    )
    location = tables.Column(
        linkify=True
    )
    site = tables.Column(
        linkify=True
    )
    tenant = TenantColumn()
    status = ChoiceFieldColumn()
    role = ColoredLabelColumn()
    u_height = tables.TemplateColumn(
        template_code="{{ record.u_height }}U",
        verbose_name='Height'
    )
    comments = MarkdownColumn()
    device_count = LinkedCountColumn(
        viewname='dcim:device_list',
        url_params={'rack_id': 'pk'},
        verbose_name='Devices'
    )
    get_utilization = UtilizationColumn(
        orderable=False,
        verbose_name='Space'
    )
    get_power_utilization = UtilizationColumn(
        orderable=False,
        verbose_name='Power'
    )
    tags = TagColumn(
        url_name='dcim:rack_list'
    )
    outer_width = tables.TemplateColumn(
        template_code="{{ record.outer_width }} {{ record.outer_unit }}",
        verbose_name='Outer Width'
    )
    outer_depth = tables.TemplateColumn(
        template_code="{{ record.outer_depth }} {{ record.outer_unit }}",
        verbose_name='Outer Depth'
    )

    class Meta(BaseTable.Meta):
        model = Rack
        fields = (
            'pk', 'id', 'name', 'site', 'location', 'status', 'facility_id', 'tenant', 'role', 'serial', 'asset_tag',
            'type', 'width', 'outer_width', 'outer_depth', 'u_height', 'comments', 'device_count', 'get_utilization',
            'get_power_utilization', 'tags', 'created', 'last_updated',
        )
        default_columns = (
            'pk', 'name', 'site', 'location', 'status', 'facility_id', 'tenant', 'role', 'u_height', 'device_count',
            'get_utilization',
        )
예제 #2
0
class PrefixDetailTable(PrefixTable):
    utilization = UtilizationColumn(accessor='get_utilization',
                                    orderable=False)
    tenant = TenantColumn()
    tags = TagColumn(url_name='ipam:prefix_list')

    class Meta(PrefixTable.Meta):
        fields = (
            'pk',
            'prefix',
            'status',
            'children',
            'vrf',
            'utilization',
            'tenant',
            'site',
            'vlan',
            'role',
            'is_pool',
            'description',
            'tags',
        )
        default_columns = (
            'pk',
            'prefix',
            'status',
            'children',
            'vrf',
            'utilization',
            'tenant',
            'site',
            'vlan',
            'role',
            'description',
        )
예제 #3
0
class AggregateTable(BaseTable):
    pk = ToggleColumn()
    prefix = tables.Column(
        linkify=True,
        verbose_name='Aggregate'
    )
    tenant = TenantColumn()
    date_added = tables.DateColumn(
        format="Y-m-d",
        verbose_name='Added'
    )
    child_count = tables.Column(
        verbose_name='Prefixes'
    )
    utilization = UtilizationColumn(
        accessor='get_utilization',
        orderable=False
    )
    tags = TagColumn(
        url_name='ipam:aggregate_list'
    )

    class Meta(BaseTable.Meta):
        model = Aggregate
        fields = (
            'pk', 'id', 'prefix', 'rir', 'tenant', 'child_count', 'utilization', 'date_added', 'description', 'tags',
            'created', 'last_updated',
        )
        default_columns = ('pk', 'prefix', 'rir', 'tenant', 'child_count', 'utilization', 'date_added', 'description')
예제 #4
0
class RackDetailTable(RackTable):
    device_count = LinkedCountColumn(viewname='dcim:device_list',
                                     url_params={'rack_id': 'pk'},
                                     verbose_name='Devices')
    get_utilization = UtilizationColumn(verbose_name='Space')
    get_power_utilization = UtilizationColumn(orderable=False,
                                              verbose_name='Power')
    tags = TagColumn(url_name='dcim:rack_list')

    class Meta(RackTable.Meta):
        fields = (
            'pk',
            'name',
            'site',
            'location',
            'status',
            'facility_id',
            'tenant',
            'role',
            'serial',
            'asset_tag',
            'type',
            'width',
            'u_height',
            'device_count',
            'get_utilization',
            'get_power_utilization',
            'tags',
        )
        default_columns = (
            'pk',
            'name',
            'site',
            'location',
            'status',
            'facility_id',
            'tenant',
            'role',
            'u_height',
            'device_count',
            'get_utilization',
            'get_power_utilization',
        )
예제 #5
0
class AggregateDetailTable(AggregateTable):
    child_count = tables.Column(verbose_name='Prefixes')
    utilization = UtilizationColumn(accessor='get_utilization',
                                    orderable=False)
    tags = TagColumn(url_name='ipam:aggregate_list')

    class Meta(AggregateTable.Meta):
        fields = ('pk', 'prefix', 'rir', 'tenant', 'child_count',
                  'utilization', 'date_added', 'description', 'tags')
        default_columns = ('pk', 'prefix', 'rir', 'tenant', 'child_count',
                           'utilization', 'date_added', 'description')
예제 #6
0
class IPRangeTable(BaseTable):
    pk = ToggleColumn()
    start_address = tables.Column(linkify=True)
    vrf = tables.TemplateColumn(template_code=VRF_LINK, verbose_name='VRF')
    status = ChoiceFieldColumn(default=AVAILABLE_LABEL)
    role = tables.Column(linkify=True)
    tenant = TenantColumn()
    utilization = UtilizationColumn(accessor='utilization', orderable=False)
    tags = TagColumn(url_name='ipam:iprange_list')

    class Meta(BaseTable.Meta):
        model = IPRange
        fields = (
            'pk',
            'id',
            'start_address',
            'end_address',
            'size',
            'vrf',
            'status',
            'role',
            'tenant',
            'description',
            'utilization',
            'tags',
            'created',
            'last_updated',
        )
        default_columns = (
            'pk',
            'start_address',
            'end_address',
            'size',
            'vrf',
            'status',
            'role',
            'tenant',
            'description',
        )
        row_attrs = {
            'class': lambda record: 'success' if not record.pk else '',
        }