operasoftware / dns-ui

Opera's LDAP-authenticated PowerDNS user interface
Apache License 2.0
283 stars 57 forks source link

Alpha-Numeric Sort Zones #126

Open vectr0n opened 5 years ago

vectr0n commented 5 years ago

Either by default or an option to have the zones page sorted by alpha-numeric. I am not even sure how it's sorted by default, everything is everywhere.

thomas-pike commented 5 years ago

There was a deliberate choice to the way that it is currently ordered, though it certainly might not be obvious (or indeed useful in all situations). It is ordered alphabetically by top-level domain, and then by domain, subdomain etc. The advantages of sorting in this way are:

For example, if you had example.com, foobar.com, example.org, subdomain1.example.com, subdomain2.example.com, subdomain1.example.org and sub.subdomain1.example.org, they would be sorted as:

               example.com
    subdomain1.example.com
    subdomain2.example.com
                foobar.com
               example.org
    subdomain1.example.org
sub.subdomain1.example.org

But I accept that there are disadvantages to sorting this way too:

So it might make sense to have it possible to change the sort order, either on a per-user or per-installation setup.

vectr0n commented 5 years ago

Thanks for the reply and explanation. It would be nice to have am option in the way it's sorted by default if not to much work. I am not a dev by any means so I have no way of helping or do it myself and submitting a PR.

jsoref commented 5 years ago

@vectr0n: Your issue was a great contribution by itself.

FWIW, even if you don't speak PHP, you can make improvements like the one I just offered (it barely requires speaking HTML).

As for actually offering multiple sort orderings, I can't think of a great way to do it... Normally one uses a widget that looks like: ↕, but that's purely for reversing an alphabetical sort. It looks like the recommended approach would be Sort: [ {by ...} |v].

Most of the time, I don't think I've been terribly bothered by the current sort. -- If I need to group by project.example.{*} vs. documentation.example.{*}, I will generally just filter to project.example or documentation.example and be left with something that covers what I actually need to look at.