Modify

Opened 4 years ago

Last modified 4 years ago

#14355 new enhancement

Luci -- Sorting DHCP clients in different fashions

Reported by: x2416x@… Owned by:
Priority: normal Milestone: Barrier Breaker 14.07
Component: luci Version: Trunk
Keywords: Cc:

Description

How about the ability to click headers on DHCP client list to sort the information.

I have a class B across multiple nets and use one DHCP server for all (bah best pratices! bah!)

I like sorting by ip address to see things in different subnets.

I did this in a fashion by adding a function and a sort to the info.leases section of /usr/lib/lua/luci/view/admin_status/index.htm

--

function ipaddr(tmp) {

var a = tmp.split(".");

for (var i = 0; i < a.length; i++) {

while (a[i].length < 3) {

a[i] = "0" + a[i];

}

}

return a[0] + a[1] + a[2] + a[3];

}

--

added this aboeve the line "<% if has_dhcp then %>"

--

info.leases.sort(

function(a, b) {

alert(ipaddr(a.ipaddr) + " " + ipaddr(b.ipaddr));
return (ipaddr(a.ipaddr) < ipaddr(b.ipaddr) ? -1 : (ipaddr(a.ipaddr) > ipaddr(b.ipaddr) ? 1: 0));

}

);

--

added this above the line " for( var i = 0; i < info.leases.length; i++ )"

It sorts the information by ip address, and I'm sure I could spend time programming this feature myself, but I'm sure there's someone more suited for this type of enhancement :-)

J

Attachments (0)

Change History (1)

comment:1 Changed 4 years ago by jow

  • Milestone changed from Attitude Adjustment 12.09 to Barrier Breaker 14.07

Milestone Attitude Adjustment 12.09 deleted

Add Comment

Modify Ticket

Action
as new .
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.