From f9956b2cdb7c170d8cb2163421cbf5f50cd858c7 Mon Sep 17 00:00:00 2001 From: Jonni Liljamo Date: Mon, 28 Oct 2024 21:51:26 +0200 Subject: [PATCH] feat: refresh tsigKey frontend, revamp reused components --- internal/components/managepartials.templ | 83 ++++++++++++++++-------- static/styles.css | 8 +++ 2 files changed, 65 insertions(+), 26 deletions(-) diff --git a/internal/components/managepartials.templ b/internal/components/managepartials.templ index 9137895..911a8eb 100644 --- a/internal/components/managepartials.templ +++ b/internal/components/managepartials.templ @@ -3,10 +3,10 @@ package components import "git.src.quest/~liljamo/felu/internal/db" import "fmt" -script toggleApiKeyVisibility(id string) { - var input = document.getElementById("domain_apikey_" + id); - var eye_vis = document.getElementById("domain_eye_vis_" + id); - var eye_hid = document.getElementById("domain_eye_hid_" + id); +script toggleKeyVisibility(t string) { + var input = document.getElementById("domain_key_" + t); + var eye_vis = document.getElementById("domain_eye_vis_" + t); + var eye_hid = document.getElementById("domain_eye_hid_" + t); if (input.type === "password") { input.type = "text"; } else { @@ -16,6 +16,34 @@ script toggleApiKeyVisibility(id string) { eye_hid.classList.toggle("hidden"); } +templ EyeToggle(t string) { +
+ +
+ + + + + +
+
+} + +templ RefreshButton(t string) { + +} + templ ManagePartialDomains(domains []db.Domain) { if len(domains) > 0 { @@ -60,31 +88,12 @@ templ ManagePartialDomains(domains []db.Domain) { + + + }
-
- -
- - - - -
-
+ @EyeToggle(fmt.Sprintf("%s_%s", "api", domain.ID)) - + @RefreshButton(fmt.Sprintf("%s/%s", domain.ID, "api_key"))
@@ -97,6 +106,28 @@ templ ManagePartialDomains(domains []db.Domain) {
+
+ +
More
+
+
+

TSIG key:

+ +
+ + + @EyeToggle(fmt.Sprintf("%s_%s", "tsig", domain.ID)) + + @RefreshButton(fmt.Sprintf("%s/%s", domain.ID, "tsig_key")) +
+
+
+
diff --git a/static/styles.css b/static/styles.css index 34fea76..5415456 100644 --- a/static/styles.css +++ b/static/styles.css @@ -612,6 +612,10 @@ video { user-select: none; } +.list-inside { + list-style-position: inside; +} + .list-none { list-style-type: none; } @@ -622,6 +626,10 @@ video { appearance: none; } +.flex-row { + flex-direction: row; +} + .flex-row-reverse { flex-direction: row-reverse; } -- 2.44.1