The following is a conversation that happened on the same topic shortly before release.
but this is probably nightmare in UI-design.
Maybe in smaller screens, but there is another possibility, similar to your table + text box idea.
We could create a simple table (4 columns = 3 values + action buttons) and an "Advanced" button to show the full table (with 8, 9 or 10 columns).
The "auto disable" feature can be used to disable the simple table as well.
I don't think that a fixed column layout is a good fit for the full set/table, as there can be no fixed number of columns.
set:, tag: and IPv6 addresses can occur multiple times.
and IPv6 addresses can occur multiple times.
All IPv6 will be added in the same field/column. The the fixed number of columns is not the issue.
The issue would be the table width.
How about keeping a copy of those 3 entries per line when populating the UI table, in addition to the entry field values?
Do you mean a table with 4 columns? Mac Address + IP + Hostname + "Advanced (containing the raw line text)"?
All IPv6 will be added in the same field/column. The the fixed number of columns is not the issue.
Allowing comma-separated lists of values in one column still wouldn't seem to be a good fit to me.
Also, showing those additional options as columns may prompt users to fill them in, even when there would be no obvious use (e.g. aforementioned IPv6 addresses will never get assigned as Pi-hole won't operate as DHCPv6 server anyway (hmm, maybe we could cut down on options with that approach)).
I'd rather have the v5 table for backwards compatibilty, and leave the flat file format for expert use only (which it probably should be).Do you mean a table with 4 columns? Mac Address + IP + Hostname + "Advanced (containing the raw line text)"?
No, I thought of it as a purely informational tick box.
But yours looks similar to DL6ER's suggestion, only that his idea is to show the full line under the three fields, if I understand him correctly.But combining fields and full line editing in one UI could make UI updating more challenging than when you keep them separate (fields for basic, flat file editing for expert).
Yes. Similar to DL6ER's idea.
If we are going to use separate input fields for each option, there is no way to avoid comma separated entries (some options will need to accept more than one value).
Sorry, I missed the
I was testing the page and (unintentionally) I entered a line containing spaces and tabs. I noticed FTL didn't remove these characters.
...
Do we need to clean up the entries to avoid
dnsmasqissues?before: Yes, they can cause issues. The IP address is fed through
inet_ptonwhich may trim spaces around addresses, I have not seen any details about this inman inet_ntopbut it may be possible. The extra spaces and tabs in the hostname are probably an issue butdnsmasqvalidates the hostnames you define here for validity, i.e., onlya-z A-Z 0-9 - _are allowed here. It should fail hard withbad DHCP host nameotherwise,
Thanks for the detailed explanation.
It should fail hard with
bad DHCP host nameotherwise,FTL and the web interface didn't generate any error messages when entering the values containing spaces and tabs. If later
dnsmasqgenerates an error, this will cause user confusion.Maybe we need to validate the values sent via web interface / API.
I did just try something useless and get an error as expected:
Note that the DHCP server needs to be enabled to get the error as - otherwise - the
dhcp.hostsarray is not added todnsmasq's configuration and, accordingly, also is not tested.
Note that the DHCP server needs to be enabled to get the error
Hmmm... that was the issue.
I tested simply adding values to the field, but with the DHCP disabled.We probably should not accept static leases if DHCP is disabled to avoid issues.
If an user enter many invalid static leases while the DHCP server is disabled (like I did) and later enable it, there will be issues.
For completeness:
I enabled DHCP and added an static lease (
ÄÖÄ,192.168.1.4,fake).
It failed with an error message (as expected), but I also added a line using the format "MAC,IP,hostname" containing spaces and tabs in the IP and hostname.
FTL accepted them without errors:A4:EE:57:30:0E:0F, 192.168.1.2, printer # ^^ ^ ^ # space_||__tab space_| |__tabNote:
The spaces and tabs are preserved in the API return. Not sure if they will cause some issues withdnsmasq.
If an user enter many invalid static leases while the DHCP server is disabled (like I did) and later enable it, there will be issues.
But how realistic of a scenario is this? It would need quite some extra code as FTL is currently not aware of any kind of dependency between settings. Even without it, the issues should be small. Once you try to enable it, FTL will validate the entire config and detect that at least one dhcp-host is invalid in your example. It would then reject the config change (in this case the try to enable the DHCP server) and print the warning about the offending line (the first invalid
dhcp-hostline). The user can then try and fix it and repeat this as long as all invalid entries are gone. There should be no time without a runningdnsmasqas it should never really be restarted if at least one invalid entry remains.But we could change this to always adding
dhcp-hostto the config even when the server is disabled.dhcp-hostlines without enabled DHCP server should be possible, they will just not do anything useful (but they'd be checked). However, there is an entire block of settings which are only applied whendhcp.active = true, changing this may mean a bit of a mess in the config file and seems not the best option at first sight.but I also added a line using the format "MAC,IP,hostname" containing spaces and tabs in the IP and hostname.
The spaces and tabs are preserved in the API return. Not sure if they will cause some issues with
dnsmasq.They also end up in the used
dnsmasqconfiguration so that's consistent.I did just check that and can confirm
inet_ntopis pretty robust when it comes to detecting and analyzing IP addresses plusdnsmasqfeeds the specified host names throughlibidnwhich strips away the spaces/tabs on the hostname.
TL;DR: Your spaces/tab example works becausednsmasqis graceful. This does not have to apply to everything, though. The source code processingdhcp-hostis rather difficult to read because it has some rather strange backwards-compatibility stuff, but, e.g., spaces even inside MAC addresses are tolerable as well.
Regarding the basic/advanced input field. The first idea that came to my mind is exactly this
howing both the table and the text field below it? One automatically updates the other (I did the same for the DNS server selection where you could add extra or special servers below in the (usually collapsed) text area?
90% of users will be happy with the current 3 column input fields. If users need more advanced configurations, they could use the text input field then.
TL;DR: Your spaces/tab example works because
dnsmasqis graceful.OK.
That was my main concern, because it is allowed by the web interface and FTL, but I wasn't sure ifdnsmasqwould accept or complain.But how realistic of a scenario is this?
The scenario I imagined was a case were an user import or create many static invalid leases while Pi-hole DHCP is disabled. Later (after all invalid addresses are already in Pi-hole options), the user decides to turn the DHCP on, and the user will receive many warnings during
dnsmaq. Users will say "The web interface accepted the values, but now it is saying this is invalid".I'm not sure how realistic is this. Maybe I'm just imagining a very crazy/unlikely scenario, but apparently it is possible.
I think we don't need to change anything for now.
At least we discussed this possibility and now we know where to look if some one starts to complain.
I like this idea.
- table with the original 3 fields;
- textbox;
- "auto disable" (or auto hide) feature, to disable the table when there are advanced options;
- show note about the presence of advanced options


