class IPSecSiteConnectionsTable(tables.DataTable):
    STATUS_CHOICES = (
        ("Active", True),
        ("Down", True),
        ("Error", False),
    )
    STATUS_DISPLAY_CHOICES = (
        ("Active",
         pgettext_lazy("Current status of an IPSec Site Connection",
                       u"Active")),
        ("Down",
         pgettext_lazy("Current status of an IPSec Site Connection", u"Down")),
        ("Error",
         pgettext_lazy("Current status of an IPSec Site Connection",
                       u"Error")),
    )
    id = tables.Column('id', hidden=True)
    name = tables.Column('name_or_id',
                         verbose_name=_('Name'),
                         link="horizon:project:vpn:ipsecsiteconnectiondetails")
    vpnservice_name = tables.Column('vpnservice_name',
                                    verbose_name=_('VPN Service'))
    ikepolicy_name = tables.Column('ikepolicy_name',
                                   verbose_name=_('IKE Policy'))
    ipsecpolicy_name = tables.Column('ipsecpolicy_name',
                                     verbose_name=_('IPSec Policy'))
    status = tables.Column("status",
                           verbose_name=_("Status"),
                           status=True,
                           status_choices=STATUS_CHOICES,
                           display_choices=STATUS_DISPLAY_CHOICES)

    class Meta(object):
        name = "ipsecsiteconnectionstable"
        verbose_name = _("IPSec Site Connections")
        table_actions = (AddIPSecSiteConnectionLink,
                         DeleteIPSecSiteConnectionLink)
        row_actions = (UpdateIPSecSiteConnectionLink,
                       DeleteIPSecSiteConnectionLink)
class VPNServicesTable(tables.DataTable):
    name = tables.Column("name_or_id",
                         verbose_name=_('Name'),
                         link="horizon:project:vpn:vpnservicedetails")
    description = tables.Column('description', verbose_name=_('Description'))
    local_ips = tables.Column(get_local_ips,
                              verbose_name=_("Local Side Public IPs"))
    subnet_name = tables.Column(get_subnet_name, verbose_name=_('Subnet'))
    router_name = tables.Column('router_name', verbose_name=_('Router'))
    status = tables.Column("status", verbose_name=_("Status"))

    def get_object_display(self, vpnservice):
        return vpnservice.name_or_id

    class Meta(object):
        name = "vpnservicestable"
        verbose_name = _("VPN Services")
        status_columns = ['status']
        row_class = UpdateVPNServiceRow
        table_actions = (AddVPNServiceLink, DeleteVPNServiceLink,
                         VPNServicesFilterAction)
        row_actions = (UpdateVPNServiceLink, DeleteVPNServiceLink)
示例#3
0
文件: tables.py 项目: vasart/horizon
class ImagesTable(tables.DataTable):
    STATUS_CHOICES = (
        ("active", True),
        ("saving", None),
        ("queued", None),
        ("pending_delete", None),
        ("killed", False),
        ("deleted", False),
    )
    name = tables.Column(get_image_name,
                         link=("horizon:project:images:images:detail"),
                         verbose_name=_("Image Name"))
    image_type = tables.Column(get_image_type,
                               verbose_name=_("Type"),
                               filters=(filters.title,))
    status = tables.Column("status",
                           filters=(filters.title,),
                           verbose_name=_("Status"),
                           status=True,
                           status_choices=STATUS_CHOICES)
    public = tables.Column("is_public",
                           verbose_name=_("Public"),
                           empty_value=False,
                           filters=(filters.yesno, filters.capfirst))
    protected = tables.Column("protected",
                              verbose_name=_("Protected"),
                              empty_value=False,
                              filters=(filters.yesno, filters.capfirst))
    disk_format = tables.Column(get_format, verbose_name=_("Format"))

    class Meta:
        name = "images"
        row_class = UpdateRow
        status_columns = ["status"]
        verbose_name = _("Images")
        table_actions = (OwnerFilter, CreateImage, DeleteImage,)
        row_actions = (LaunchImage, CreateVolumeFromImage,
                       EditImage, DeleteImage,)
        pagination_param = "image_marker"
示例#4
0
class PTGsTable(tables.DataTable):
    name = tables.Column(
        "name",
        verbose_name=_("Name"),
        link="horizon:project:policytargets:policy_targetdetails")
    description = tables.Column("description", verbose_name=_("Description"))
    provided_policy_rule_sets = tables.Column(
        "provided_policy_rule_sets",
        sortable=False,
        verbose_name=_("Provided Rule Sets"))
    consumed_policy_rule_sets = tables.Column(
        "consumed_policy_rule_sets",
        sortable=False,
        verbose_name=_("Consumed Rule Sets"))
    l2_policy_id = tables.Column("l2_policy_id", verbose_name=_("L2 Policy"))
    status = tables.Column("status", verbose_name=_("Status"))

    class Meta(object):
        name = "policy_targetstable"
        verbose_name = _("Internal Groups")
        table_actions = (AddPTGLink, DeletePTGLink)
        row_actions = (UpdatePTGLink, DeletePTGLink)
class PoolsTable(tables.DataTable):
    name = tables.Column("name",
                         verbose_name=_("Name"),
                         link="horizon:project:loadbalancers:pooldetails")
    description = tables.Column('description', verbose_name=_("Description"))
    provider = tables.Column(
        'provider',
        verbose_name=_("Provider"),
        filters=(lambda v: filters.default(v, _('N/A')), ))
    subnet_name = tables.Column('subnet_name', verbose_name=_("Subnet"))
    protocol = tables.Column('protocol', verbose_name=_("Protocol"))
    vip_name = tables.Column('vip_name',
                             verbose_name=_("VIP"),
                             link=get_vip_link)

    class Meta:
        name = "poolstable"
        verbose_name = _("Pools")
        table_actions = (AddPoolLink, DeletePoolLink)
        row_actions = (UpdatePoolLink, AddVipLink, UpdateVipLink,
                       DeleteVipLink, AddPMAssociationLink,
                       DeletePMAssociationLink, DeletePoolLink)
示例#6
0
class NovaServicesTable(tables.DataTable):
    binary = tables.Column("binary", verbose_name=_('Name'))
    host = tables.Column('host', verbose_name=_('Host'))
    zone = tables.Column('zone', verbose_name=_('Zone'))
    status = tables.Column(get_agent_status, verbose_name=_('Status'))
    state = tables.Column('state',
                          verbose_name=_('State'),
                          display_choices=SERVICE_STATE_DISPLAY_CHOICES)
    updated_at = tables.Column(
        'updated_at',
        verbose_name=pgettext_lazy('Time since the last update',
                                   u'Last Updated'),
        filters=(utils_filters.parse_isotime, filters.timesince))

    def get_object_id(self, obj):
        return "%s-%s-%s" % (obj.binary, obj.host, obj.zone)

    class Meta(object):
        name = "nova_services"
        verbose_name = _("Compute Services")
        table_actions = (SubServiceFilterAction, )
        multi_select = False
示例#7
0
class LoadBalancersTable(tables.DataTable):
    name = tables.Column("name", verbose_name=_("Name"),
                         link="horizon:network:loadbalancers:loadbalancerdetails")
    internal_ip = tables.Column("internal_ip", verbose_name=_("Internal IP"))
    floating_ip = tables.Column("floating_ip", verbose_name=_("Floating IP"))
    subnet_name = tables.Column("subnet_name", verbose_name=_("Network"))
    status = tables.Column("status", verbose_name=_("Status"),
                           status=True,
                           status_choices=STATUS_CHOICES,
                           display_choices=STATUS_DISPLAY_CHOICES
                           )
    created_at = tables.Column("created_at", verbose_name=_("Create time"),
                               filters=[filters.parse_isotime])
    #     warings = tables.Column("warings", verbose_name=_("Warings"))

    class Meta(object):
        name = "loadbalancerstable"
        verbose_name = _("Loadbalancers")
        status_columns = ["status"]
        row_class = UpdateLoadBalancerRow
        table_actions = (AddLoadBalanderLink, DeletLoadBalanderLink)
        row_actions = (UpdateLoadBalancerLink, BackendServerLink, DeletLoadBalanderLink)
class ImagesTable(tables.DataTable):
    STATUS_CHOICES = (
        ("active", True),
        ("saving", None),
        ("queued", None),
        ("pending_delete", None),
        ("killed", False),
        ("deleted", False),
    )
    name = tables.Column("name",
                         link=("horizon:amazon:images:detail"),
                         verbose_name=_("Name"))
    region = tables.Column("region", verbose_name=_("Region"))
    platform = tables.Column("platform", verbose_name=_("Platform"))
    ownerid = tables.Column("ownerid", verbose_name=_("OwnerId"))
    is_public = tables.Column("is_public", verbose_name=_("Is_Public"))
    state = tables.Column("state", verbose_name=_("State"))

    class Meta:
        name = "images"
        verbose_name = _("Images")
        table_actions = (InstancesFilterAction, )
示例#9
0
class NetworkAgentsTable(tables.DataTable):
    agent_type = tables.Column('agent_type', verbose_name=_('Type'))
    binary = tables.Column("binary", verbose_name=_('Name'))
    host = tables.Column('host', verbose_name=_('Host'))
    status = tables.Column(get_network_agent_status, verbose_name=_('Status'))
    state = tables.Column(get_network_agent_state, verbose_name=_('State'))
    heartbeat_timestamp = tables.Column('heartbeat_timestamp',
                                        verbose_name=pgettext_lazy(
                                            'Time since the last update',
                                            u'Last Updated'),
                                        filters=(utils_filters.parse_isotime,
                                                 filters.timesince))

    def get_object_id(self, obj):
        return "%s-%s" % (obj.binary, obj.host)

    class Meta(object):
        name = "network_agents"
        verbose_name = _("Network Agents")
        table_actions = (NetworkAgentsFilterAction, )
        row_actions = (NetworkL3AgentRoutersLinkAction, )
        multi_select = False
示例#10
0
class MyTable(tables.DataTable):
    id = tables.Column('id', hidden=True, sortable=False)
    name = tables.Column(get_name, verbose_name="Verbose Name", sortable=True)
    value = tables.Column('value',
                          sortable=True,
                          link='http://example.com/',
                          attrs={'class': 'green blue'},
                          summation="average",
                          truncate=35)
    status = tables.Column('status', link=get_link)
    optional = tables.Column('optional', empty_value='N/A')
    excluded = tables.Column('excluded')

    class Meta:
        name = "my_table"
        verbose_name = "My Table"
        status_columns = ["status"]
        columns = ('id', 'name', 'value', 'optional', 'status')
        row_class = MyRow
        column_class = MyColumn
        table_actions = (MyFilterAction, MyAction, MyBatchAction)
        row_actions = (MyAction, MyLinkAction, MyBatchAction, MyToggleAction)
示例#11
0
class PortForwardingRulesTable(tables.DataTable):
    port = tables.Column(_get_port_name_or_id,
                         verbose_name=_("Port"),
                         link=_get_port_link_url)
    inside_addr = tables.Column("inside_addr",
                                verbose_name=_("Private Address"))
    inside_port = tables.Column("inside_port", verbose_name=_("Private Port"))
    outside_port = tables.Column("outside_port", verbose_name=_("Public Port"))
    protocol = tables.Column("protocol", verbose_name=_("Protocol"))
    description = tables.Column("description", verbose_name=_("Description"))

    def get_object_display(self, portforwarding):
        return portforwarding.id

    class Meta(object):
        name = "portforwardings"
        verbose_name = _("Port Forwarding Rules")
        table_actions = (AddPortForwardingRule, RemovePortForwardingRule)
        row_actions = (
            UpdatePortForwardingRule,
            RemovePortForwardingRule,
        )
示例#12
0
class JobsTable(tables.DataTable):
    def _workflow_input(datum):
        # this callable converts the json string to a string of type key1=value1, key2=value2, ...
        raw_data = getattr(datum, 'workflow_input', '')
        return ", ".join(
            ["{}={}".format(k, v) for k, v in json_loads(raw_data).items()])

    id = TriggerIdColumn("id", verbose_name=_("ID"), link=True)
    backup_name = tables.Column("name", verbose_name=_("Backup Name"))
    workflow_input = tables.Column(
        _workflow_input,
        verbose_name=_("Workflow Input"),
    )
    schedule_pattern = tables.Column(
        "schedule_pattern",
        verbose_name=_("Schedule Pattern"),
    )
    cron_trigger_id = tables.Column(
        "cron_trigger_id",
        verbose_name=_('Cron Trigger Id'),
    )
    creation_time = tables.Column(
        "creation_time",
        verbose_name=_("Creation Time"),
    )
    update_time = tables.Column(
        "update_time",
        verbose_name=_("Modification Time"),
    )

    def get_object_id(self, datum):
        return datum.id

    class Meta(object):
        name = "jobs"
        verbose_name = _("Jobs")
        table_actions = (tables.FilterAction, CreateBackupJob, DeleteBackupJob)
        row_actions = (UpdateBackupJob, CloneBackupJob, DeleteBackupJob)
示例#13
0
class RacksTable(tables.DataTable):
    STATUS_CHOICES = (
        ("unprovisioned", False),
        ("provisioning", None),
        ("active", True),
        ("error", False),
    )
    name = tables.Column('name',
                         link=("horizon:infrastructure:resource_management"
                               ":racks:detail"),
                         verbose_name=_("Rack Name"))
    subnet = tables.Column('subnet', verbose_name=_("IP Subnet"))
    resource_class = tables.Column(
        'get_resource_class',
        verbose_name=_("Class"),
        filters=(lambda resource_class:
                 (resource_class and resource_class.name) or None, ))
    node_count = tables.Column('nodes_count', verbose_name=_("Nodes"))
    state = tables.Column('state',
                          verbose_name=_("State"),
                          status=True,
                          status_choices=STATUS_CHOICES)
    usage = tables.Column('vm_capacity',
                          verbose_name=_("Usage"),
                          filters=(lambda vm_capacity:
                                   (vm_capacity.value and "%s %%" % int(
                                       round(
                                           (100 / float(vm_capacity.value)) *
                                           vm_capacity.usage, 0))) or None, ))

    class Meta:
        name = "racks"
        row_class = UpdateRow
        status_columns = ["state"]
        verbose_name = _("Racks")
        table_actions = (UploadRack, CreateRack, DeleteRacks,
                         RacksFilterAction)
        row_actions = (EditRack, DeleteRacks)
示例#14
0
class InstancesTable(tables.DataTable):
    TASK_STATUS_CHOICES = ((None, True), ("none", True))
    STATUS_CHOICES = (
        ("active", True),
        ("suspended", True),
        ("paused", True),
        ("error", False),
    )
    TASK_DISPLAY_CHOICES = (("image_snapshot", "Snapshotting"), )
    name = tables.Column("name", link="horizon:nova:instances_and_volumes:" \
                                      "instances:detail",
                         verbose_name=_("Instance Name"))
    ip = tables.Column(get_ips, verbose_name=_("IP Address"))
    size = tables.Column(get_size, verbose_name=_("Size"))
    status = tables.Column("status",
                           filters=(title, replace_underscores),
                           verbose_name=_("Status"),
                           status=True,
                           status_choices=STATUS_CHOICES)
    task = tables.Column("OS-EXT-STS:task_state",
                         verbose_name=_("Task"),
                         filters=(title, replace_underscores),
                         status=True,
                         status_choices=TASK_STATUS_CHOICES,
                         display_choices=TASK_DISPLAY_CHOICES)
    state = tables.Column(get_power_state,
                          filters=(title, replace_underscores),
                          verbose_name=_("Power State"))

    class Meta:
        name = "instances"
        verbose_name = _("Instances")
        status_columns = ["status", "task"]
        row_class = UpdateRow
        table_actions = (LaunchLink, TerminateInstance)
        row_actions = (SnapshotLink, AssociateIP, EditInstance, ConsoleLink,
                       LogLink, TogglePause, ToggleSuspend, RebootInstance,
                       TerminateInstance)
示例#15
0
class WidgetDimensionTable(FormsetDataTable):

    formset_class = WidgetDimensionFormset

    def get_formset(self):
        """Provide the formset corresponding to this DataTable.

        Use this to validate the formset and to get the submitted data back.
        """
        if self.widget:
            queryset = self.widget.dimensions
        else:
            queryset = WidgetDimension.objects.none()
        if self._formset is None:
            self._formset = self.formset_class(
                self.request.POST or None,
                initial=self._get_formset_data(),
                prefix=self._meta.name,
                queryset=queryset)
        return self._formset

    def __init__(self, *args, **kwargs):
        self._meta.row_class = CustomFormsetRow
        self.widget = kwargs.pop('widget', None)
        super(WidgetDimensionTable, self).__init__(*args, **kwargs)

    widget_id = tables.Column('widget_id', hidden=True)
    widget_type = tables.Column('widget_type', hidden=True)
    size = tables.Column('size', verbose_name=_('Size'))
    width = tables.Column('width', verbose_name=('Width'))
    height = tables.Column('height', verbose_name=_('Height'))
    offset = tables.Column('offset', verbose_name=_('Offset'))

    name = 'dimensions'

    class Meta:
        name = 'dimensions'
        table_name = 'Dimensions'
示例#16
0
class BgpvpnTable(tables.DataTable):
    tenant_id = tables.Column("tenant_name", verbose_name=_("Project"))
    name = tables.Column("name_or_id",
                         verbose_name=_("Name"),
                         link=("horizon:admin:bgpvpn:detail"))
    type = tables.Column("type", verbose_name=_("Type"))
    route_targets = tables.Column(get_route_targets,
                                  verbose_name=_("Route Targets"))
    import_targets = tables.Column(get_import_targets,
                                   verbose_name=_("Import Targets"))
    export_targets = tables.Column(get_export_targets,
                                   verbose_name=_("Export Targets"))
    networks = project_tables.NetworksColumn("networks",
                                             verbose_name=_("Networks"))
    routers = project_tables.RoutersColumn("routers",
                                           verbose_name=_("Routers"))

    class Meta(object):
        table_actions = (CreateBgpVpn, DeleteBgpvpn)
        row_actions = (EditInfoBgpVpn,
                       UpdateNetworkAssociations,
                       UpdateRouterAssociations,
                       DeleteBgpvpn)
示例#17
0
文件: tables.py 项目: kvite/horizon
class CinderServicesTable(tables.DataTable):
    binary = tables.Column("binary", verbose_name=_('Name'))
    host = tables.Column('host', verbose_name=_('Host'))
    zone = tables.Column('zone', verbose_name=_('Zone'))
    status = tables.Column('status', verbose_name=_('Status'),
                           filters=(filters.title, ))
    state = tables.Column('state', verbose_name=_('State'),
                          filters=(filters.title, ))
    updated_at = tables.Column('updated_at',
                               verbose_name=pgettext(
                                   'Time since the last update',
                                   u'Last Updated'),
                               filters=(utils_filters.parse_isotime,
                                        filters.timesince))

    def get_object_id(self, obj):
        return "%s-%s-%s" % (obj.binary, obj.host, obj.zone)

    class Meta:
        name = "cinder_services"
        verbose_name = _("Block Storage Services")
        table_actions = (SubServiceFilterAction,)
        multi_select = False
示例#18
0
class SecurityServicesTable(tables.DataTable):
    name = tables.WrappingColumn(
        "name",
        verbose_name=_("Name"),
        link="horizon:project:security_services:security_service_detail")
    description = tables.Column("description", verbose_name=_("Description"))
    dns_ip = tables.Column("dns_ip", verbose_name=_("DNS IP"))
    ou = tables.Column("ou", verbose_name=_("Organizational Unit"))
    server = tables.Column("server", verbose_name=_("Server"))
    domain = tables.Column("domain", verbose_name=_("Domain"))
    user = tables.Column("user", verbose_name=_("User"))

    def get_object_display(self, security_service):
        return security_service.name or str(security_service.id)

    def get_object_id(self, security_service):
        return str(security_service.id)

    class Meta(object):
        name = "security_services"
        verbose_name = _("Security Services")
        table_actions = (tables.NameFilterAction, Create, Delete)
        row_actions = (Edit, Delete)
示例#19
0
class NovaServicesTable(tables.DataTable):
    binary = tables.Column("binary", verbose_name=_('Name'))
    host = tables.Column('host', verbose_name=_('Host'))
    zone = tables.Column('zone', verbose_name=_('Zone'))
    status = tables.Column(get_nova_agent_status, verbose_name=_('Status'))
    state = tables.Column('state',
                          verbose_name=_('State'),
                          filters=(filters.title, ))
    updated_at = tables.Column(
        'updated_at',
        verbose_name=pgettext_lazy('Time since the last update',
                                   u'Last Updated'),
        filters=(utils_filters.parse_isotime, filters.timesince))

    def get_object_id(self, obj):
        return "%s-%s-%s" % (obj.binary, obj.host, obj.zone)

    class Meta:
        template = "horizon/common/_tab_data_table.html"
        name = "nova_services"
        verbose_name = _("Compute Services")
        table_actions = (SubServiceFilterAction, )
        multi_select = False
示例#20
0
class L3PolicyTable(tables.DataTable):
    name = tables.Column(
        "name",
        verbose_name=_("Name"),
        link="horizon:project:network_policy:l3policy_details")
    description = tables.Column("description", verbose_name=_("Description"))
    id = tables.Column("id", verbose_name=_("ID"))
    ip_version = tables.Column("ip_version", verbose_name=_("IP Version"))
    ip_pool = tables.Column("ip_pool", verbose_name=_("IP Pool"))
    subnet_prefix_length = tables.Column(
        "subnet_prefix_length", verbose_name=_("Subnet Prefix Length"))

    class Meta:
        name = "l3policy_table"
        verbose_name = _("L3 Policy")
        table_actions = (
            CreateL3PolicyLink,
            DeleteL3PolicyLink,
        )
        row_actions = (
            EditL3PolicyLink,
            DeleteL3PolicyLink,
        )
示例#21
0
文件: tables.py 项目: starlingx/gui
class DevicesTable(tables.DataTable):
    """Devices Table per host under Host Tab"""

    name = tables.Column('name',
                         verbose_name=_('Name'),
                         link=get_viewdevice_link_url)
    address = tables.Column('pciaddr', verbose_name=_('Address'))
    device_id = tables.Column('pdevice_id', verbose_name=_('Device Id'))
    device_name = tables.Column('pdevice', verbose_name=_('Device Name'))
    numa_node = tables.Column('numa_node', verbose_name=_('Numa Node'))
    enabled = tables.Column('enabled', verbose_name=_('Enabled'))

    def get_object_id(self, datum):
        return str(datum.uuid)

    def get_object_display(self, datum):
        return datum.name

    class Meta(object):
        name = "devices"
        verbose_name = _("Devices")
        multi_select = False
        row_actions = (EditDevice, )
示例#22
0
class InstanceTable(tables.DataTable):
    name = tables.Column(get_instance_name,
                         verbose_name="Name",
                         link="horizon:project:instances:detail")
    image = tables.Column('image_name', verbose_name="Image Name")
    flavor = tables.Column(get_flavor, verbose_name="Flavor")
    ip = tables.Column(get_ip_list, verbose_name="IP Address")
    status = tables.Column('status', verbose_name="Status")
    created = tables.Column("created",
                            verbose_name=_("Time since created"),
                            filters=(filters.parse_isotime,
                                     filters.timesince_sortable),
                            attrs={'data-type': 'timesince'})

    class Meta(object):
        name = "instances"
        verbose_name = _("Instances")
        #status_columns = ["status"]\
        table_actions = (
            InstanceFilter,
            CreateInstance,
        )
        row_actions = (StartInstance, LockInstance, StopInstance)
示例#23
0
class ProviderNetworksTable(tables.DataTable):
    name = tables.Column("name",
                         verbose_name=_("Network Name"),
                         link='horizon:admin:providernets:providernets:detail')
    status = tables.Column("status",
                           verbose_name=_("Status"),
                           status=True,
                           status_choices=PROVIDERNET_STATUS_CHOICES)
    type = tables.Column("type", verbose_name=_("Type"))
    mtu = tables.Column("mtu", verbose_name=_("MTU"))
    ranges = tables.Column(transform=_format_providernet_ranges,
                           verbose_name=_("Segmentation Ranges"))
    vlan_transparent = tables.Column("vlan_transparent",
                                     verbose_name=_("VLAN Transparent"))

    class Meta(object):
        name = "provider_networks"
        verbose_name = _("Provider Networks")
        status_columns = ["status"]
        table_actions = (CreateProviderNetwork, DeleteProviderNetwork,
                         ProviderNetworksFilterAction)
        row_actions = (EditProviderNetwork, DeleteProviderNetwork,
                       AddProviderNetworkRange)
示例#24
0
class VPNServicesTable(tables.DataTable):
    STATUS_CHOICES = (
        ("Active", True),
        ("Down", True),
        ("Error", False),
    )
    id = tables.Column('id', hidden=True)
    name = tables.Column("name", verbose_name=_('Name'),
                         link="horizon:project:vpn:vpnservicedetails")
    description = tables.Column('description', verbose_name=_('Description'))
    subnet_name = tables.Column('subnet_name', verbose_name=_('Subnet'))
    router_name = tables.Column('router_name', verbose_name=_('Router'))
    status = tables.Column("status",
                           filters=(title, filters.replace_underscores),
                           verbose_name=_("Status"),
                           status=True,
                           status_choices=STATUS_CHOICES)

    class Meta:
        name = "vpnservicestable"
        verbose_name = _("VPN Services")
        table_actions = (AddVPNServiceLink, DeleteVPNServiceLink)
        row_actions = (UpdateVPNServiceLink, DeleteVPNServiceLink)
示例#25
0
文件: tables.py 项目: openmsa/NO
class NodeTable(tables.DataTable):
    name = tables.Column('name',
                         verbose_name=_('Name'),
                         link=constants.NODE_DETAIL_URL)
    apl_type = tables.Column('apl_type', verbose_name=_('Apl Type'),
                             display_choices=APL_TYPE_DISPLAY_CHOICES)
    type = tables.Column('type', verbose_name=_('Type'),
                         display_choices=TYPE_DISPLAY_CHOICES)
    device = tables.Column('device_name', verbose_name=_('Device Type'))
    status = tables.Column('task_status',
                           verbose_name=_("Status"),
                           display_choices=STATUS_DISPLAY_CHOICES)
    task = tables.Column('task_status',
                         verbose_name=_("Task"),
                         status=True,
                         empty_value=TASK_DISPLAY_NONE,
                         status_choices=TASK_STATUS_CHOICES,
                         display_choices=TASK_DISPLAY_CHOICES)

    def get_object_id(self, node):
        func_type = \
            NODE_FUNCTION_TYPE_MAPPING[str(node.apl_type)][str(node.type)]
        return '|'.join([func_type, str(node.id)])

    class Meta(object):
        name = "node"
        verbose_name = _("Node")
        status_columns = ["task", ]
        multi_select = False
        row_class = UpdateNodeRow
        row_actions = []
        for node_button in NODE_ALL_BUTTONS:
            if node_button in NODE_DISPLAY_BUTTONS_FOR_USER['project'] and \
                    node_button in NODE_DISPLAY_BUTTONS_FOR_CLASS['node']:
                button_class = getattr(setting, node_button)
                row_actions.append(button_class)
        table_actions = (NodeFilterAction, CreateNodeLink)
示例#26
0
class iStoragePoolsTable(tables.DataTable):
    tier_name = tables.Column(
        'tier_name',
        verbose_name=_('Ceph Storage Tier'))

    cinder_pool_gib = tables.Column(
        'cinder_pool_gib',
        verbose_name=_('Cinder Volume Storage (GiB)'))

    glance_pool_gib = tables.Column(
        'glance_pool_gib',
        verbose_name=_('Glance Image Storage (GiB)'))

    ephemeral_pool_gib = tables.Column(
        'ephemeral_pool_gib',
        verbose_name=_('Nova Ephemeral Disk Storage (GiB)'))

    object_pool_gib = tables.Column(
        'object_pool_gib',
        verbose_name=_('Object Storage (GiB)'))

    total_ceph_space = tables.Column(
        'ceph_total_space_gib',
        verbose_name=_('Ceph total space (GiB)'))

    def get_object_id(self, datum):
        return unicode(datum.uuid)

    def get_object_display(self, datum):
        return ("%s" % datum.tier_name)

    class Meta(object):
        name = "storage_pools_table"
        verbose_name = _("Ceph Storage Pools")
        row_class = UpdateStorageRow
        multi_select = False
        row_actions = (EditiStoragePools,)
示例#27
0
class SudoTable(tables.DataTable):
    name = tables.Column(
        "name",
        verbose_name=_("Sudo policy name"),
    )
    users = tables.Column(
        "users_hr",
        verbose_name=_("Users"),
    )
    runas = tables.Column(
        "runas_hr",
        verbose_name=_("Allow running as"),
    )
    commands = tables.Column(
        "commands_hr",
        verbose_name=_("Commands"),
    )
    options = tables.Column(
        "options_hr",
        verbose_name=_("Options"),
    )
    authenticate = tables.Column(
        "authrequired",
        verbose_name=_("Require Password"),
    )

    class Meta(object):
        name = "proxies"
        verbose_name = _("Sudo Policies")
        table_actions = (
            AddRule,
            DeleteRule,
        )
        row_actions = (
            ModifyRule,
            DeleteRule,
        )
示例#28
0
class SensorGroupsTable(tables.DataTable):
    name = tables.Column('sensorgroupname',
                         link="horizon:admin:inventory:sensorgroupdetail",
                         verbose_name=('Name'))
    sensor_type = tables.Column('sensortype',
                                verbose_name=('SensorType'))
    sensor_state = tables.Column('state',
                                 verbose_name=('State'))
    sensors = tables.Column(get_sensors,
                            verbose_name=('Sensors'),
                            help_text=_("Sensors in SensorGroup."))
    actions_group = tables.Column(get_sensorgroup_actions,
                                  verbose_name=('Sensor Handling Actions'),
                                  help_text=_("Actions performed on "
                                              "Sensor Event."))
    suppressed = tables.Column(get_sensorgroup_suppress,
                               verbose_name=('Suppression'),
                               help_text=_("Indicates 'suppressed' if Actions "
                                           "are suppressed."))

    def get_object_id(self, datum):
        return unicode(datum.uuid)

    def get_object_display(self, datum):
        return datum.sensorgroupname

    class Meta(object):
        name = "sensorgroups"
        verbose_name = ("Sensor Groups")
        columns = ('name', 'sensor_type', 'sensor_state', 'sensors',
                   'actions_group', 'suppressed')
        multi_select = False
        row_actions = (EditSensorGroup,
                       UnSuppressSensorGroup,
                       SuppressSensorGroup)
        table_actions = (RelearnSensorModel,)
        hidden_title = False
示例#29
0
class UpdatePolicyReactionTable(tables.DataTable):
    position = tables.Column("position", verbose_name=_("Position"), hidden=True)
    alarm_id = tables.Column("alarm_id", hidden=True)
    action_id = tables.Column("action_id", hidden=True)
    alarm_name = tables.Column(lambda x: x["alarm"]["name"],
                               verbose_name=_("Alarm"),
                               link=(lambda x: reverse_lazy(URL_PREFIX + "updatealarm",
                                                            kwargs={"id": x["alarm_id"]})))
    action_name = tables.Column(lambda x: x["action"]["name"],
                                verbose_name=_("Action"),
                                link=(lambda x: reverse_lazy(URL_PREFIX + "updateaction",
                                                             kwargs={"id": x["action_id"]})))

    summary = tables.Column(lambda x: reaction_summary(x["alarm"], x["action"]),
                            verbose_name=_("Summary"))

    def get_object_id(self, datum):
        return datum['position']

    class Meta(object):
        name = "updatepolicyreactiontable"
        verbose_name = _("Scaling Policy Reactions")
        table_actions = (AddReactionLink,)
        row_actions = (DeleteReactionLink, )
示例#30
0
class NovaShareNetworkTable(tables.DataTable):
    name = tables.Column("name",
                         verbose_name=_("Name"),
                         link="horizon:admin:shares:share_network_detail")
    tenant = tables.Column("tenant_name", verbose_name=_("Project"))
    nova_net = tables.Column("nova_net", verbose_name=_("Nova Net"))
    ip_version = tables.Column("ip_version", verbose_name=_("IP Version"))
    network_type = tables.Column("network_type",
                                 verbose_name=_("Network Type"))
    segmentation_id = tables.Column("segmentation_id",
                                    verbose_name=_("Segmentation Id"))

    def get_object_display(self, share_network):
        return share_network.name or str(share_network.id)

    def get_object_id(self, share_network):
        return str(share_network.id)

    class Meta(object):
        name = "share_networks"
        verbose_name = _("Share Networks")
        table_actions = (share_networks_tables.Delete, )
        row_class = share_networks_tables.UpdateRow
        row_actions = (share_networks_tables.Delete, )