From 56eaf57649500abd22d35cb1ccf1e9e4cdd0c5b3 Mon Sep 17 00:00:00 2001 From: swanadiva Date: Thu, 9 Jul 2026 18:21:45 +0700 Subject: [PATCH] fix: modal scroll, SSH key textarea, nav full-page, remove OS/Provider - Fix modal scroll: restructure overlay with scroll/centering wrapper - Add SSH key textarea + file upload to host modal (authType='key') - Fix textarea reset on new host (clear via DOM) - SSH username placeholder instead of default 'root' - Nav uses plain instead of HTMX for full-page navigation - /hosts route returns full page; /hosts/list for HTMX partials - Remove OS and Provider from host modal, grid card, and list card - Fix key modal x-data scope for Alpine $dispatch - Update key_grid to display multi-line key content properly - Simplify SSH key placeholder format --- app/backend/main.go | 3 +- app/backend/views/host_list.html | 19 +++----- app/backend/views/host_modal.html | 77 +++++++++++++++---------------- app/backend/views/index.html | 8 ++-- app/backend/views/key_grid.html | 5 +- app/backend/views/keychain.html | 68 ++++++++++++++++++--------- app/backend/views/nav.html | 3 +- 7 files changed, 100 insertions(+), 83 deletions(-) diff --git a/app/backend/main.go b/app/backend/main.go index d90d6d8..831004a 100644 --- a/app/backend/main.go +++ b/app/backend/main.go @@ -61,7 +61,8 @@ func main() { app.Static("/static", "./static") app.Get("/", handler.Dashboard) - app.Get("/hosts", handler.DashboardList) + app.Get("/hosts", handler.Dashboard) + app.Get("/hosts/list", handler.DashboardList) app.Post("/hosts", handler.CreateHost) app.Put("/hosts/:id", handler.UpdateHost) app.Delete("/hosts/:id", handler.DeleteHost) diff --git a/app/backend/views/host_list.html b/app/backend/views/host_list.html index ba1c041..7de1d89 100644 --- a/app/backend/views/host_list.html +++ b/app/backend/views/host_list.html @@ -20,18 +20,16 @@ {{.Username | default "root"}}@{{if .Hostname}}{{.Hostname}}{{else}}{{.IP}}{{end}}{{if ne .Port 22}}:{{.Port}}{{end}}

-
- {{.OS}} - {{.Provider}} - {{if .Type}}{{.Type}}{{end}} -
+ {{if .Type}}
+ {{.Type}} +
{{end}}
Last seen {{.LastSeen}}
Connect @@ -61,15 +59,11 @@
-
+

{{.Name}}

{{.IP}}
- @@ -82,7 +76,7 @@ Connect @@ -110,5 +104,4 @@
{{end}}
-{{template "host_modal" .}} {{end}} \ No newline at end of file diff --git a/app/backend/views/host_modal.html b/app/backend/views/host_modal.html index e0ad7eb..6651ff4 100644 --- a/app/backend/views/host_modal.html +++ b/app/backend/views/host_modal.html @@ -4,8 +4,9 @@ @edit-host.window="populate($event.detail); open = true" @keydown.escape.window="open = false">
-
-
+
+
+

@@ -53,37 +54,6 @@ class="w-full bg-surface-container-low border border-outline-variant/40 rounded-lg py-2.5 px-4 focus:ring-2 focus:ring-primary/20 focus:border-primary focus:outline-none transition-all font-medium text-on-surface">
-
-
- - -
-
- - -
-
-
@@ -119,6 +89,20 @@
+
+ + +
+ + + .pem .key .ppk +
+
+
+
@@ -150,18 +135,18 @@ function hostForm() { editing: false, hostId: '', form: { - name: '', ip: '', hostname: '', port: '22', username: 'root', - os: 'Ubuntu 22.04', provider: 'AWS US-East', type: 'api', - authType: 'key', password: '', notes: '' + name: '', ip: '', hostname: '', port: '22', username: '', + type: 'api', authType: 'key', password: '', notes: '' }, reset() { this.editing = false; this.hostId = ''; this.form = { - name: '', ip: '', hostname: '', port: '22', username: 'root', - os: 'Ubuntu 22.04', provider: 'AWS US-East', type: 'api', - authType: 'key', password: '', notes: '' + name: '', ip: '', hostname: '', port: '22', username: '', + type: 'api', authType: 'key', password: '', notes: '' }; + var ta = document.querySelector('#host-modal textarea[name=password]'); + if (ta) ta.value = ''; }, populate(host) { this.editing = true; @@ -172,13 +157,23 @@ function hostForm() { hostname: host.Hostname || '', port: String(host.Port || 22), username: host.Username || 'root', - os: host.OS || 'Ubuntu 22.04', - provider: host.Provider || 'AWS US-East', type: host.Type || 'api', authType: host.AuthType || 'key', password: host.Password || '', notes: host.Notes || '' }; + var ta = document.querySelector('#host-modal textarea[name=password]'); + if (ta) ta.value = host.Password || ''; + }, + readKeyFile($event) { + var file = $event.target.files[0]; + if (!file) return; + var reader = new FileReader(); + var ta = document.querySelector('#host-modal textarea[name=password]'); + reader.onload = function(e) { + if (ta) ta.value = e.target.result; + }; + reader.readAsText(file); } }; } diff --git a/app/backend/views/index.html b/app/backend/views/index.html index f87385c..67f9505 100644 --- a/app/backend/views/index.html +++ b/app/backend/views/index.html @@ -68,22 +68,22 @@ + hx-get="/hosts/list?filter=all" hx-target="#host-list">All + hx-get="/hosts/list?filter=active" hx-target="#host-list">Active + hx-get="/hosts/list?filter=offline" hx-target="#host-list">Offline
diff --git a/app/backend/views/key_grid.html b/app/backend/views/key_grid.html index 1e89edf..97e65a8 100644 --- a/app/backend/views/key_grid.html +++ b/app/backend/views/key_grid.html @@ -39,7 +39,7 @@
Credential Secrets
- + ••••••••••••••••
+
+ {{.Passphrase}} +
{{if .Fingerprint}}
diff --git a/app/backend/views/keychain.html b/app/backend/views/keychain.html index 4917804..5af5f77 100644 --- a/app/backend/views/keychain.html +++ b/app/backend/views/keychain.html @@ -20,7 +20,7 @@

{{.Title}}

-
+
@@ -61,27 +61,42 @@
-
-
-
+
+ +

Register Secure Credential

- +
+
-
- + @submit="open = false" class="p-6 space-y-4 text-sm"> +
+ + class="w-full bg-surface-container-low border border-outline-variant/40 rounded-lg py-2.5 px-4 focus:ring-2 focus:ring-primary/20 focus:border-primary focus:outline-none transition-all font-medium text-on-surface">
+
-
- +
+
-
- +
+ + class="w-full bg-surface-container-low border border-outline-variant/40 rounded-lg py-2.5 px-3 focus:outline-none focus:border-primary text-on-surface">
-
- - + +
+ + +
+ + + .pem .key .ppk .pub .txt +
+
+ class="px-4 py-2 text-xs font-bold text-outline hover:text-on-surface transition-colors">Cancel + class="bg-primary text-white py-2 px-5 rounded-lg font-bold text-xs shadow-md hover:bg-primary-container hover:text-on-primary-container transition-all">Save Credential
diff --git a/app/backend/views/nav.html b/app/backend/views/nav.html index d7f4ea3..967e375 100644 --- a/app/backend/views/nav.html +++ b/app/backend/views/nav.html @@ -1,6 +1,6 @@ {{define "nav"}}