Skip to content

Commit

Permalink
Lease list refresh option and link
Browse files Browse the repository at this point in the history
  • Loading branch information
jcameron committed Apr 6, 2011
1 parent 9b36747 commit 5b447ff
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 2 deletions.
2 changes: 2 additions & 0 deletions dhcpd/CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,5 @@ Also added support for multi-value options within a bracketed expression.
Hostname, IP address and MAC address clashes are now only checked for in the same shared network.
---- Changes since 1.530 ----
Multiple leases can now be deleted at once, thanks to a suggestion from Berni Elbourn.
---- Changes since 1.540 ----
Added a Module Config option to automatically refresh the lease list every few seconds, and a link to force a manual refresh.
1 change: 1 addition & 0 deletions dhcpd/config.info
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ lease_sort=Sort leases by,1,0-Order in file,1-IP address,2-Hostname
hostnet_list=Display subnets and hosts as,1,0-Icons,1-List
dhcpd_nocols=Icons in row,0,5
lease_tz=Display leases times in,1,0-GMT,1-Local time
lease_refresh=Seconds between refreshing lease list,3,Never
show_ip=Show IP addresses for hosts?,1,1-Yes,0-No
show_mac=Show MAC addresses for hosts?,1,1-Yes,0-No
group_name=Show group names as,1,1-<tt>domain&#45;name</tt> option,0-Name or member count,2-Description
Expand Down
1 change: 1 addition & 0 deletions dhcpd/lang/en
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ listl_used=Allocated
listl_pc=Percentage
listl_err=Failed to deleted leases
listl_enone=None selected
listl_refresh=Refresh list

restart_errmsg1=Failed to restart dhcpd
restart_errmsg2=Failed to signal process
Expand Down
12 changes: 10 additions & 2 deletions dhcpd/list_leases.cgi
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#!/usr/local/bin/perl
# list_leases.cgi
# List all active leases
# XXX compute number of available IPs from ranges, and subtract those allocated

require './dhcpd-lib.pl';
require 'timelocal.pl';
Expand All @@ -16,6 +15,8 @@ if ($in{'network'}) {
$desc = &text('listl_network', "<tt>$in{'network'}</tt>",
"<tt>$in{'netmask'}</tt>");
}
print "Refresh: $config{'lease_refresh'}\r\n"
if ($config{'lease_refresh'});
&ui_print_header($desc, $text{'listl_header'}, "");

# Work out how many IPs we have in our subnet ranges
Expand Down Expand Up @@ -169,7 +170,13 @@ else {
print &ui_hidden("network", $in{'network'});
print &ui_hidden("netmask", $in{'netmask'});
@links = ( &select_all_link("d"), &select_invert_link("d") );
print &ui_links_row(\@links);
$links = "<table width=100%><tr><td>".
&ui_links_row(\@links).
"</td><td align=right>".
&ui_links_row([ "<a href='list_leases.cgi?$in'>".
"$text{'listl_refresh'}</a>" ]).
"</td></tr></table>\n";
print $links;
print &ui_columns_start([
"",
&sort_link("ipaddr"),
Expand Down Expand Up @@ -211,6 +218,7 @@ else {
$lease->{'index'});
}
print &ui_columns_end();
print $links;
print &ui_form_end([ [ undef, $text{'listl_delete'} ] ]);
}
else {
Expand Down

0 comments on commit 5b447ff

Please sign in to comment.