Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sort DNS Records such that multiple records with same name are grouped #442

Closed
humphd opened this issue Mar 25, 2023 · 7 comments · Fixed by #570
Closed

Sort DNS Records such that multiple records with same name are grouped #442

humphd opened this issue Mar 25, 2023 · 7 comments · Fixed by #570
Assignees
Labels
category: data Anything related to data management and structure category: front end Front end part of our web service

Comments

@humphd
Copy link
Contributor

humphd commented Mar 25, 2023

In #438 we are moving to allow DNS Records of type A, AAAA, and TXT (i.e., not CNAME) to have multiple values. Our current UI assumes this is always a single value. We need to make 2 changes:

  1. DNS Records table needs to be able to show one or more values. We could join them with , for example
  2. The New DNS Record and Edit DNS Record form needs to allow for one or more input boxes for the value(s). You should be able to add or remove input boxes to include multiple values. By default we'd show only 1.
@Myrfion
Copy link
Contributor

Myrfion commented Mar 27, 2023

  1. Only one CNAME record per one fqdn, validation has to enforce it
  2. For all other types A, AAA, TXT we allow multiple records each with a different value

@SerpentBytes SerpentBytes added category: data Anything related to data management and structure and removed category: data Anything related to data management and structure labels Apr 3, 2023
@SerpentBytes SerpentBytes added this to the Milestone 0.9 milestone Apr 3, 2023
@cychu42
Copy link
Contributor

cychu42 commented Apr 3, 2023

  1. Only one CNAME record per one fqdn, validation has to enforce it
  2. For all other types A, AAA, TXT we allow multiple records each with a different value

@Myrfion Let me know if I understand this correctly:
For A, AAA, TXT type, I can create two DNS records with same name and type, as long as values are different.
For CNAME type, I should only have one DNS record.

@Myrfion
Copy link
Contributor

Myrfion commented Apr 10, 2023

@cychu42 sorry just seen your message on this one, the issue got resolved in your PR right?

@humphd humphd changed the title Support multiple values for DNS A, AAAA, and TXT Records in UI Sort DNS Records such that multiple records with same name are grouped Apr 10, 2023
@humphd
Copy link
Contributor Author

humphd commented Apr 10, 2023

When a user has more than 1 record with the same name and different type, it would be nice to "group" them together by sorting the results:

Screenshot 2023-04-10 at 11 20 45 AM

@humphd humphd assigned Genne23v and unassigned Myrfion Apr 10, 2023
@humphd
Copy link
Contributor Author

humphd commented Apr 10, 2023

NOTE: @dadolhay suggests adding the value + name together as the sort key. You can talk to him for more info.

@ghost
Copy link

ghost commented Apr 10, 2023

const recordsSorted = records.sort(
  (({subdomain: aSubdomain, type: aType}, {subdomain: bSubdomain, type: btype}) =>
    [...aSubdomain].reverse().join('').localeCompare([...bSubdomain].reverse().join('')) ||
    atype.localeCompare(btype)
  );
  • reverse both subdomains
  • compare them
  • If equal, then compare the record type the same way

This is not tested, you might need to change the compare order (like compare b with a instead of a with b)

@cychu42
Copy link
Contributor

cychu42 commented Apr 10, 2023

@cychu42 sorry just seen your message on this one, the issue got resolved in your PR right?

I only added restriction to not duplicate CNAME records, and restriction on other record type duplication is currently in place.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: data Anything related to data management and structure category: front end Front end part of our web service
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants