コード例 #1
0
class UpgradeDeviceListTable(BaseTable):
    pk = ToggleColumn()
    name = tables.TemplateColumn(order_by=('name', ),
                                 template_code=UPGRADE_DEVICE_LINK)
    t_sw = tables.TemplateColumn(
        verbose_name='Target Version',
        template_code=UPGRADE_TARGET_SOFTWARE,
        orderable=False,
    )
    c_sw = tables.TemplateColumn(
        verbose_name='Curent Version',
        template_code=UPGRADE_CURRENT_SOFTWARE,
        orderable=False,
    )
    tenant = tables.TemplateColumn(template_code=COL_TENANT)
    device_role = ColoredLabelColumn(verbose_name='Role')
    device_type = tables.LinkColumn(
        verbose_name='Device Type',
        text=lambda record: record.device_type.model)
    tags = TagColumn(url_name='dcim:device_list')

    class Meta(BaseTable.Meta):
        model = Device
        fields = ('pk', 'name', 't_sw', 'c_sw', 'tenant', 'device_role',
                  'device_type', 'tags')
コード例 #2
0
class ServiceMappingListTable(BaseTable):
    pk = ToggleColumn()
    name = tables.TemplateColumn(order_by=("name", ),
                                 template_code=SERVICE_MAPPING_DEVICE_LINK,
                                 verbose_name='Device')
    service = tables.TemplateColumn(
        template_code=ATTACHED_SERVICES_LIST,
        verbose_name="Service",
        orderable=False,
    )
    tenant = tables.TemplateColumn(template_code=TenantColumn)
    device_role = ColoredLabelColumn(verbose_name="Role")
    device_type = tables.LinkColumn(
        viewname="dcim:devicetype",
        args=[Accessor("device_type.pk")],
        verbose_name="Type",
    )
    tags = TagColumn(url_name="dcim:device_list")

    status = tables.TemplateColumn(
        template_code=COMPLIANCE_STATUS,
        verbose_name="Status",
    )

    notes = tables.TemplateColumn(
        template_code=COMPLIANCE_NOTES,
        verbose_name="Notes",
        orderable=False,
    )

    class Meta(BaseTable.Meta):
        model = Device
        fields = ("pk", "name", "service", "tenant", "device_role",
                  "device_type", "tags", "status", "notes")
コード例 #3
0
ファイル: tables.py プロジェクト: vsrn09/netbox
class RackTable(BaseTable):
    pk = ToggleColumn()
    name = tables.LinkColumn(order_by=('_name', ))
    site = tables.LinkColumn(viewname='dcim:site',
                             args=[Accessor('site__slug')])
    tenant = tables.TemplateColumn(template_code=COL_TENANT)
    status = tables.TemplateColumn(template_code=STATUS_LABEL)
    role = ColoredLabelColumn()
    u_height = tables.TemplateColumn(template_code="{{ record.u_height }}U",
                                     verbose_name='Height')

    class Meta(BaseTable.Meta):
        model = Rack
        fields = (
            'pk',
            'name',
            'site',
            'group',
            'status',
            'facility_id',
            'tenant',
            'role',
            'serial',
            'asset_tag',
            'type',
            'width',
            'u_height',
        )
        default_columns = ('pk', 'name', 'site', 'group', 'status',
                           'facility_id', 'tenant', 'role', 'u_height')
コード例 #4
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')

    class Meta(BaseTable.Meta):
        model = Rack
        fields = (
            'pk',
            'name',
            'site',
            'location',
            'status',
            'facility_id',
            'tenant',
            'role',
            'serial',
            'asset_tag',
            'type',
            'width',
            'u_height',
        )
        default_columns = ('pk', 'name', 'site', 'location', 'status',
                           'facility_id', 'tenant', 'role', 'u_height')
コード例 #5
0
ファイル: racks.py プロジェクト: JonathonReinhart/netbox
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',
        )
コード例 #6
0
ファイル: tables.py プロジェクト: zhyh329/netbox
class VirtualMachineTable(BaseTable):
    pk = ToggleColumn()
    name = tables.Column(linkify=True)
    status = ChoiceFieldColumn()
    cluster = tables.Column(linkify=True)
    role = ColoredLabelColumn()
    tenant = TenantColumn()

    class Meta(BaseTable.Meta):
        model = VirtualMachine
        fields = ('pk', 'name', 'status', 'cluster', 'role', 'tenant', 'vcpus',
                  'memory', 'disk')
コード例 #7
0
ファイル: tables.py プロジェクト: fireman0865/allbox
class VirtualMachineTable(BaseTable):
    pk = ToggleColumn()
    name = tables.LinkColumn()
    status = tables.TemplateColumn(template_code=VIRTUALMACHINE_STATUS)
    cluster = tables.Column(linkify=True)
    role = ColoredLabelColumn()
    tenant = tables.TemplateColumn(template_code=COL_TENANT)

    class Meta(BaseTable.Meta):
        model = VirtualMachine
        fields = ('pk', 'name', 'status', 'cluster', 'role', 'tenant', 'vcpus',
                  'memory', 'disk')
コード例 #8
0
ファイル: tables.py プロジェクト: ypid/netbox
class VirtualMachineTable(BaseTable):
    pk = ToggleColumn()
    name = tables.LinkColumn()
    status = tables.TemplateColumn(template_code=VIRTUALMACHINE_STATUS)
    cluster = tables.LinkColumn(viewname='virtualization:cluster',
                                args=[Accessor('cluster.pk')])
    role = ColoredLabelColumn()
    tenant = tables.TemplateColumn(template_code=COL_TENANT)

    class Meta(BaseTable.Meta):
        model = VirtualMachine
        fields = ('pk', 'name', 'status', 'cluster', 'role', 'tenant', 'vcpus',
                  'memory', 'disk')
コード例 #9
0
ファイル: tables.py プロジェクト: fdomain/netbox
class VirtualMachineTable(BaseTable):
    pk = ToggleColumn()
    name = tables.Column(linkify=True)
    status = ChoiceFieldColumn()
    cluster = tables.Column(linkify=True)
    role = ColoredLabelColumn()
    tenant = TenantColumn()
    comments = MarkdownColumn()
    primary_ip4 = tables.Column(linkify=True, verbose_name='IPv4 Address')
    primary_ip6 = tables.Column(linkify=True, verbose_name='IPv6 Address')
    primary_ip = tables.Column(linkify=True,
                               order_by=PRIMARY_IP_ORDERING,
                               verbose_name='IP Address')
    tags = TagColumn(url_name='virtualization:virtualmachine_list')

    class Meta(BaseTable.Meta):
        model = VirtualMachine
        fields = (
            'pk',
            'id',
            'name',
            'status',
            'cluster',
            'role',
            'tenant',
            'platform',
            'vcpus',
            'memory',
            'disk',
            'primary_ip4',
            'primary_ip6',
            'primary_ip',
            'comments',
            'tags',
        )
        default_columns = (
            'pk',
            'name',
            'status',
            'cluster',
            'role',
            'tenant',
            'vcpus',
            'memory',
            'disk',
            'primary_ip',
        )
コード例 #10
0
class DeviceTable(BaseTable):
    pk = ToggleColumn()
    name = tables.TemplateColumn(order_by=('_name', ),
                                 template_code=DEVICE_LINK)
    status = ChoiceFieldColumn()
    tenant = TenantColumn()
    site = tables.Column(linkify=True)
    location = tables.Column(linkify=True)
    rack = tables.Column(linkify=True)
    device_role = ColoredLabelColumn(verbose_name='Role')
    manufacturer = tables.Column(
        accessor=Accessor('device_type__manufacturer'), linkify=True)
    device_type = tables.Column(linkify=True, verbose_name='Type')
    if settings.PREFER_IPV4:
        primary_ip = tables.Column(linkify=True,
                                   order_by=('primary_ip4', 'primary_ip6'),
                                   verbose_name='IP Address')
    else:
        primary_ip = tables.Column(linkify=True,
                                   order_by=('primary_ip6', 'primary_ip4'),
                                   verbose_name='IP Address')
    primary_ip4 = tables.Column(linkify=True, verbose_name='IPv4 Address')
    primary_ip6 = tables.Column(linkify=True, verbose_name='IPv6 Address')
    cluster = tables.Column(linkify=True)
    virtual_chassis = tables.Column(linkify=True)
    vc_position = tables.Column(verbose_name='VC Position')
    vc_priority = tables.Column(verbose_name='VC Priority')
    comments = MarkdownColumn()
    tags = TagColumn(url_name='dcim:device_list')

    class Meta(BaseTable.Meta):
        model = Device
        fields = (
            'pk',
            'name',
            'status',
            'tenant',
            'device_role',
            'manufacturer',
            'device_type',
            'platform',
            'serial',
            'asset_tag',
            'site',
            'location',
            'rack',
            'position',
            'face',
            'primary_ip',
            'primary_ip4',
            'primary_ip6',
            'cluster',
            'virtual_chassis',
            'vc_position',
            'vc_priority',
            'comments',
            'tags',
        )
        default_columns = (
            'pk',
            'name',
            'status',
            'tenant',
            'site',
            'location',
            'rack',
            'device_role',
            'manufacturer',
            'device_type',
            'primary_ip',
        )
コード例 #11
0
ファイル: tables.py プロジェクト: vsrn09/netbox
class DeviceTable(BaseTable):
    pk = ToggleColumn()
    name = tables.TemplateColumn(order_by=('_name', ),
                                 template_code=DEVICE_LINK)
    status = tables.TemplateColumn(template_code=STATUS_LABEL)
    tenant = tables.TemplateColumn(template_code=COL_TENANT)
    site = tables.Column(linkify=True)
    rack = tables.Column(linkify=True)
    device_role = ColoredLabelColumn(verbose_name='Role')
    device_type = tables.LinkColumn(
        viewname='dcim:devicetype',
        args=[Accessor('device_type__pk')],
        verbose_name='Type',
        text=lambda record: record.device_type.display_name)
    primary_ip = tables.TemplateColumn(template_code=DEVICE_PRIMARY_IP,
                                       orderable=False,
                                       verbose_name='IP Address')
    primary_ip4 = tables.Column(linkify=True, verbose_name='IPv4 Address')
    primary_ip6 = tables.Column(linkify=True, verbose_name='IPv6 Address')
    cluster = tables.LinkColumn(viewname='virtualization:cluster',
                                args=[Accessor('cluster__pk')])
    virtual_chassis = tables.LinkColumn(viewname='dcim:virtualchassis',
                                        args=[Accessor('virtual_chassis__pk')])
    vc_position = tables.Column(verbose_name='VC Position')
    vc_priority = tables.Column(verbose_name='VC Priority')
    tags = TagColumn(url_name='dcim:device_list')

    class Meta(BaseTable.Meta):
        model = Device
        fields = (
            'pk',
            'name',
            'status',
            'tenant',
            'device_role',
            'device_type',
            'platform',
            'serial',
            'asset_tag',
            'site',
            'rack',
            'position',
            'face',
            'primary_ip',
            'primary_ip4',
            'primary_ip6',
            'cluster',
            'virtual_chassis',
            'vc_position',
            'vc_priority',
            'tags',
        )
        default_columns = (
            'pk',
            'name',
            'status',
            'tenant',
            'site',
            'rack',
            'device_role',
            'device_type',
            'primary_ip',
        )