Skip to content

Conversation

@DroidFreak32
Copy link

Thank you for your contribution to the Pi-hole Community!

Please read the comments below to help us consider your Pull Request.

We are all volunteers and completing the process outlined will help us review your commits quicker.

Please make sure you

  1. Base your code and PRs against the repositories developmental branch.
  2. Sign Off all commits as we enforce the DCO for all contributions
  3. Sign all your commits as they must have verified signatures
  4. File a pull request for any change that requires changes to our documentation at our documentation repo

What does this PR aim to accomplish?:

This will allow users to easily add a current lease into the static leases configuration, closer to v5 behavior.

How does this PR accomplish the above?:

  • Add a new copy icon button in the DHCPLeasesTable rows
  • Create a new copyLease function that is triggerred when above button is clicked
  • The MAC, IP and Hostname values are fetched from the row and copied to clipboard in dnsmasq-like syntax
  • Users can easily paste in the static configuration textbox

This might help solve complaints like https://www.reddit.com/r/pihole/comments/1lac7fk

Example screenshot: ss

Disclosure: I am not experienced with JS so I took help from gemini, but I have verified it is working in my end.

Link documentation PRs if any are needed to support this PR:

N/A


By submitting this pull request, I confirm the following:

  1. I have read and understood the contributors guide, as well as this entire template. I understand which branch to base my commits and Pull Requests against.
  2. I have commented my proposed changes within the code and I have tested my changes.
  3. I am willing to help maintain this change if there are issues with it later.
  4. It is compatible with the EUPL 1.2 license
  5. I have squashed any insignificant commits. (git rebase)
  6. I have checked that another pull request for this purpose does not exist.
  7. I have considered, and confirmed that this submission will be valuable to others.
  8. I accept that this submission may not be used, and the pull request closed at the will of the maintainer.
  9. I give this submission freely, and claim no ownership to its content.

  • I have read the above and my PR is ready for review. Check this box to confirm

@DroidFreak32 DroidFreak32 requested a review from a team as a code owner July 1, 2025 21:28
@DroidFreak32 DroidFreak32 force-pushed the development-v6 branch 2 times, most recently from 13d96f9 to 8159a57 Compare July 1, 2025 21:33
…masq format

This will allow users to easily add a current lease into the static leases configuration, closer to v5 behavior.

Signed-off-by: DroidFreak32 <[email protected]>
@PromoFaux
Copy link
Member

I like this idea in theory - though I currently have no way to test it due to not using my Pi-hole as a DHCP server.

Just thinking out loud here... @pi-hole/ftl-maintainers @pi-hole/web-maintainers

If the idea of this PR work, i.e the string that is generated is good enough to paste into the dhcp reservations textbox... Could the idea be further adapted to do this more directly? Maybe a "Make static" (maybe even "make unstatic") button instead of a copy that literally just adds the string directly to the setting?

It might save the ballache of coming up with a table design that works for the reservation field.

Just spitballing

@yubiuser
Copy link
Member

If the idea of this PR work, i.e the string that is generated is good enough to paste into the dhcp reservations textbox... Could the idea be further adapted to do this more directly? Maybe a "Make static" (maybe even "make unstatic") button instead of a copy that literally just adds the string directly to the setting?

For table-to-textbox we already have such an implementation: Settings > DNS, tick/untick one of the items in the DNS server table and see the text added/removed from the collapsed "Custom DNS servers" textbox

@DroidFreak32
Copy link
Author

DroidFreak32 commented Jul 12, 2025

Could the idea be further adapted to do this more directly? Maybe a "Make static" (maybe even "make unstatic") button instead of a copy

That would require to parse the existing list of Static DHCP configurations, find if a similar entry already exists, and only if it doesn't exist add it to the list, correct?

But it might break existing power users setup who used a more advanced dnsmasq entry rather than just hwaddr:ipaddr:hostname which this PR creates.

The intention of adding the copy option is because the current 6.x release already moved to a more flexible advanced method for power users to add dnsmasq entries, which might break if pihole directly adds entries (like the behavior in 5.x). Copying will just make it much easier to add entries while allowing power users to modify the syntax to their needs.

@PromoFaux
Copy link
Member

But it might break existing power users setup who used a more advanced dnsmasq entry rather than just hwaddr:ipaddr:hostname which this PR creates.

So my thought here is that if a valid line always starts with hwaddr - could we not "pair" table entires to the static list based only on that? Once it was added to the static list - the user could then add advanced things to it if they really wanted - the key information would still be shown in the current lease table in the same way it currently would be.

Maybe, I don't know... I haven't used DHCP on Pi-hole/dnsmasq in such a long time that I'm probably very out of touch with how things work

@DL6ER
Copy link
Member

DL6ER commented Jul 15, 2025

Please see my alternative suggestion here: #3565

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants