Fixes sorting on IP Address columns in tables.
The jQuery tablesorter plugin was choosing the digit parser instead of the ipAddress parser for the IP Address columns. This caused those columns to not sort correctly since only the first 2 octects were looked at for sorting. This patch adds an 'ip' data attribute to these columns and updates the set_table_sorting function to set the ipAddress sorter when this attribute is present. Fixes bug 1108085 Change-Id: I3ca05048ce43b5bda14a4c586146c7ec9e479a79
This commit is contained in:
parent
e4541a6175
commit
ae2a456a34
@ -254,6 +254,10 @@ $(parent).find("table.datatable").each(function () {
|
|||||||
// set as [i-1] as there is one more <th> in <thead>
|
// set as [i-1] as there is one more <th> in <thead>
|
||||||
// than <td>'s in <tbody>
|
// than <td>'s in <tbody>
|
||||||
header_options[i-1] = {sorter: 'sizeSorter'};
|
header_options[i-1] = {sorter: 'sizeSorter'};
|
||||||
|
} else if ($th.data('type') == 'ip'){
|
||||||
|
// set as [i-1] as there is one more <th> in <thead>
|
||||||
|
// than <td>'s in <tbody>
|
||||||
|
header_options[i-1] = {sorter: 'ipAddress'};
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
$table.tablesorter({
|
$table.tablesorter({
|
||||||
|
@ -89,7 +89,9 @@ class AdminInstancesTable(tables.DataTable):
|
|||||||
name = tables.Column("name",
|
name = tables.Column("name",
|
||||||
link=("horizon:admin:instances:detail"),
|
link=("horizon:admin:instances:detail"),
|
||||||
verbose_name=_("Name"))
|
verbose_name=_("Name"))
|
||||||
ip = tables.Column(get_ips, verbose_name=_("IP Address"))
|
ip = tables.Column(get_ips,
|
||||||
|
verbose_name=_("IP Address"),
|
||||||
|
attrs={'data-type': "ip"})
|
||||||
size = tables.Column(get_size,
|
size = tables.Column(get_size,
|
||||||
verbose_name=_("Size"),
|
verbose_name=_("Size"),
|
||||||
classes=('nowrap-col',),
|
classes=('nowrap-col',),
|
||||||
|
@ -111,7 +111,9 @@ def get_instance_link(datum):
|
|||||||
|
|
||||||
|
|
||||||
class FloatingIPsTable(tables.DataTable):
|
class FloatingIPsTable(tables.DataTable):
|
||||||
ip = tables.Column("ip", verbose_name=_("IP Address"))
|
ip = tables.Column("ip",
|
||||||
|
verbose_name=_("IP Address"),
|
||||||
|
attrs={'data-type': "ip"})
|
||||||
instance = tables.Column(get_instance_info,
|
instance = tables.Column(get_instance_info,
|
||||||
link=get_instance_link,
|
link=get_instance_link,
|
||||||
verbose_name=_("Instance"),
|
verbose_name=_("Instance"),
|
||||||
|
@ -454,7 +454,9 @@ class InstancesTable(tables.DataTable):
|
|||||||
name = tables.Column("name",
|
name = tables.Column("name",
|
||||||
link=("horizon:project:instances:detail"),
|
link=("horizon:project:instances:detail"),
|
||||||
verbose_name=_("Instance Name"))
|
verbose_name=_("Instance Name"))
|
||||||
ip = tables.Column(get_ips, verbose_name=_("IP Address"))
|
ip = tables.Column(get_ips,
|
||||||
|
verbose_name=_("IP Address"),
|
||||||
|
attrs={'data-type': "ip"})
|
||||||
size = tables.Column(get_size,
|
size = tables.Column(get_size,
|
||||||
verbose_name=_("Size"),
|
verbose_name=_("Size"),
|
||||||
attrs={'data-type': 'size'})
|
attrs={'data-type': 'size'})
|
||||||
|
@ -136,7 +136,8 @@ def get_member_link(member):
|
|||||||
class MembersTable(tables.DataTable):
|
class MembersTable(tables.DataTable):
|
||||||
address = tables.Column('address',
|
address = tables.Column('address',
|
||||||
verbose_name=_("IP Address"),
|
verbose_name=_("IP Address"),
|
||||||
link=get_member_link)
|
link=get_member_link,
|
||||||
|
attrs={'data-type': "ip"})
|
||||||
protocol_port = tables.Column('protocol_port',
|
protocol_port = tables.Column('protocol_port',
|
||||||
verbose_name=_("Protocol Port"))
|
verbose_name=_("Protocol Port"))
|
||||||
pool_name = tables.Column("pool_name",
|
pool_name = tables.Column("pool_name",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user