Add Edit buttons to DHCP Leases page



  • On the Status > DHCP Leases page, I can currently see my dynamic and static mappings, but I cannot edit them.  On the Services > DHCP Server page, there is an Edit button next to each Static Mapping.  I'd like for the DHCP Leases page to also have that button.

    Is there a reason that you leave a red "+" button next to the static mappings on the DHCP Leases page?  On the "firewall_rules.php?if=lan" page, disabled buttons are grayed out.  Not red.  Also, the tooltip doesn't work on the red buttons.



  • That is something I have also thought would be useful. I changed the non-functional red button to an Edit button and made it open the services_dhcp_edit page for the static entry concerned. It looks like the screen shot attached.
    Pull request is https://github.com/pfsense/pfsense/pull/1310
    This seems easy enough and minimal risk.
    I thought about putting the delete button there also - but that needs a bit of thinking about and opinions from others, since delete is a more dangerous thing, and the existing delete button on status_dhcp_leases is just for dynamic leases and just deletes a real-time entry - it does not make config changes.

    I guess this is similar in the IPv6 code, so if it is accepted I am also happy to make a matching change to status_dhcpv6_leases also.

    IMHO the management of static mappings from Services->DHCP needs to stay. Thousands of users will expect it find it in/through the Services menu.



  • Just my two cents,

    If we think about user management. Will putting and edit button on a page that is only meant for read only be an issue? I'm thinking of junior level engineers, I suspect not since it will only direct to the edit page and if you don't have access to that page then you will not be able to cause any harm. Just wanted to see what y'all think.



  • I just tested that - added a user "junior" with Dashboard and Status DHCP Leases privs. They get the edit button for the lease, but when it is pressed they just get taken to their default page (in this case the Dashboard) because the code tried to go to the services_dhcp_edit page, but the user has no priv for that, so the code redirects to their default page.
    It works the same as it has been working when using the "+" to add a static mapping for one of the dynamic entries - I tried that also.
    So I think that is the way it is generally being designed to work for the few places on status pages that let you click to perform a change action. There could be a lot of extra coding effort put in to determine, when drawing up the status page, whether the user has enough priv to do the relevant change action, and only display the button if they have enough priv. If someone cared enough they might do it  :-\



  • I think as long as the redirecting to dashboard that works for me. Maybe in version 2.2.1 someone with the skill or will add the extra code. Thanks for checking.


Log in to reply