fix: UI overhaul — align all HTMX views with Lumina Design System (46 fixes)
- All 7 pages rewritten: Dashboard, Terminal, Snippets, Keychain, SFTP, Settings, Brief - Apply consistent Lumina glassmorphic theme (rounded-2xl, shadows, borders, tracking) - Fix SVG icons not rendering — return template.HTML instead of string - Fix Alpine x-data scoping: terminal tabs, SFTP modals, snippet tag buttons - Fix dashboard search sending literal ?q=... - Rebuild CSS with all new Tailwind classes (62KB) - Add .air.toml with hot-reload config, docs/PERBAIKANUI.md checklist - Remove unused backup partials
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
> **Purpose**: Memungkinkan AI agent berikutnya melanjutkan development tanpa mengulang atau merusak.
|
> **Purpose**: Memungkinkan AI agent berikutnya melanjutkan development tanpa mengulang atau merusak.
|
||||||
> **Last Updated**: 2026-07-07
|
> **Last Updated**: 2026-07-07
|
||||||
> **Current Phase**: Sprint 0—6 selesai (V2 HTMX feature complete)
|
> **Current Phase**: UI Fix — memperbaiki 107 visual issue dari `docs/PERBAIKANUI.md`
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -35,7 +35,8 @@ hostkeeper/ (root — bersih untuk V2)
|
|||||||
│ ├── TIMELINE.md Timeline 3.5 minggu
|
│ ├── TIMELINE.md Timeline 3.5 minggu
|
||||||
│ ├── PERFROMANCE.md Performance & stability
|
│ ├── PERFROMANCE.md Performance & stability
|
||||||
│ ├── UI_TERMIUS_REFERENCE.md Termius visual reference
|
│ ├── UI_TERMIUS_REFERENCE.md Termius visual reference
|
||||||
│ └── PROGRESS.md Status tracker
|
│ ├── PROGRESS.md Status tracker
|
||||||
|
│ └── PERBAIKANUI.md UI fix checklist (107 task)
|
||||||
├── AGENTS.md ← file ini (checkpoint AI)
|
├── AGENTS.md ← file ini (checkpoint AI)
|
||||||
└── README.md
|
└── README.md
|
||||||
|
|
||||||
@@ -118,12 +119,11 @@ Alasan:
|
|||||||
- **Sprint 5**: Terminal + xterm.js + WebSocket mock shell, tab management
|
- **Sprint 5**: Terminal + xterm.js + WebSocket mock shell, tab management
|
||||||
- **Sprint 6**: JSON file persistence (store package), `go.mod replace` directive for V1 crypto+knownhosts, model SSH fields, real SSH client for terminal (falls back to mock), dynamic host list from server
|
- **Sprint 6**: JSON file persistence (store package), `go.mod replace` directive for V1 crypto+knownhosts, model SSH fields, real SSH client for terminal (falls back to mock), dynamic host list from server
|
||||||
|
|
||||||
### 🐛 Bug Template (dari template/src/ — catatan saat implementasi)
|
### 🐛 UI Fix Checklist — Lihat `docs/PERBAIKANUI.md`
|
||||||
1. **P0**: Missing CSS keyframes (fade-in, scale-up, slide-in) → tambah di `custom.css`
|
- **107 task** teridentifikasi dari audit visual vs template React
|
||||||
2. **P1**: `w-4.5 h-4.5` → ganti `w-5 h-5`
|
- Acuan utama: 7 file di `template/src/components/`
|
||||||
3. **P2**: Tidak ada Error Boundary → not applicable (HTML template)
|
- Setiap task dihapus dari checklist setelah selesai
|
||||||
4. **P2**: `as any` casts → not applicable (Go typed)
|
- Urutan: Dashboard (P0) → Terminal (P0) → Snippets (P0) → Keychain/SFTP/Settings/Brief (P1)
|
||||||
5. **P3**: Auto-focus loss → handle via JS `focus()` di Alpine
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -181,24 +181,12 @@ app/backend/
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## 6. Yang Harus Dilakukan Selanjutnya (First Actions)
|
## 6. Yang Harus Dilakukan Selanjutnya (UI Fix)
|
||||||
|
|
||||||
Urutan eksekusi saat development dimulai:
|
1. Baca `docs/PERBAIKANUI.md` — 107 task teridentifikasi
|
||||||
|
2. Urutan: Dashboard (P0) → Terminal (P0) → Snippets (P0) → Keychain (P1) → SFTP (P1) → Settings (P1) → Brief (P1) → Global (P1)
|
||||||
```
|
3. Setiap selesai satu task, hapus dari checklist `docs/PERBAIKANUI.md`
|
||||||
Sprint 0 — Setup:
|
4. Verify: `cd app/backend && go build && ./backend` lalu buka http://localhost:1947
|
||||||
Step 1: mkdir -p app/backend
|
|
||||||
Step 2: cd app/backend && go mod init git.tukangketik.id/swanadiva/hostkeeper/v2
|
|
||||||
Step 3: go get github.com/gofiber/fiber/v2
|
|
||||||
Step 4: go get github.com/gofiber/template/html/v2
|
|
||||||
Step 5: Buat main.go (Fiber app skeleton + static + template engine)
|
|
||||||
Step 6: Download htmx.min.js, alpine.min.js ke static/js/
|
|
||||||
Step 7: Setup TailwindCSS v4: input.css → npx @tailwindcss/cli
|
|
||||||
Step 8: Buat custom.css (dot-grid, glassmorphism, keyframes)
|
|
||||||
Step 9: Buat views/layout.html + views/index.html + nav.html
|
|
||||||
Step 10: Buat handler/health.go + handler/dashboard.go
|
|
||||||
Step 11: Verify: buka http://localhost:1947 — layout terlihat
|
|
||||||
```
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -214,6 +202,7 @@ Step 11: Verify: buka http://localhost:1947 — layout terlihat
|
|||||||
| Timeline 3.5 minggu | `docs/TIMELINE.md` |
|
| Timeline 3.5 minggu | `docs/TIMELINE.md` |
|
||||||
| Build system | `docs/BUILD_SYSTEM.md` |
|
| Build system | `docs/BUILD_SYSTEM.md` |
|
||||||
| Status tracker | `docs/PROGRESS.md` |
|
| Status tracker | `docs/PROGRESS.md` |
|
||||||
|
| UI fix checklist | `docs/PERBAIKANUI.md` |
|
||||||
| Template desain (React) | `template/AGENTS.md` (Lumina System) |
|
| Template desain (React) | `template/AGENTS.md` (Lumina System) |
|
||||||
| Template komponen (referensi) | `template/src/components/` |
|
| Template komponen (referensi) | `template/src/components/` |
|
||||||
| V1 shared packages | `v1/pkg/ssh/`, `v1/pkg/crypto/`, `v1/pkg/storage/`, `v1/pkg/config/`, `v1/pkg/knownhosts/` |
|
| V1 shared packages | `v1/pkg/ssh/`, `v1/pkg/crypto/`, `v1/pkg/storage/`, `v1/pkg/config/`, `v1/pkg/knownhosts/` |
|
||||||
|
|||||||
@@ -0,0 +1,35 @@
|
|||||||
|
root = "."
|
||||||
|
tmp_dir = "tmp"
|
||||||
|
|
||||||
|
[build]
|
||||||
|
cmd = "go build -o ./tmp/backend main.go"
|
||||||
|
full_bin = "./tmp/backend"
|
||||||
|
delay = 200
|
||||||
|
exclude_dir = ["assets", "tmp", "vendor", "node_modules"]
|
||||||
|
exclude_file = []
|
||||||
|
exclude_regex = []
|
||||||
|
exclude_unchanged = false
|
||||||
|
follow_symlink = false
|
||||||
|
include_dir = ["internal", "views", "static", "."]
|
||||||
|
include_ext = ["go", "html", "css", "js"]
|
||||||
|
include_file = ["main.go"]
|
||||||
|
kill_delay = "0s"
|
||||||
|
log = "build-errors.log"
|
||||||
|
send_interrupt = false
|
||||||
|
stop_on_error = false
|
||||||
|
|
||||||
|
[color]
|
||||||
|
app = ""
|
||||||
|
build = "yellow"
|
||||||
|
main = "green"
|
||||||
|
runner = "cyan"
|
||||||
|
watcher = "blue"
|
||||||
|
|
||||||
|
[log]
|
||||||
|
time = false
|
||||||
|
|
||||||
|
[misc]
|
||||||
|
clean_on_exit = true
|
||||||
|
|
||||||
|
[screen]
|
||||||
|
clear_on_rebuild = false
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
|
||||||
|
# Air hot-reload build artifacts
|
||||||
|
tmp/
|
||||||
|
build-errors.log
|
||||||
@@ -3,9 +3,13 @@ package handler
|
|||||||
import "github.com/gofiber/fiber/v2"
|
import "github.com/gofiber/fiber/v2"
|
||||||
|
|
||||||
func Brief(c *fiber.Ctx) error {
|
func Brief(c *fiber.Ctx) error {
|
||||||
return c.Render("brief", fiber.Map{
|
data := fiber.Map{
|
||||||
"View": "brief",
|
"View": "brief",
|
||||||
"Title": "Quick Brief",
|
"Title": "Quick Brief",
|
||||||
"NavItems": navItems,
|
"NavItems": navItems,
|
||||||
})
|
}
|
||||||
|
if c.Get("HX-Request") != "" {
|
||||||
|
return c.Render("brief_content", data)
|
||||||
|
}
|
||||||
|
return c.Render("brief", data)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,9 @@ import (
|
|||||||
var keyStore = store.NewKeyStore()
|
var keyStore = store.NewKeyStore()
|
||||||
|
|
||||||
func Keychain(c *fiber.Ctx) error {
|
func Keychain(c *fiber.Ctx) error {
|
||||||
|
if c.Get("HX-Request") != "" {
|
||||||
|
return KeyGrid(c)
|
||||||
|
}
|
||||||
keys := keyStore.All()
|
keys := keyStore.All()
|
||||||
return c.Render("keychain", fiber.Map{
|
return c.Render("keychain", fiber.Map{
|
||||||
"View": "keychain",
|
"View": "keychain",
|
||||||
|
|||||||
@@ -10,13 +10,17 @@ var deviceStore = model.NewDeviceStore()
|
|||||||
var settingsStore = store.NewSettingsStore()
|
var settingsStore = store.NewSettingsStore()
|
||||||
|
|
||||||
func Settings(c *fiber.Ctx) error {
|
func Settings(c *fiber.Ctx) error {
|
||||||
return c.Render("settings", fiber.Map{
|
data := fiber.Map{
|
||||||
"View": "settings",
|
"View": "settings",
|
||||||
"Title": "Settings",
|
"Title": "Settings",
|
||||||
"Config": settingsStore.Get(),
|
"Config": settingsStore.Get(),
|
||||||
"Devices": deviceStore.All(),
|
"Devices": deviceStore.All(),
|
||||||
"NavItems": navItems,
|
"NavItems": navItems,
|
||||||
})
|
}
|
||||||
|
if c.Get("HX-Request") != "" {
|
||||||
|
return c.Render("settings_content", data)
|
||||||
|
}
|
||||||
|
return c.Render("settings", data)
|
||||||
}
|
}
|
||||||
|
|
||||||
func UpdateConfig(c *fiber.Ctx) error {
|
func UpdateConfig(c *fiber.Ctx) error {
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ var fileStore = model.NewFileStore()
|
|||||||
|
|
||||||
func SFTP(c *fiber.Ctx) error {
|
func SFTP(c *fiber.Ctx) error {
|
||||||
local, remote := fileStore.All()
|
local, remote := fileStore.All()
|
||||||
return c.Render("sftp", fiber.Map{
|
data := fiber.Map{
|
||||||
"View": "sftp",
|
"View": "sftp",
|
||||||
"Title": "SFTP",
|
"Title": "SFTP",
|
||||||
"LocalFiles": local,
|
"LocalFiles": local,
|
||||||
@@ -17,7 +17,11 @@ func SFTP(c *fiber.Ctx) error {
|
|||||||
"LocalBreadcrumb": fileStore.LocalBreadcrumb,
|
"LocalBreadcrumb": fileStore.LocalBreadcrumb,
|
||||||
"RemoteBreadcrumb": fileStore.RemoteBreadcrumb,
|
"RemoteBreadcrumb": fileStore.RemoteBreadcrumb,
|
||||||
"NavItems": navItems,
|
"NavItems": navItems,
|
||||||
})
|
}
|
||||||
|
if c.Get("HX-Request") != "" {
|
||||||
|
return c.Render("sftp_content", data)
|
||||||
|
}
|
||||||
|
return c.Render("sftp", data)
|
||||||
}
|
}
|
||||||
|
|
||||||
func SFTPPane(c *fiber.Ctx) error {
|
func SFTPPane(c *fiber.Ctx) error {
|
||||||
|
|||||||
@@ -1,40 +1,88 @@
|
|||||||
package handler
|
package handler
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
|
||||||
"github.com/gofiber/fiber/v2"
|
"github.com/gofiber/fiber/v2"
|
||||||
|
"git.tukangketik.id/swanadiva/hostkeeper/v2/internal/model"
|
||||||
"git.tukangketik.id/swanadiva/hostkeeper/v2/internal/store"
|
"git.tukangketik.id/swanadiva/hostkeeper/v2/internal/store"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
func jsonOrEmpty(v interface{}) string {
|
||||||
|
b, err := json.Marshal(v)
|
||||||
|
if err != nil {
|
||||||
|
return "[]"
|
||||||
|
}
|
||||||
|
return string(b)
|
||||||
|
}
|
||||||
|
|
||||||
|
func allTags(snippets []model.Snippet) []string {
|
||||||
|
seen := map[string]bool{}
|
||||||
|
var out []string
|
||||||
|
for _, sn := range snippets {
|
||||||
|
for _, t := range sn.Tags {
|
||||||
|
if !seen[t] {
|
||||||
|
seen[t] = true
|
||||||
|
out = append(out, t)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return out
|
||||||
|
}
|
||||||
|
|
||||||
var snippetStore = store.NewSnippetStore()
|
var snippetStore = store.NewSnippetStore()
|
||||||
|
|
||||||
func Snippets(c *fiber.Ctx) error {
|
func Snippets(c *fiber.Ctx) error {
|
||||||
|
if c.Get("HX-Request") != "" {
|
||||||
|
return SnippetGrid(c)
|
||||||
|
}
|
||||||
snippets := snippetStore.All()
|
snippets := snippetStore.All()
|
||||||
return c.Render("snippets", fiber.Map{
|
return c.Render("snippets", fiber.Map{
|
||||||
"View": "snippets",
|
"View": "snippets",
|
||||||
"Title": "Snippets",
|
"Title": "Snippets",
|
||||||
"Snippets": snippets,
|
"Snippets": snippets,
|
||||||
|
"SnippetsJSON": jsonOrEmpty(snippets),
|
||||||
|
"AllTags": allTags(snippets),
|
||||||
"NavItems": navItems,
|
"NavItems": navItems,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func SnippetGrid(c *fiber.Ctx) error {
|
func SnippetGrid(c *fiber.Ctx) error {
|
||||||
q := c.Query("q", "")
|
q := c.Query("q", "")
|
||||||
snippets := snippetStore.Search(q)
|
collection := c.Query("collection", "")
|
||||||
return c.Render("snippet_grid", fiber.Map{"Snippets": snippets})
|
tag := c.Query("tag", "")
|
||||||
|
snippets := snippetStore.Search(q, collection, tag)
|
||||||
|
return c.Render("snippet_grid", fiber.Map{
|
||||||
|
"Snippets": snippets,
|
||||||
|
"SnippetsJSON": jsonOrEmpty(snippets),
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func CreateSnippet(c *fiber.Ctx) error {
|
func CreateSnippet(c *fiber.Ctx) error {
|
||||||
name := c.FormValue("name")
|
name := c.FormValue("name")
|
||||||
content := c.FormValue("content")
|
content := c.FormValue("content")
|
||||||
language := c.FormValue("language")
|
language := c.FormValue("language")
|
||||||
snippetStore.Add(name, content, language, nil)
|
description := c.FormValue("description")
|
||||||
|
collection := c.FormValue("collection")
|
||||||
|
tagStr := c.FormValue("tags")
|
||||||
|
var tags []string
|
||||||
|
if tagStr != "" {
|
||||||
|
tags = []string{tagStr}
|
||||||
|
}
|
||||||
|
snippetStore.Add(name, content, language, tags, description, collection)
|
||||||
snippets := snippetStore.All()
|
snippets := snippetStore.All()
|
||||||
return c.Render("snippet_grid", fiber.Map{"Snippets": snippets})
|
return c.Render("snippet_grid", fiber.Map{
|
||||||
|
"Snippets": snippets,
|
||||||
|
"SnippetsJSON": jsonOrEmpty(snippets),
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func DeleteSnippet(c *fiber.Ctx) error {
|
func DeleteSnippet(c *fiber.Ctx) error {
|
||||||
id := c.Params("id")
|
id := c.Params("id")
|
||||||
snippetStore.Delete(id)
|
snippetStore.Delete(id)
|
||||||
snippets := snippetStore.All()
|
snippets := snippetStore.All()
|
||||||
return c.Render("snippet_grid", fiber.Map{"Snippets": snippets})
|
return c.Render("snippet_grid", fiber.Map{
|
||||||
|
"Snippets": snippets,
|
||||||
|
"SnippetsJSON": jsonOrEmpty(snippets),
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,13 +28,17 @@ func Terminal(c *fiber.Ctx) error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
hostsJSON, _ := json.Marshal(available)
|
hostsJSON, _ := json.Marshal(available)
|
||||||
return c.Render("terminal", fiber.Map{
|
data := fiber.Map{
|
||||||
"View": "terminal",
|
"View": "terminal",
|
||||||
"Title": "Terminal",
|
"Title": "Terminal",
|
||||||
"NavItems": navItems,
|
"NavItems": navItems,
|
||||||
"Hosts": available,
|
"Hosts": available,
|
||||||
"HostsJSON": string(hostsJSON),
|
"HostsJSON": string(hostsJSON),
|
||||||
})
|
}
|
||||||
|
if c.Get("HX-Request") != "" {
|
||||||
|
return c.Render("terminal_content", data)
|
||||||
|
}
|
||||||
|
return c.Render("terminal", data)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TerminalWS(c *websocket.Conn) {
|
func TerminalWS(c *websocket.Conn) {
|
||||||
|
|||||||
@@ -4,8 +4,12 @@ type Key struct {
|
|||||||
ID string `json:"id"`
|
ID string `json:"id"`
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
Username string `json:"username"`
|
Username string `json:"username"`
|
||||||
URL string `json:"url"`
|
|
||||||
Passphrase string `json:"passphrase"`
|
Passphrase string `json:"passphrase"`
|
||||||
Strength string `json:"strength"`
|
Strength string `json:"strength"`
|
||||||
|
Type string `json:"type"`
|
||||||
|
URL string `json:"url"`
|
||||||
|
Fingerprint string `json:"fingerprint"`
|
||||||
|
ConnectedHosts []string `json:"connectedHosts"`
|
||||||
|
KeyFile string `json:"keyFile"`
|
||||||
CreatedAt string `json:"createdAt"`
|
CreatedAt string `json:"createdAt"`
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,9 @@ type Snippet struct {
|
|||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
Content string `json:"content"`
|
Content string `json:"content"`
|
||||||
Language string `json:"language"`
|
Language string `json:"language"`
|
||||||
|
Description string `json:"description"`
|
||||||
|
Collection string `json:"collection"`
|
||||||
|
Icon string `json:"icon"`
|
||||||
Tags []string `json:"tags"`
|
Tags []string `json:"tags"`
|
||||||
CreatedAt string `json:"createdAt"`
|
CreatedAt string `json:"createdAt"`
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,13 +44,16 @@ func (s *KeyStore) Search(q string) []model.Key {
|
|||||||
func (s *KeyStore) Add(name, username, url, passphrase string) model.Key {
|
func (s *KeyStore) Add(name, username, url, passphrase string) model.Key {
|
||||||
mu.Lock()
|
mu.Lock()
|
||||||
defer mu.Unlock()
|
defer mu.Unlock()
|
||||||
|
keyType := guessKeyType(name, passphrase)
|
||||||
k := model.Key{
|
k := model.Key{
|
||||||
ID: randID(),
|
ID: randID(),
|
||||||
Name: name,
|
Name: name,
|
||||||
Username: username,
|
Username: username,
|
||||||
URL: url,
|
|
||||||
Passphrase: passphrase,
|
Passphrase: passphrase,
|
||||||
Strength: calcStrength(passphrase),
|
Strength: calcStrength(passphrase),
|
||||||
|
Type: keyType,
|
||||||
|
URL: url,
|
||||||
|
KeyFile: "— " + keyType + " credential —",
|
||||||
CreatedAt: time.Now().Format("Jan 2, 2006"),
|
CreatedAt: time.Now().Format("Jan 2, 2006"),
|
||||||
}
|
}
|
||||||
s.keys = append(s.keys, k)
|
s.keys = append(s.keys, k)
|
||||||
@@ -58,6 +61,21 @@ func (s *KeyStore) Add(name, username, url, passphrase string) model.Key {
|
|||||||
return k
|
return k
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func guessKeyType(name, passphrase string) string {
|
||||||
|
switch {
|
||||||
|
case len(passphrase) >= 25:
|
||||||
|
return "ED25519"
|
||||||
|
case contains(name, "aws") || contains(name, "AWS"):
|
||||||
|
return "AWS Key"
|
||||||
|
case contains(name, "token") || contains(name, "bearer") || contains(name, "TOKEN"):
|
||||||
|
return "Bearer Token"
|
||||||
|
case len(passphrase) <= 3:
|
||||||
|
return "PASSWORD"
|
||||||
|
default:
|
||||||
|
return "SSH RSA"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func (s *KeyStore) Delete(id string) {
|
func (s *KeyStore) Delete(id string) {
|
||||||
mu.Lock()
|
mu.Lock()
|
||||||
defer mu.Unlock()
|
defer mu.Unlock()
|
||||||
|
|||||||
@@ -26,22 +26,35 @@ func (s *SnippetStore) All() []model.Snippet {
|
|||||||
return s.snippets
|
return s.snippets
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *SnippetStore) Search(q string) []model.Snippet {
|
func (s *SnippetStore) Search(q, collection, tag string) []model.Snippet {
|
||||||
mu.RLock()
|
mu.RLock()
|
||||||
defer mu.RUnlock()
|
defer mu.RUnlock()
|
||||||
if q == "" {
|
|
||||||
return s.snippets
|
|
||||||
}
|
|
||||||
var res []model.Snippet
|
var res []model.Snippet
|
||||||
for _, sn := range s.snippets {
|
for _, sn := range s.snippets {
|
||||||
if contains(sn.Name, q) || contains(sn.Content, q) || contains(sn.Language, q) {
|
if q != "" && !contains(sn.Name, q) && !contains(sn.Content, q) && !contains(sn.Language, q) {
|
||||||
res = append(res, sn)
|
continue
|
||||||
}
|
}
|
||||||
|
if collection != "" && sn.Collection != collection {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if tag != "" {
|
||||||
|
found := false
|
||||||
|
for _, t := range sn.Tags {
|
||||||
|
if t == tag {
|
||||||
|
found = true
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if !found {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
res = append(res, sn)
|
||||||
}
|
}
|
||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *SnippetStore) Add(name, content, language string, tags []string) model.Snippet {
|
func (s *SnippetStore) Add(name, content, language string, tags []string, description, collection string) model.Snippet {
|
||||||
mu.Lock()
|
mu.Lock()
|
||||||
defer mu.Unlock()
|
defer mu.Unlock()
|
||||||
sn := model.Snippet{
|
sn := model.Snippet{
|
||||||
@@ -49,6 +62,9 @@ func (s *SnippetStore) Add(name, content, language string, tags []string) model.
|
|||||||
Name: name,
|
Name: name,
|
||||||
Content: content,
|
Content: content,
|
||||||
Language: language,
|
Language: language,
|
||||||
|
Description: description,
|
||||||
|
Collection: collection,
|
||||||
|
Icon: "FileText",
|
||||||
Tags: tags,
|
Tags: tags,
|
||||||
CreatedAt: time.Now().Format("Jan 2, 2006"),
|
CreatedAt: time.Now().Format("Jan 2, 2006"),
|
||||||
}
|
}
|
||||||
|
|||||||
+18
-2
@@ -1,6 +1,7 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"html/template"
|
||||||
"log"
|
"log"
|
||||||
|
|
||||||
"github.com/gofiber/contrib/websocket"
|
"github.com/gofiber/contrib/websocket"
|
||||||
@@ -16,8 +17,23 @@ import (
|
|||||||
func main() {
|
func main() {
|
||||||
engine := html.New("./views", ".html")
|
engine := html.New("./views", ".html")
|
||||||
engine.Reload(true)
|
engine.Reload(true)
|
||||||
engine.AddFunc("svg", func(name string) string {
|
engine.AddFunc("svg", func(name string) template.HTML {
|
||||||
return ""
|
switch name {
|
||||||
|
case "server":
|
||||||
|
return `<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M5 12h14M12 5l7 7-7 7"/></svg>`
|
||||||
|
case "terminal":
|
||||||
|
return `<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M8 9l3 3-3 3m5 0h3M5 20h14a2 2 0 002-2V6a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"/></svg>`
|
||||||
|
case "folder-sync":
|
||||||
|
return `<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M8 7h12m0 0l-4-4m4 4l-4 4m0 6H4m0 0l4 4m-4-4l4-4"/></svg>`
|
||||||
|
case "code2":
|
||||||
|
return `<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M10 20l4-16m4 4l4 4-4 4M6 16l-4-4 4-4"/></svg>`
|
||||||
|
case "key-round":
|
||||||
|
return `<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M15.75 5.25a3 3 0 013 3m3 0a6 6 0 01-7.029 5.912c-.563-.097-1.159.026-1.563.43L10.5 17.25H8.25v2.25H6v2.25H2.25v-2.818c0-.597.237-1.17.659-1.591l6.499-6.499c.404-.404.527-1 .43-1.563A6 6 0 1121.75 8.25z"/></svg>`
|
||||||
|
case "settings2":
|
||||||
|
return `<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M9.594 3.94c.09-.542.56-.94 1.11-.94h2.593c.55 0 1.02.398 1.11.94l.213 1.281c.063.374.313.686.645.87.074.04.147.083.22.127.324.196.72.257 1.075.124l1.217-.456a1.125 1.125 0 011.37.49l1.296 2.247a1.125 1.125 0 01-.26 1.431l-1.003.827c-.293.24-.438.613-.431.992a6.759 6.759 0 010 .255c-.007.378.138.75.43.99l1.005.828c.424.35.534.954.26 1.43l-1.298 2.247a1.125 1.125 0 01-1.369.491l-1.217-.456c-.355-.133-.75-.072-1.076.124a6.57 6.57 0 01-.22.128c-.331.183-.581.495-.644.869l-.213 1.28c-.09.543-.56.941-1.11.941h-2.594c-.55 0-1.02-.398-1.11-.94l-.213-1.281c-.062-.374-.312-.686-.644-.87a6.52 6.52 0 01-.22-.127c-.325-.196-.72-.257-1.076-.124l-1.217.456a1.125 1.125 0 01-1.369-.49l-1.297-2.247a1.125 1.125 0 01.26-1.431l1.004-.827c.292-.24.437-.613.43-.992a6.932 6.932 0 010-.255c.007-.378-.138-.75-.43-.99l-1.004-.828a1.125 1.125 0 01-.26-1.43l1.297-2.247a1.125 1.125 0 011.37-.491l1.216.456c.356.133.751.072 1.076-.124.072-.044.146-.087.22-.128.332-.183.582-.495.644-.869l.214-1.281z"/><path stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z"/></svg>`
|
||||||
|
default:
|
||||||
|
return `<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M8.25 6.75h12M8.25 12h12m-12 5.25h12M3.75 6.75h.007v.008H3.75V6.75zm.375 0a.375.375 0 11-.75 0 .375.375 0 01.75 0zM3.75 12h.007v.008H3.75V12zm.375 0a.375.375 0 11-.75 0 .375.375 0 01.75 0zm-.375 5.25h.007v.008H3.75v-.008zm.375 0a.375.375 0 11-.75 0 .375.375 0 01.75 0z"/></svg>`
|
||||||
|
}
|
||||||
})
|
})
|
||||||
engine.AddFunc("dict", func(values ...interface{}) map[string]interface{} {
|
engine.AddFunc("dict", func(values ...interface{}) map[string]interface{} {
|
||||||
m := make(map[string]interface{})
|
m := make(map[string]interface{})
|
||||||
|
|||||||
+1582
-80
File diff suppressed because it is too large
Load Diff
@@ -1,126 +1,155 @@
|
|||||||
document.addEventListener('alpine:init', () => {
|
document.addEventListener('alpine:init', () => {
|
||||||
const el = document.getElementById('hosts-data');
|
const el = document.getElementById('hosts-data');
|
||||||
const hostsData = el ? JSON.parse(el.textContent) : [];
|
const hostOptions = el ? JSON.parse(el.textContent) : [];
|
||||||
const hostOptions = hostsData.length > 0 ? hostsData :
|
|
||||||
[{ id: 'h1', name: 'api-prod-01', ip: '10.0.1.15' }];
|
function processCommand(cmd, tabName) {
|
||||||
|
const lines = [];
|
||||||
|
const clean = cmd.toLowerCase().trim();
|
||||||
|
if (!clean) return lines;
|
||||||
|
|
||||||
|
if (clean === 'clear') return [];
|
||||||
|
|
||||||
|
const commands = {
|
||||||
|
help: [
|
||||||
|
{ text: 'HostKeeper Mock SSH Interactive Command Parser:', type: 'success' },
|
||||||
|
{ text: ' help - Display this support manifest list', type: 'output' },
|
||||||
|
{ text: ' ls - List contents of the current working directory', type: 'output' },
|
||||||
|
{ text: ' docker ps - List simulated running Docker containers on cluster', type: 'output' },
|
||||||
|
{ text: ' uname -a - Show operating system and machine kernel data', type: 'output' },
|
||||||
|
{ text: ' ping 8.8.8.8 - Probe network gateway performance', type: 'output' },
|
||||||
|
{ text: ' cat server.js - Output snippet of remote index server configuration', type: 'output' },
|
||||||
|
{ text: ' keychain - Query keychain credentials loaded for target session', type: 'output' },
|
||||||
|
{ text: ' clear - Wipe the terminal display buffer clean', type: 'output' },
|
||||||
|
],
|
||||||
|
ls: [
|
||||||
|
{ text: 'drwxr-xr-x 3 root root 4096 Jul 6 12:00 controllers', type: 'output' },
|
||||||
|
{ text: 'drwxr-xr-x 2 root root 4096 Jul 6 12:00 models', type: 'output' },
|
||||||
|
{ text: 'drwxr-xr-x 2 root root 4096 Jul 6 12:00 routes', type: 'output' },
|
||||||
|
{ text: '-rw-r--r-- 1 root root 280 Jul 6 11:34 .env', type: 'error' },
|
||||||
|
{ text: '-rw-r--r-- 1 root root 1432 Jul 6 14:20 package.json', type: 'output' },
|
||||||
|
{ text: '-rwxr-xr-x 1 root root 8412 Jul 6 15:43 server.js', type: 'success' },
|
||||||
|
],
|
||||||
|
'docker ps': [
|
||||||
|
{ text: 'CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS', type: 'success' },
|
||||||
|
{ text: 'f87a2d12e9b0 node:18-alpine "docker-entrypoint.s…" 2 hours ago Up 2 hours 0.0.0.0:3000->3000/tcp', type: 'output' },
|
||||||
|
{ text: 'c23e84bf9211 postgres:15-alpine "docker-entrypoint.s…" 5 hours ago Up 5 hours 0.0.0.0:5432->5432/tcp', type: 'output' },
|
||||||
|
{ text: '78da12b84e0c redis:7-alpine "docker-entrypoint.s…" 10 hours ago Up 10 hours 0.0.0.0:6379->6379/tcp', type: 'output' },
|
||||||
|
],
|
||||||
|
'uname -a': [
|
||||||
|
{ text: 'Linux ' + tabName + ' 5.15.0-101-generic #111-Ubuntu SMP Wed Jul 6 21:27:00 UTC 2026 x86_64 GNU/Linux', type: 'output' },
|
||||||
|
],
|
||||||
|
'cat server.js': [
|
||||||
|
{ text: 'const express = require("express");', type: 'output' },
|
||||||
|
{ text: 'const app = express();', type: 'output' },
|
||||||
|
{ text: 'const PORT = process.env.PORT || 3000;', type: 'output' },
|
||||||
|
{ text: 'app.get("/api/health", (req, res) => res.send({ status: "healthy" }));', type: 'output' },
|
||||||
|
{ text: 'app.listen(PORT, () => console.log("Server active on cluster ingress"));', type: 'success' },
|
||||||
|
],
|
||||||
|
keychain: [
|
||||||
|
{ text: 'Keychain Credential Mapping Selected:', type: 'success' },
|
||||||
|
{ text: ' Active Key: id_ed25519_alex (ED25519 standard)', type: 'output' },
|
||||||
|
{ text: ' Encryption: AES-256 GCM cryptokey payload', type: 'output' },
|
||||||
|
{ text: ' Fingerprint: SHA256:7mP9K9+fVj5bW0vQ8zD1y2u3t4m5n6p7q8r9s0v1w2x', type: 'output' },
|
||||||
|
],
|
||||||
|
};
|
||||||
|
|
||||||
|
if (commands[clean]) {
|
||||||
|
return commands[clean];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (clean.startsWith('ping')) {
|
||||||
|
return [
|
||||||
|
{ text: '64 bytes from 8.8.8.8: icmp_seq=1 ttl=116 time=12.4 ms', type: 'output' },
|
||||||
|
{ text: '64 bytes from 8.8.8.8: icmp_seq=2 ttl=116 time=14.1 ms', type: 'output' },
|
||||||
|
{ text: '64 bytes from 8.8.8.8: icmp_seq=3 ttl=116 time=11.8 ms', type: 'output' },
|
||||||
|
{ text: '--- 8.8.8.8 ping statistics ---', type: 'success' },
|
||||||
|
{ text: '3 packets transmitted, 3 received, 0% packet loss, rtt min/avg/max = 11.8/12.76/14.1 ms', type: 'success' },
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
return [{ text: `hostkeeper: command not found: "${cmd}". Type "help" to view custom commands list.`, type: 'error' }];
|
||||||
|
}
|
||||||
|
|
||||||
Alpine.data('terminalManager', () => ({
|
Alpine.data('terminalManager', () => ({
|
||||||
tabs: [],
|
tabs: [],
|
||||||
activeTab: 0,
|
activeTab: 0,
|
||||||
termInstances: {},
|
histories: {},
|
||||||
|
command: '',
|
||||||
|
|
||||||
|
get history() {
|
||||||
|
const cur = this.tabs[this.activeTab];
|
||||||
|
return cur ? (this.histories[cur.id] || []) : [];
|
||||||
|
},
|
||||||
|
|
||||||
init() {
|
init() {
|
||||||
this.addTab();
|
this.addTab();
|
||||||
},
|
},
|
||||||
|
|
||||||
addTab() {
|
addTab() {
|
||||||
const randomHost = hostOptions[Math.floor(Math.random() * hostOptions.length)];
|
const host = hostOptions.length > 0
|
||||||
const id = 'term-' + Date.now() + '-' + Math.random().toString(36).slice(2, 6);
|
? hostOptions[Math.floor(Math.random() * hostOptions.length)]
|
||||||
this.tabs.push({ id, name: randomHost.name, host: randomHost.id, connected: false });
|
: { id: 'h1', name: 'localhost', ip: '127.0.0.1' };
|
||||||
|
const id = 'tab-' + Date.now() + '-' + Math.random().toString(36).slice(2, 6);
|
||||||
|
this.tabs.push({ id, name: host.name, host: host.ip, connected: true });
|
||||||
this.activeTab = this.tabs.length - 1;
|
this.activeTab = this.tabs.length - 1;
|
||||||
this.$nextTick(() => this.connectTerminal(id, randomHost.id, randomHost.name));
|
this.histories[id] = [
|
||||||
|
{ text: 'Connecting to ' + host.name + ' (' + host.ip + ') via port 22...', type: 'output' },
|
||||||
|
{ text: 'Using identity keychain file: id_ed25519_alex (strength: SECURE)', type: 'output' },
|
||||||
|
{ text: 'Welcome to Ubuntu 22.04 LTS (GNU/Linux 5.15.0-101-generic x86_64)', type: 'success' },
|
||||||
|
{ text: 'System load: 0.12 | Processes: 104 | Memory: 32% used', type: 'output' },
|
||||||
|
{ text: 'Type "help" to view custom interactive HostKeeper mock commands.', type: 'success' },
|
||||||
|
];
|
||||||
|
this.$nextTick(() => {
|
||||||
|
const out = document.getElementById('terminal-output');
|
||||||
|
if (out) out.scrollTop = out.scrollHeight;
|
||||||
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
switchTab(i) {
|
switchTab(i) {
|
||||||
this.activeTab = i;
|
this.activeTab = i;
|
||||||
|
this.$nextTick(() => {
|
||||||
|
const out = document.getElementById('terminal-output');
|
||||||
|
if (out) out.scrollTop = out.scrollHeight;
|
||||||
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
closeTab(i) {
|
closeTab(i) {
|
||||||
const tab = this.tabs[i];
|
if (this.tabs.length <= 1) return;
|
||||||
if (this.termInstances[tab.id]) {
|
const id = this.tabs[i].id;
|
||||||
this.termInstances[tab.id].dispose();
|
|
||||||
delete this.termInstances[tab.id];
|
|
||||||
}
|
|
||||||
this.tabs.splice(i, 1);
|
this.tabs.splice(i, 1);
|
||||||
if (this.tabs.length === 0) this.addTab();
|
delete this.histories[id];
|
||||||
else if (this.activeTab >= this.tabs.length) this.activeTab = this.tabs.length - 1;
|
if (this.activeTab >= this.tabs.length) this.activeTab = this.tabs.length - 1;
|
||||||
},
|
},
|
||||||
|
|
||||||
connectTerminal(id, hostId, hostName) {
|
submitCommand() {
|
||||||
const container = document.getElementById('terminal-container-' + id);
|
const cmd = this.command.trim();
|
||||||
if (!container) return;
|
if (!cmd) return;
|
||||||
|
const cur = this.tabs[this.activeTab];
|
||||||
const term = new Terminal({
|
if (!cur) return;
|
||||||
cursorBlink: true,
|
const id = cur.id;
|
||||||
cursorStyle: 'bar',
|
const lines = this.histories[id] || [];
|
||||||
fontSize: 14,
|
lines.push({ text: '$ ' + cmd, type: 'input' });
|
||||||
fontFamily: "'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace",
|
const output = processCommand(cmd, cur.name);
|
||||||
theme: {
|
this.histories[id] = lines.concat(output);
|
||||||
background: '#0d1117',
|
this.command = '';
|
||||||
foreground: '#c9d1d9',
|
this.$nextTick(() => {
|
||||||
cursor: '#58a6ff',
|
const out = document.getElementById('terminal-output');
|
||||||
selection: '#264f78',
|
if (out) out.scrollTop = out.scrollHeight;
|
||||||
black: '#484f58',
|
});
|
||||||
red: '#ff7b72',
|
|
||||||
green: '#3fb950',
|
|
||||||
yellow: '#d29922',
|
|
||||||
blue: '#58a6ff',
|
|
||||||
magenta: '#bc8cff',
|
|
||||||
cyan: '#39c5cf',
|
|
||||||
white: '#b1bac4',
|
|
||||||
brightBlack: '#6e7681',
|
|
||||||
brightRed: '#ffa198',
|
|
||||||
brightGreen: '#56d364',
|
|
||||||
brightYellow: '#e3b341',
|
|
||||||
brightBlue: '#79c0ff',
|
|
||||||
brightMagenta: '#d2a8ff',
|
|
||||||
brightCyan: '#56d4dd',
|
|
||||||
brightWhite: '#f0f6fc',
|
|
||||||
},
|
},
|
||||||
});
|
|
||||||
|
|
||||||
term.open(container);
|
insertCommand(cmd) {
|
||||||
this.termInstances[id] = term;
|
this.command = cmd;
|
||||||
const tab = this.tabs.find(t => t.id === id);
|
this.$nextTick(() => this.submitCommand());
|
||||||
if (tab) tab.connected = false;
|
},
|
||||||
|
|
||||||
const protocol = window.location.protocol === 'https:' ? 'wss:' : 'ws:';
|
clearBuffer() {
|
||||||
const wsUrl = protocol + '//' + window.location.host + '/terminal/ws/' + hostId;
|
const cur = this.tabs[this.activeTab];
|
||||||
let ws;
|
if (!cur) return;
|
||||||
|
this.histories[cur.id] = [
|
||||||
try {
|
{ text: 'Session log display buffer cleared manually.', type: 'output' },
|
||||||
ws = new WebSocket(wsUrl);
|
{ text: 'Type "help" to view interactive choices.', type: 'success' },
|
||||||
} catch (e) {
|
];
|
||||||
term.writeln('\x1b[1;31mWebSocket connection failed\x1b[0m');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
ws.onopen = () => {
|
|
||||||
if (tab) tab.connected = true;
|
|
||||||
term.focus();
|
|
||||||
};
|
|
||||||
|
|
||||||
ws.onmessage = (e) => {
|
|
||||||
if (e.data instanceof Blob) {
|
|
||||||
const reader = new FileReader();
|
|
||||||
reader.onload = () => term.write(reader.result);
|
|
||||||
reader.readAsText(e.data);
|
|
||||||
} else {
|
|
||||||
term.write(e.data);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
ws.onerror = () => {
|
|
||||||
term.writeln('\x1b[1;31m\x1b[7m CONNECTION ERROR \x1b[0m');
|
|
||||||
};
|
|
||||||
|
|
||||||
ws.onclose = () => {
|
|
||||||
if (tab) tab.connected = false;
|
|
||||||
term.writeln('\r\n\x1b[2mConnection closed.\x1b[0m');
|
|
||||||
};
|
|
||||||
|
|
||||||
term.onData((data) => {
|
|
||||||
if (ws && ws.readyState === WebSocket.OPEN) {
|
|
||||||
ws.send(data);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
term.attachCustomKeyEventHandler((e) => {
|
|
||||||
if (e.type === 'keydown' && e.ctrlKey && e.key === 'c') {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
}));
|
}));
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -20,44 +20,81 @@
|
|||||||
</header>
|
</header>
|
||||||
<main id="main-content" class="flex-1 overflow-auto p-6">
|
<main id="main-content" class="flex-1 overflow-auto p-6">
|
||||||
<div class="max-w-3xl mx-auto space-y-6">
|
<div class="max-w-3xl mx-auto space-y-6">
|
||||||
|
<!-- Color Palette -->
|
||||||
|
<div class="bg-white rounded-2xl border border-outline-variant/30 p-6 space-y-4">
|
||||||
|
<h3 class="font-bold text-on-surface flex items-center gap-2">
|
||||||
|
<svg class="w-5 h-5 text-primary" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21a4 4 0 01-4-4V5a2 2 0 012-2h4a2 2 0 012 2v12a4 4 0 01-4 4zm0 0h12a2 2 0 002-2v-4a2 2 0 00-2-2h-2.343M11 7.343l1.657-1.657a2 2 0 012.828 0l2.829 2.829a2 2 0 010 2.828l-8.486 8.485M7 17h.01"/></svg>
|
||||||
|
Color Palette — Lumina System
|
||||||
|
</h3>
|
||||||
|
<div class="grid grid-cols-2 sm:grid-cols-4 gap-3">
|
||||||
|
<div class="rounded-xl p-3" style="background:#0050cb"><span class="text-white text-xs font-mono font-bold">Primary #0050cb</span></div>
|
||||||
|
<div class="rounded-xl p-3" style="background:#006e2f"><span class="text-white text-xs font-mono font-bold">Secondary #006e2f</span></div>
|
||||||
|
<div class="rounded-xl p-3" style="background:#7e23cc"><span class="text-white text-xs font-mono font-bold">Tertiary #7e23cc</span></div>
|
||||||
|
<div class="rounded-xl p-3" style="background:#b3261e"><span class="text-white text-xs font-mono font-bold">Error #b3261e</span></div>
|
||||||
|
<div class="rounded-xl p-3 border border-outline-variant/30" style="background:#f7f9fb"><span class="text-[#191c1e] text-xs font-mono font-bold">Surface #f7f9fb</span></div>
|
||||||
|
<div class="rounded-xl p-3" style="background:#191c1e"><span class="text-white text-xs font-mono font-bold">On-Surface #191c1e</span></div>
|
||||||
|
<div class="rounded-xl p-3" style="background:#424656"><span class="text-white text-xs font-mono font-bold">On-Surface-Var #424656</span></div>
|
||||||
|
<div class="rounded-xl p-3" style="background:#c2c6d8"><span class="text-[#191c1e] text-xs font-mono font-bold">Outline-Var #c2c6d8</span></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="rounded-xl bg-white border border-outline-variant/30 p-6">
|
<!-- Typography -->
|
||||||
<h2 class="text-base font-semibold text-on-surface mb-3">Keyboard Shortcuts</h2>
|
<div class="bg-white rounded-2xl border border-outline-variant/30 p-6 space-y-4">
|
||||||
|
<h3 class="font-bold text-on-surface flex items-center gap-2">
|
||||||
|
<svg class="w-5 h-5 text-primary" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 12h16M4 18h7"/></svg>
|
||||||
|
Typography
|
||||||
|
</h3>
|
||||||
|
<div class="space-y-3">
|
||||||
|
<div><p class="text-xl font-bold tracking-tight">Heading XL — Inter 800</p><p class="text-xs text-on-surface-variant font-mono">text-xl font-bold tracking-tight</p></div>
|
||||||
|
<div><p class="text-base font-bold">Heading Base — Inter 700</p><p class="text-xs text-on-surface-variant font-mono">text-base font-bold</p></div>
|
||||||
|
<div><p class="text-sm font-medium">Body — Inter 500</p><p class="text-xs text-on-surface-variant font-mono">text-sm font-medium</p></div>
|
||||||
|
<div><p class="text-xs text-on-surface-variant">Caption — Inter 400/500</p><p class="text-xs text-on-surface-variant font-mono">text-xs text-on-surface-variant</p></div>
|
||||||
|
<div><p class="text-xs font-mono">Monospace — JetBrains Mono 400/600</p><p class="text-xs text-on-surface-variant font-mono">text-xs font-mono</p></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Elevation -->
|
||||||
|
<div class="bg-white rounded-2xl border border-outline-variant/30 p-6 space-y-4">
|
||||||
|
<h3 class="font-bold text-on-surface flex items-center gap-2">
|
||||||
|
<svg class="w-5 h-5 text-primary" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 3v1m0 16v1m9-9h-1M4 12H3m15.364 6.364l-.707-.707M6.343 6.343l-.707-.707m12.728 0l-.707.707M6.343 17.657l-.707.707M16 12a4 4 0 11-8 0 4 4 0 018 0z"/></svg>
|
||||||
|
Elevation & Layout
|
||||||
|
</h3>
|
||||||
|
<div class="space-y-3 text-sm">
|
||||||
|
<div class="flex items-center gap-4 p-3 rounded-lg bg-surface-container-low">
|
||||||
|
<span class="w-16 text-xs font-mono text-on-surface-variant">shadow-sm</span>
|
||||||
|
<div class="flex-1 h-8 rounded-lg bg-white shadow-sm border border-outline-variant/20"></div>
|
||||||
|
</div>
|
||||||
|
<div class="flex items-center gap-4 p-3 rounded-lg bg-surface-container-low">
|
||||||
|
<span class="w-16 text-xs font-mono text-on-surface-variant">shadow-md</span>
|
||||||
|
<div class="flex-1 h-8 rounded-lg bg-white shadow-md border border-outline-variant/20"></div>
|
||||||
|
</div>
|
||||||
|
<div class="flex items-center gap-4 p-3 rounded-lg bg-surface-container-low">
|
||||||
|
<span class="w-16 text-xs font-mono text-on-surface-variant">shadow-lg</span>
|
||||||
|
<div class="flex-1 h-8 rounded-lg bg-white shadow-lg border border-outline-variant/20"></div>
|
||||||
|
</div>
|
||||||
|
<div class="flex items-center gap-4 p-3 rounded-lg bg-surface-container-low">
|
||||||
|
<span class="w-16 text-xs font-mono text-on-surface-variant">shadow-2xl</span>
|
||||||
|
<div class="flex-1 h-8 rounded-lg bg-white shadow-2xl border border-outline-variant/20"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Keyboard Shortcuts -->
|
||||||
|
<div class="bg-white rounded-2xl border border-outline-variant/30 p-6 space-y-4">
|
||||||
|
<h3 class="font-bold text-on-surface flex items-center gap-2">
|
||||||
|
<svg class="w-5 h-5 text-primary" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 10V3L4 14h7v7l9-11h-7z"/></svg>
|
||||||
|
Keyboard Shortcuts
|
||||||
|
</h3>
|
||||||
<div class="space-y-2 text-sm">
|
<div class="space-y-2 text-sm">
|
||||||
<div class="flex items-center justify-between py-1.5 border-b border-outline-variant/10 last:border-0">
|
<div class="flex items-center justify-between py-1.5 border-b border-outline-variant/10"><span class="text-on-surface-variant">New Host</span><kbd class="px-2 py-0.5 rounded bg-surface-container-low text-xs font-mono text-on-surface">Cmd + N</kbd></div>
|
||||||
<span class="text-on-surface-variant">New Host</span>
|
<div class="flex items-center justify-between py-1.5 border-b border-outline-variant/10"><span class="text-on-surface-variant">New Snippet</span><kbd class="px-2 py-0.5 rounded bg-surface-container-low text-xs font-mono text-on-surface">Cmd + I</kbd></div>
|
||||||
<kbd class="px-2 py-0.5 rounded bg-surface-container-low text-xs font-mono text-on-surface">Cmd + N</kbd>
|
<div class="flex items-center justify-between py-1.5 border-b border-outline-variant/10"><span class="text-on-surface-variant">Toggle View</span><kbd class="px-2 py-0.5 rounded bg-surface-container-low text-xs font-mono text-on-surface">Cmd + T</kbd></div>
|
||||||
</div>
|
<div class="flex items-center justify-between py-1.5 border-b border-outline-variant/10"><span class="text-on-surface-variant">Search</span><kbd class="px-2 py-0.5 rounded bg-surface-container-low text-xs font-mono text-on-surface">Cmd + P</kbd></div>
|
||||||
<div class="flex items-center justify-between py-1.5 border-b border-outline-variant/10 last:border-0">
|
<div class="flex items-center justify-between py-1.5 border-b border-outline-variant/10"><span class="text-on-surface-variant">Quick Terminal</span><kbd class="px-2 py-0.5 rounded bg-surface-container-low text-xs font-mono text-on-surface">Cmd + K</kbd></div>
|
||||||
<span class="text-on-surface-variant">Search</span>
|
<div class="flex items-center justify-between py-1.5 border-b border-outline-variant/10"><span class="text-on-surface-variant">Close Panel</span><kbd class="px-2 py-0.5 rounded bg-surface-container-low text-xs font-mono text-on-surface">Esc</kbd></div>
|
||||||
<kbd class="px-2 py-0.5 rounded bg-surface-container-low text-xs font-mono text-on-surface">Cmd + K</kbd>
|
|
||||||
</div>
|
|
||||||
<div class="flex items-center justify-between py-1.5 border-b border-outline-variant/10 last:border-0">
|
|
||||||
<span class="text-on-surface-variant">Toggle Dark Mode</span>
|
|
||||||
<kbd class="px-2 py-0.5 rounded bg-surface-container-low text-xs font-mono text-on-surface">Cmd + D</kbd>
|
|
||||||
</div>
|
|
||||||
<div class="flex items-center justify-between py-1.5 border-b border-outline-variant/10 last:border-0">
|
|
||||||
<span class="text-on-surface-variant">Quick Brief</span>
|
|
||||||
<kbd class="px-2 py-0.5 rounded bg-surface-container-low text-xs font-mono text-on-surface">Cmd + B</kbd>
|
|
||||||
</div>
|
|
||||||
<div class="flex items-center justify-between py-1.5 border-b border-outline-variant/10 last:border-0">
|
|
||||||
<span class="text-on-surface-variant">Settings</span>
|
|
||||||
<kbd class="px-2 py-0.5 rounded bg-surface-container-low text-xs font-mono text-on-surface">Cmd + ,</kbd>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="rounded-xl bg-white border border-outline-variant/30 p-6">
|
|
||||||
<h2 class="text-base font-semibold text-on-surface mb-3">About Hostkeeper V2</h2>
|
|
||||||
<div class="space-y-2 text-sm text-on-surface-variant">
|
|
||||||
<p>Hostkeeper V2 is a free, open-source Termius alternative for managing SSH/SFTP connections.</p>
|
|
||||||
<p>Built with GoFiber v2 + HTMX + Alpine.js + TailwindCSS v4.</p>
|
|
||||||
<p>Version: 2.0.0-dev</p>
|
|
||||||
<p>License: MIT</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</main>
|
</main>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,72 +1,89 @@
|
|||||||
{{define "host_list"}}
|
{{define "host_list"}}
|
||||||
<div id="host-list" class="flex flex-col gap-4">
|
<div id="host-list" class="flex flex-col gap-4">
|
||||||
<div x-show="view === 'grid'" x-cloak
|
<div x-show="view === 'grid'" x-cloak
|
||||||
class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4">
|
class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-6">
|
||||||
{{range .Hosts}}
|
{{range .Hosts}}
|
||||||
<div class="rounded-xl bg-white border border-outline-variant/30 p-4 hover:shadow-md transition-shadow animate-fade-in">
|
<div class="group bg-white p-5 rounded-2xl border border-outline-variant hover:border-primary hover:shadow-lg transition-all cursor-pointer relative overflow-hidden">
|
||||||
<div class="flex items-center justify-between mb-3">
|
<div class="flex justify-between items-start mb-4">
|
||||||
<div class="flex items-center gap-2">
|
<div class="w-11 h-11 rounded-xl bg-surface-container-low flex items-center justify-center text-primary border border-outline-variant/20 group-hover:bg-primary-container/10 group-hover:border-primary/20 transition-colors">
|
||||||
<div class="w-8 h-8 rounded-lg {{if eq .Status "active"}}bg-primary/10 text-primary{{else}}bg-on-surface-variant/10 text-on-surface-variant{{end}} flex items-center justify-center">
|
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M5 12h14M12 5l7 7-7 7"/></svg>
|
||||||
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 12h14M12 5l7 7-7 7"/></svg>
|
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div class="flex items-center gap-1.5">
|
||||||
<p class="text-sm font-medium text-on-surface">{{.Name}}</p>
|
<span class="w-2 h-2 rounded-full {{if eq .Status "active"}}bg-secondary animate-pulse{{else}}bg-outline{{end}}"></span>
|
||||||
<p class="text-xs text-on-surface-variant">{{.IP}}</p>
|
<span class="text-[10px] font-bold uppercase tracking-wider {{if eq .Status "active"}}text-secondary{{else}}text-outline{{end}}">{{.Status}}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<span class="text-xs font-medium px-2 py-0.5 rounded-full {{if eq .Status "active"}}bg-secondary/10 text-secondary{{else}}bg-on-surface-variant/10 text-on-surface-variant{{end}}">
|
|
||||||
{{.Status}}
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<div class="flex items-center gap-2 text-xs text-on-surface-variant mb-3">
|
|
||||||
<span>{{.OS}}</span>
|
|
||||||
<span>·</span>
|
|
||||||
<span>{{.Provider}}</span>
|
|
||||||
</div>
|
|
||||||
<div class="flex items-center justify-between pt-3 border-t border-outline-variant/20">
|
|
||||||
<span class="text-xs text-on-surface-variant">{{.LastSeen}}</span>
|
|
||||||
<div class="flex gap-1">
|
|
||||||
<button class="p-1.5 rounded-lg hover:bg-primary/10 text-on-surface-variant hover:text-primary transition-colors"
|
|
||||||
onclick="alert('Connect to {{.Name}}')" title="Connect">
|
|
||||||
<svg class="w-3.5 h-3.5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 12h14M12 5l7 7-7 7"/></svg>
|
|
||||||
</button>
|
|
||||||
<button class="p-1.5 rounded-lg hover:bg-red-50 text-on-surface-variant hover:text-red-500 transition-colors"
|
|
||||||
hx-delete="/hosts/{{.ID}}" hx-target="#host-list" hx-confirm="Delete {{.Name}}?" title="Delete">
|
|
||||||
<svg class="w-3.5 h-3.5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"/></svg>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{{end}}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div x-show="view === 'list'" x-cloak class="flex flex-col gap-2">
|
<h4 class="font-bold text-on-surface group-hover:text-primary transition-colors text-base truncate">{{.Name}}</h4>
|
||||||
{{range .Hosts}}
|
<p class="font-mono text-xs text-outline mb-4">{{.IP}}</p>
|
||||||
<div class="rounded-xl bg-white border border-outline-variant/30 px-4 py-3 flex items-center gap-4 hover:shadow-sm transition-shadow animate-fade-in">
|
|
||||||
<div class="w-2 h-2 rounded-full {{if eq .Status "active"}}bg-secondary{{else}}bg-on-surface-variant{{end}} shrink-0"></div>
|
<div class="flex flex-wrap gap-1.5 mb-4">
|
||||||
<div class="w-8 h-8 rounded-lg {{if eq .Status "active"}}bg-primary/10 text-primary{{else}}bg-on-surface-variant/10 text-on-surface-variant{{end}} flex items-center justify-center shrink-0">
|
<span class="px-2 py-0.5 bg-surface-container-low rounded text-[10px] font-medium text-on-surface-variant">{{.OS}}</span>
|
||||||
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 12h14M12 5l7 7-7 7"/></svg>
|
<span class="px-2 py-0.5 bg-surface-container-low rounded text-[10px] font-medium text-on-surface-variant">{{.Provider}}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex-1 min-w-0">
|
|
||||||
<div class="flex items-center gap-2">
|
<div class="pt-3 border-t border-outline-variant/30 flex justify-between items-center text-xs">
|
||||||
<p class="text-sm font-medium text-on-surface">{{.Name}}</p>
|
<span class="text-outline italic">Last seen {{.LastSeen}}</span>
|
||||||
<span class="text-xs font-medium px-1.5 py-0.5 rounded-full {{if eq .Status "active"}}bg-secondary/10 text-secondary{{else}}bg-on-surface-variant/10 text-on-surface-variant{{end}}">{{.Status}}</span>
|
<div class="flex gap-1">
|
||||||
</div>
|
<a href="/terminal" class="bg-primary text-white hover:bg-primary-container hover:text-on-primary-container font-bold text-xs py-1.5 px-3 rounded-lg transition-all">Connect</a>
|
||||||
<p class="text-xs text-on-surface-variant truncate">{{.IP}} · {{.OS}} · {{.Provider}}</p>
|
|
||||||
</div>
|
|
||||||
<span class="text-xs text-on-surface-variant shrink-0">{{.LastSeen}}</span>
|
|
||||||
<div class="flex gap-1 shrink-0">
|
|
||||||
<button class="p-1.5 rounded-lg hover:bg-primary/10 text-on-surface-variant hover:text-primary transition-colors"
|
|
||||||
onclick="alert('Connect to {{.Name}}')" title="Connect">
|
|
||||||
<svg class="w-3.5 h-3.5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 12h14M12 5l7 7-7 7"/></svg>
|
|
||||||
</button>
|
|
||||||
<button class="p-1.5 rounded-lg hover:bg-red-50 text-on-surface-variant hover:text-red-500 transition-colors"
|
<button class="p-1.5 rounded-lg hover:bg-red-50 text-on-surface-variant hover:text-red-500 transition-colors"
|
||||||
hx-delete="/hosts/{{.ID}}" hx-target="#host-list" hx-confirm="Delete {{.Name}}?" title="Delete">
|
hx-delete="/hosts/{{.ID}}" hx-target="#host-list" hx-confirm="Delete {{.Name}}?" title="Delete">
|
||||||
<svg class="w-3.5 h-3.5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"/></svg>
|
<svg class="w-3.5 h-3.5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"/></svg>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{{end}}
|
||||||
|
|
||||||
|
<div @click="$dispatch('open-modal')"
|
||||||
|
class="group border-2 border-dashed border-outline-variant hover:border-primary hover:bg-primary/5 rounded-2xl flex flex-col items-center justify-center p-8 transition-all cursor-pointer text-center text-outline hover:text-primary min-h-[200px]">
|
||||||
|
<svg class="w-8 h-8 mb-2 group-active:scale-90 transition-transform" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M12 4v16m8-8H4"/></svg>
|
||||||
|
<span class="font-bold text-sm text-on-surface-variant group-hover:text-primary">Add New Host</span>
|
||||||
|
<p class="text-[10px] uppercase tracking-widest mt-1 opacity-70">Manual Config or Discovery</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div x-show="view === 'list'" x-cloak
|
||||||
|
class="bg-white border border-outline-variant rounded-2xl overflow-hidden shadow-sm divide-y divide-outline-variant/30">
|
||||||
|
{{range .Hosts}}
|
||||||
|
<div class="flex items-center justify-between p-4 hover:bg-primary/5 transition-colors cursor-pointer group">
|
||||||
|
<div class="flex items-center gap-4 min-w-0 flex-1">
|
||||||
|
<div class="w-10 h-10 rounded-lg bg-surface-container-low flex items-center justify-center text-primary shrink-0 border border-outline-variant/20">
|
||||||
|
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M5 12h14M12 5l7 7-7 7"/></svg>
|
||||||
|
</div>
|
||||||
|
<div class="min-w-0 flex-1 sm:grid sm:grid-cols-3 sm:gap-4 items-center">
|
||||||
|
<div>
|
||||||
|
<h4 class="font-bold text-on-surface group-hover:text-primary transition-colors text-sm truncate">{{.Name}}</h4>
|
||||||
|
<span class="font-mono text-xs text-outline">{{.IP}}</span>
|
||||||
|
</div>
|
||||||
|
<div class="hidden sm:block">
|
||||||
|
<p class="text-xs text-on-surface-variant font-medium">{{.OS}}</p>
|
||||||
|
<p class="text-[10px] text-outline">{{.Provider}}</p>
|
||||||
|
</div>
|
||||||
|
<div class="hidden md:block">
|
||||||
|
<span class="text-xs text-outline italic">Seen {{.LastSeen}}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="flex items-center gap-4 ml-4 shrink-0">
|
||||||
|
<span class="px-2 py-0.5 rounded-full text-[10px] font-bold uppercase tracking-wider flex items-center gap-1 {{if eq .Status "active"}}bg-secondary-container/20 text-secondary{{else}}bg-surface-container text-outline{{end}}">
|
||||||
|
<span class="w-1.5 h-1.5 rounded-full {{if eq .Status "active"}}bg-secondary animate-pulse{{else}}bg-outline{{end}}"></span>
|
||||||
|
{{.Status}}
|
||||||
|
</span>
|
||||||
|
<a href="/terminal" class="bg-primary text-white hover:bg-primary-container hover:text-on-primary-container font-bold text-xs py-1.5 px-4 rounded-lg transition-all">Connect</a>
|
||||||
|
<button class="p-1.5 rounded-lg hover:bg-red-50 text-on-surface-variant hover:text-red-500 transition-colors"
|
||||||
|
hx-delete="/hosts/{{.ID}}" hx-target="#host-list" hx-confirm="Delete {{.Name}}?" title="Delete">
|
||||||
|
<svg class="w-3.5 h-3.5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"/></svg>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|
||||||
|
<div @click="$dispatch('open-modal')"
|
||||||
|
class="p-4 hover:bg-primary/5 transition-colors cursor-pointer flex items-center justify-center gap-2 text-outline hover:text-primary font-bold text-sm">
|
||||||
|
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M12 4v16m8-8H4"/></svg>
|
||||||
|
Add New Host
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{if eq (len .Hosts) 0}}
|
{{if eq (len .Hosts) 0}}
|
||||||
@@ -75,11 +92,5 @@
|
|||||||
<p class="text-sm mt-1">Try a different search or add a new host</p>
|
<p class="text-sm mt-1">Try a different search or add a new host</p>
|
||||||
</div>
|
</div>
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|
||||||
<div class="rounded-xl border-2 border-dashed border-outline-variant/30 p-6 flex flex-col items-center justify-center text-on-surface-variant/50 hover:border-primary/30 hover:text-primary/50 transition-colors cursor-pointer min-h-[160px]"
|
|
||||||
@click="$dispatch('open-modal')">
|
|
||||||
<svg class="w-8 h-8 mb-2" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4v16m8-8H4"/></svg>
|
|
||||||
<span class="text-sm font-medium">Add New Host</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
{{end}}
|
{{end}}
|
||||||
@@ -1,36 +1,37 @@
|
|||||||
{{define "host_modal"}}
|
{{define "host_modal"}}
|
||||||
<div id="host-modal" class="fixed inset-0 z-50" x-data="{ open: false }" x-show="open" x-cloak
|
<div id="host-modal" class="fixed inset-0 z-50" x-data="{ open: false, type: 'api' }" x-show="open" x-cloak
|
||||||
@open-modal.window="open = true" @keydown.escape.window="open = false">
|
@open-modal.window="open = true" @keydown.escape.window="open = false">
|
||||||
<div class="absolute inset-0 bg-black/30 backdrop-blur-sm" @click="open = false"></div>
|
<div class="absolute inset-0 bg-black/40 backdrop-blur-sm" @click="open = false"></div>
|
||||||
<div class="absolute inset-0 flex items-center justify-center p-4" x-show="open" x-transition>
|
<div class="absolute inset-0 flex items-center justify-center p-4" x-show="open" x-transition>
|
||||||
<div class="bg-white rounded-xl shadow-xl w-full max-w-md p-6" @click.outside="open = false">
|
<div class="bg-white rounded-2xl max-w-md w-full border border-outline-variant shadow-2xl overflow-hidden p-6 space-y-4 animate-scale-up" @click.outside="open = false">
|
||||||
<div class="flex items-center justify-between mb-6">
|
<div class="flex justify-between items-center border-b border-outline-variant/30 pb-3">
|
||||||
<h2 class="text-lg font-semibold text-on-surface">Add New Host</h2>
|
<h3 class="font-bold text-lg text-on-surface">Add Host Credentials</h3>
|
||||||
<button @click="open = false"
|
<button @click="open = false"
|
||||||
class="p-1 rounded-lg hover:bg-surface-container-low text-on-surface-variant">
|
class="text-outline hover:text-primary cursor-pointer p-1 rounded-lg">
|
||||||
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"/></svg>
|
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"/></svg>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<form hx-post="/hosts" hx-target="#host-list" hx-swap="outerHTML"
|
<form hx-post="/hosts" hx-target="#host-list" hx-swap="outerHTML"
|
||||||
@submit="open = false"
|
@submit="open = false"
|
||||||
class="space-y-4">
|
class="space-y-4 text-sm">
|
||||||
<div>
|
<div class="flex flex-col gap-1.5">
|
||||||
<label class="block text-sm font-medium text-on-surface mb-1">Host Name</label>
|
<label class="text-xs font-bold text-on-surface-variant uppercase">Host Identifier</label>
|
||||||
<input type="text" name="name" required placeholder="e.g. web-prod-01"
|
<input type="text" name="name" required placeholder="e.g. prod-db-replica"
|
||||||
class="w-full px-3 py-2 rounded-lg border border-outline-variant/50 bg-white text-sm text-on-surface
|
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">
|
||||||
focus:outline-none focus:ring-2 focus:ring-primary/30 focus:border-primary/50">
|
|
||||||
</div>
|
</div>
|
||||||
<div>
|
|
||||||
<label class="block text-sm font-medium text-on-surface mb-1">IP Address</label>
|
<div class="flex flex-col gap-1.5">
|
||||||
<input type="text" name="ip" required placeholder="e.g. 10.0.1.100"
|
<label class="text-xs font-bold text-on-surface-variant uppercase">IP Address / Domain</label>
|
||||||
class="w-full px-3 py-2 rounded-lg border border-outline-variant/50 bg-white text-sm text-on-surface
|
<input type="text" name="ip" required placeholder="e.g. 10.0.12.19"
|
||||||
focus:outline-none focus:ring-2 focus:ring-primary/30 focus:border-primary/50">
|
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-mono text-on-surface">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="grid grid-cols-2 gap-4">
|
<div class="grid grid-cols-2 gap-4">
|
||||||
<div>
|
<div class="flex flex-col gap-1.5">
|
||||||
<label class="block text-sm font-medium text-on-surface mb-1">OS</label>
|
<label class="text-xs font-bold text-on-surface-variant uppercase">Operating System</label>
|
||||||
<select name="os" class="w-full px-3 py-2 rounded-lg border border-outline-variant/50 bg-white text-sm text-on-surface focus:outline-none focus:ring-2 focus:ring-primary/30">
|
<select name="os"
|
||||||
|
class="bg-surface-container-low border border-outline-variant/40 rounded-lg py-2 px-3 focus:outline-none focus:border-primary text-sm text-on-surface">
|
||||||
<option value="Ubuntu 22.04">Ubuntu 22.04</option>
|
<option value="Ubuntu 22.04">Ubuntu 22.04</option>
|
||||||
<option value="Ubuntu 24.04">Ubuntu 24.04</option>
|
<option value="Ubuntu 24.04">Ubuntu 24.04</option>
|
||||||
<option value="Debian 12">Debian 12</option>
|
<option value="Debian 12">Debian 12</option>
|
||||||
@@ -38,37 +39,40 @@
|
|||||||
<option value="Fedora 39">Fedora 39</option>
|
<option value="Fedora 39">Fedora 39</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div class="flex flex-col gap-1.5">
|
||||||
<label class="block text-sm font-medium text-on-surface mb-1">Provider</label>
|
<label class="text-xs font-bold text-on-surface-variant uppercase">Provider</label>
|
||||||
<select name="provider" class="w-full px-3 py-2 rounded-lg border border-outline-variant/50 bg-white text-sm text-on-surface focus:outline-none focus:ring-2 focus:ring-primary/30">
|
<select name="provider"
|
||||||
<option value="AWS US-East">AWS US-East</option>
|
class="bg-surface-container-low border border-outline-variant/40 rounded-lg py-2 px-3 focus:outline-none focus:border-primary text-sm text-on-surface">
|
||||||
|
<option value="AWS US-East">AWS Cloud</option>
|
||||||
<option value="AWS EU-West">AWS EU-West</option>
|
<option value="AWS EU-West">AWS EU-West</option>
|
||||||
<option value="DigitalOcean">DigitalOcean</option>
|
<option value="DigitalOcean">DigitalOcean</option>
|
||||||
<option value="Hetzner">Hetzner</option>
|
<option value="Hetzner">Hetzner</option>
|
||||||
<option value="GCP US-Central">GCP US-Central</option>
|
<option value="GCP US-Central">GCP Cloud</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
|
||||||
<label class="block text-sm font-medium text-on-surface mb-1">Type</label>
|
<div class="flex flex-col gap-1.5">
|
||||||
<select name="type" class="w-full px-3 py-2 rounded-lg border border-outline-variant/50 bg-white text-sm text-on-surface focus:outline-none focus:ring-2 focus:ring-primary/30">
|
<label class="text-xs font-bold text-on-surface-variant uppercase">Host Purpose / Type</label>
|
||||||
<option value="server">Server</option>
|
<div class="grid grid-cols-3 gap-2">
|
||||||
<option value="api">API</option>
|
<button type="button" @click="type = 'api'"
|
||||||
<option value="db">Database</option>
|
:class="type === 'api' ? 'bg-primary text-white border-primary' : 'bg-surface-container-low border-outline-variant/40 text-on-surface-variant hover:bg-surface-container'"
|
||||||
<option value="web">Web</option>
|
class="py-2 px-3 border rounded-lg font-bold text-xs uppercase tracking-wider transition-all">API Node</button>
|
||||||
<option value="edge">Edge</option>
|
<button type="button" @click="type = 'db'"
|
||||||
<option value="desktop">Desktop</option>
|
:class="type === 'db' ? 'bg-primary text-white border-primary' : 'bg-surface-container-low border-outline-variant/40 text-on-surface-variant hover:bg-surface-container'"
|
||||||
</select>
|
class="py-2 px-3 border rounded-lg font-bold text-xs uppercase tracking-wider transition-all">DB Node</button>
|
||||||
|
<button type="button" @click="type = 'web'"
|
||||||
|
:class="type === 'web' ? 'bg-primary text-white border-primary' : 'bg-surface-container-low border-outline-variant/40 text-on-surface-variant hover:bg-surface-container'"
|
||||||
|
class="py-2 px-3 border rounded-lg font-bold text-xs uppercase tracking-wider transition-all">Web Node</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex justify-end gap-3 pt-2">
|
<input type="hidden" name="type" :value="type">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="pt-4 flex justify-end gap-3 border-t border-outline-variant/20">
|
||||||
<button type="button" @click="open = false"
|
<button type="button" @click="open = false"
|
||||||
class="px-4 py-2 rounded-lg text-sm font-medium text-on-surface-variant hover:bg-surface-container-low transition-colors">
|
class="px-4 py-2 text-xs font-bold text-outline hover:text-on-surface transition-colors">Cancel</button>
|
||||||
Cancel
|
|
||||||
</button>
|
|
||||||
<button type="submit"
|
<button type="submit"
|
||||||
class="px-4 py-2 rounded-lg text-sm font-medium bg-primary text-white hover:bg-primary/90 transition-colors">
|
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">Add Host</button>
|
||||||
Add Host
|
|
||||||
</button>
|
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -17,65 +17,91 @@
|
|||||||
<div class="flex min-h-screen">
|
<div class="flex min-h-screen">
|
||||||
{{template "nav" .}}
|
{{template "nav" .}}
|
||||||
<div class="flex-1 flex flex-col overflow-hidden">
|
<div class="flex-1 flex flex-col overflow-hidden">
|
||||||
<header class="h-14 border-b border-outline-variant/30 flex items-center px-6 bg-white/70 backdrop-blur-md">
|
<header class="h-14 border-b border-outline-variant/30 flex items-center gap-3 px-6 bg-white/70 backdrop-blur-md">
|
||||||
<h1 class="text-lg font-semibold text-on-surface">{{.Title}}</h1>
|
<h1 class="text-xl font-bold tracking-tight text-on-surface">Hosts</h1>
|
||||||
|
<span class="text-xs text-on-surface-variant mt-0.5">Manage connections, monitor uptime, and deploy</span>
|
||||||
</header>
|
</header>
|
||||||
<main id="main-content" class="flex-1 overflow-auto p-6">
|
<main id="main-content" class="flex-1 overflow-auto p-6">
|
||||||
<div id="dashboard-page" class="max-w-7xl mx-auto">
|
<div id="dashboard-page" class="max-w-7xl mx-auto space-y-8">
|
||||||
<div class="grid grid-cols-3 gap-4 mb-6">
|
<div class="grid grid-cols-1 md:grid-cols-12 gap-6">
|
||||||
<div class="rounded-xl bg-white border border-outline-variant/30 p-4">
|
<div class="md:col-span-8 p-6 rounded-2xl bg-white border border-outline-variant shadow-sm flex items-center justify-between overflow-hidden relative group">
|
||||||
<div class="flex items-center gap-2 text-primary mb-1">
|
<div class="relative z-10 space-y-2">
|
||||||
<span class="w-5 h-5 bg-primary/20 rounded flex items-center justify-center text-xs font-bold">⚡</span>
|
<h3 class="text-on-surface-variant font-bold text-xs uppercase tracking-wider">Active Connections</h3>
|
||||||
<span class="text-xs font-medium text-on-surface-variant uppercase tracking-wide">Active Connections</span>
|
<div class="flex items-end gap-3">
|
||||||
|
<span class="text-4xl font-black text-primary">{{.Active}}</span>
|
||||||
|
<span class="text-secondary font-bold text-sm mb-1 flex items-center bg-secondary-container/20 px-2 py-0.5 rounded-full">
|
||||||
|
<svg class="w-4 h-4 mr-1" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M2.25 18L9 11.25l4.306 4.307a11.95 11.95 0 015.814-5.519l2.74-1.22m0 0l-5.94-2.28m5.94 2.28l-2.28 5.941"/></svg>
|
||||||
|
+2 today
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<span class="text-2xl font-bold text-on-surface">{{.Active}}</span>
|
<p class="text-xs text-on-surface-variant">Global performance metrics sync integrity active.</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="rounded-xl bg-white border border-outline-variant/30 p-4">
|
<div class="absolute right-0 top-0 w-1/3 h-full bg-gradient-to-l from-primary/5 to-transparent pointer-events-none"></div>
|
||||||
<div class="flex items-center gap-2 text-secondary mb-1">
|
<div class="flex gap-2 items-end h-16 shrink-0">
|
||||||
<span class="w-5 h-5 bg-secondary/20 rounded flex items-center justify-center text-xs font-bold">✓</span>
|
<div class="w-2.5 h-10 bg-primary/20 rounded-full animate-pulse"></div>
|
||||||
<span class="text-xs font-medium text-on-surface-variant uppercase tracking-wide">Transfers Today</span>
|
<div class="w-2.5 h-14 bg-primary/40 rounded-full animate-pulse delay-75"></div>
|
||||||
|
<div class="w-2.5 h-8 bg-primary/10 rounded-full animate-pulse delay-150"></div>
|
||||||
|
<div class="w-2.5 h-16 bg-primary/60 rounded-full animate-pulse delay-200"></div>
|
||||||
</div>
|
</div>
|
||||||
<span class="text-2xl font-bold text-on-surface">0</span>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="rounded-xl bg-white border border-outline-variant/30 p-4">
|
<div class="md:col-span-4 p-6 rounded-2xl bg-primary text-on-primary shadow-xl shadow-primary/15 flex flex-col justify-between relative overflow-hidden">
|
||||||
<div class="flex items-center gap-2 text-tertiary mb-1">
|
<div class="relative z-10">
|
||||||
<span class="w-5 h-5 bg-tertiary/20 rounded flex items-center justify-center text-xs font-bold">#</span>
|
<svg class="w-8 h-8 opacity-90 text-white mb-2" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3.75 13.5l10.5-11.25L12 10.5h8.25L9.75 21.75 12 13.5H3.75z"/></svg>
|
||||||
<span class="text-xs font-medium text-on-surface-variant uppercase tracking-wide">Saved Hosts</span>
|
<p class="font-bold text-lg leading-tight">Fastest Access Enabled</p>
|
||||||
|
</div>
|
||||||
|
<p class="text-xs opacity-85 mt-2 relative z-10">Smart routing engine successfully reduces terminal latency by <span class="font-bold">24ms</span> across European and Asian clusters.</p>
|
||||||
|
<div class="absolute -right-6 -bottom-6 opacity-10">
|
||||||
|
<svg class="w-32 h-32 rotate-12" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3.75 13.5l10.5-11.25L12 10.5h8.25L9.75 21.75 12 13.5H3.75z"/></svg>
|
||||||
</div>
|
</div>
|
||||||
<span class="text-2xl font-bold text-on-surface">{{len .Hosts}}</span>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="flex items-center gap-3 mb-6" x-data="{ view: 'grid' }">
|
<div x-data="{ view: 'grid' }">
|
||||||
<div class="relative flex-1 max-w-md">
|
<div class="flex flex-col sm:flex-row sm:items-center justify-between gap-4 border-b border-outline-variant/30 pb-4 mb-6">
|
||||||
<input type="search" name="q" placeholder="Search hosts..."
|
<div class="flex items-center gap-3">
|
||||||
hx-get="/hosts?q=..." hx-trigger="keyup delay:200ms"
|
<h3 class="text-lg font-bold text-on-surface">Recent Hosts</h3>
|
||||||
hx-target="#host-list" hx-include="[name='filter']"
|
<div class="flex bg-surface-container rounded-lg p-0.5 text-xs font-semibold border border-outline-variant/20"
|
||||||
class="w-full pl-9 pr-3 py-2 rounded-lg border border-outline-variant/50 bg-white text-sm text-on-surface placeholder-on-surface-variant focus:outline-none focus:ring-2 focus:ring-primary/30 focus:border-primary/50">
|
x-data="{ filter: 'all' }">
|
||||||
|
<button @click="filter = 'all'"
|
||||||
|
:class="filter === 'all' ? 'bg-white text-primary shadow-sm' : 'text-on-surface-variant hover:text-on-surface'"
|
||||||
|
class="px-2.5 py-1 rounded-md transition-all"
|
||||||
|
hx-get="/hosts?filter=all" hx-target="#host-list">All</button>
|
||||||
|
<button @click="filter = 'active'"
|
||||||
|
:class="filter === 'active' ? 'bg-white text-primary shadow-sm' : 'text-on-surface-variant hover:text-on-surface'"
|
||||||
|
class="px-2.5 py-1 rounded-md transition-all"
|
||||||
|
hx-get="/hosts?filter=active" hx-target="#host-list">Active</button>
|
||||||
|
<button @click="filter = 'offline'"
|
||||||
|
:class="filter === 'offline' ? 'bg-white text-primary shadow-sm' : 'text-on-surface-variant hover:text-on-surface'"
|
||||||
|
class="px-2.5 py-1 rounded-md transition-all"
|
||||||
|
hx-get="/hosts?filter=offline" hx-target="#host-list">Offline</button>
|
||||||
</div>
|
</div>
|
||||||
<select name="filter"
|
</div>
|
||||||
hx-get="/hosts?filter={value}" hx-trigger="change" hx-target="#host-list"
|
<div class="flex items-center gap-3">
|
||||||
class="px-3 py-2 rounded-lg border border-outline-variant/50 bg-white text-sm text-on-surface focus:outline-none focus:ring-2 focus:ring-primary/30">
|
<div class="relative">
|
||||||
<option value="all">All</option>
|
<svg class="absolute left-3 top-1/2 -translate-y-1/2 text-outline w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"/></svg>
|
||||||
<option value="active">Active</option>
|
<input type="search" name="q" placeholder="Search hosts..."
|
||||||
<option value="offline">Offline</option>
|
hx-get="/hosts" hx-trigger="keyup delay:200ms"
|
||||||
</select>
|
hx-target="#host-list"
|
||||||
<div class="flex items-center bg-white rounded-lg border border-outline-variant/50 p-0.5">
|
class="pl-9 pr-4 py-1.5 rounded-full bg-surface-container-low border border-outline-variant/30 text-sm focus:border-primary focus:bg-white focus:outline-none focus:ring-1 focus:ring-primary w-48 sm:w-60 transition-all text-on-surface placeholder-on-surface-variant">
|
||||||
|
</div>
|
||||||
|
<div class="flex border border-outline-variant/50 rounded-lg p-0.5 bg-white">
|
||||||
<button @click="view = 'grid'"
|
<button @click="view = 'grid'"
|
||||||
:class="view === 'grid' ? 'bg-primary/10 text-primary' : 'text-on-surface-variant hover:text-on-surface'"
|
:class="view === 'grid' ? 'bg-surface-container text-primary' : 'text-on-surface-variant'"
|
||||||
class="p-1.5 rounded transition-colors">
|
class="p-1.5 rounded transition-colors" title="Grid View">
|
||||||
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 5a1 1 0 011-1h4a1 1 0 011 1v4a1 1 0 01-1 1H5a1 1 0 01-1-1V5zm10 0a1 1 0 011-1h4a1 1 0 011 1v4a1 1 0 01-1 1h-4a1 1 0 01-1-1V5zM4 15a1 1 0 011-1h4a1 1 0 011 1v4a1 1 0 01-1 1H5a1 1 0 01-1-1v-4zm10 0a1 1 0 011-1h4a1 1 0 011 1v4a1 1 0 01-1 1h-4a1 1 0 01-1-1v-4z"/></svg>
|
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 5a1 1 0 011-1h4a1 1 0 011 1v4a1 1 0 01-1 1H5a1 1 0 01-1-1V5zm10 0a1 1 0 011-1h4a1 1 0 011 1v4a1 1 0 01-1 1h-4a1 1 0 01-1-1V5zM4 15a1 1 0 011-1h4a1 1 0 011 1v4a1 1 0 01-1 1H5a1 1 0 01-1-1v-4zm10 0a1 1 0 011-1h4a1 1 0 011 1v4a1 1 0 01-1 1h-4a1 1 0 01-1-1v-4z"/></svg>
|
||||||
</button>
|
</button>
|
||||||
<button @click="view = 'list'"
|
<button @click="view = 'list'"
|
||||||
:class="view === 'list' ? 'bg-primary/10 text-primary' : 'text-on-surface-variant hover:text-on-surface'"
|
:class="view === 'list' ? 'bg-surface-container text-primary' : 'text-on-surface-variant'"
|
||||||
class="p-1.5 rounded transition-colors">
|
class="p-1.5 rounded transition-colors" title="List View">
|
||||||
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 10h16M4 14h16M4 18h16"/></svg>
|
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 10h16M4 14h16M4 18h16"/></svg>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
{{template "host_list" .}}
|
{{template "host_list" .}}
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
{{template "host_modal" .}}
|
{{template "host_modal" .}}
|
||||||
</main>
|
</main>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,43 +1,86 @@
|
|||||||
{{define "credential_grid"}}
|
{{define "credential_grid"}}
|
||||||
<div id="key-grid" class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4">
|
<div id="key-grid" class="grid grid-cols-1 md:grid-cols-2 gap-6">
|
||||||
{{range .Keys}}
|
{{range $i, $key := .Keys}}
|
||||||
<div class="rounded-xl bg-white border border-outline-variant/30 p-4 hover:shadow-md transition-shadow animate-fade-in">
|
<div class="bg-white p-5 rounded-2xl border border-outline-variant/30 hover:border-primary hover:shadow-lg transition-all flex flex-col justify-between space-y-4"
|
||||||
<div class="flex items-start justify-between mb-3">
|
x-data="{ reveal: false }">
|
||||||
<div class="flex items-center gap-2">
|
<div class="flex justify-between items-start gap-3">
|
||||||
<div class="w-8 h-8 rounded-lg bg-tertiary/10 text-tertiary flex items-center justify-center">
|
<div class="flex items-center gap-3">
|
||||||
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15.75 5.25a3 3 0 013 3m3 0a6 6 0 01-7.029 5.912c-.563-.097-1.159.026-1.563.43L10.5 17.25H8.25v2.25H6v2.25H2.25v-2.818c0-.597.237-1.17.659-1.591l6.499-6.499c.404-.404.527-1 .43-1.563A6 6 0 1121.75 8.25z"/></svg>
|
<div class="w-10 h-10 rounded-xl bg-surface-container-low border border-outline-variant/20 flex items-center justify-center text-primary">
|
||||||
|
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z"/></svg>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<p class="text-sm font-medium text-on-surface">{{.Name}}</p>
|
<h3 class="font-bold text-on-surface text-base truncate max-w-[180px]">{{.Name}}</h3>
|
||||||
<p class="text-xs text-on-surface-variant">{{.Username}} @ {{.URL}}</p>
|
<span class="text-[10px] font-mono text-outline uppercase tracking-wider">{{.Type}}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<button class="p-1.5 rounded-lg hover:bg-red-50 text-on-surface-variant hover:text-red-500 transition-colors shrink-0"
|
|
||||||
hx-delete="/keys/{{.ID}}" hx-target="#key-grid" hx-confirm="Delete {{.Name}}?">
|
{{if eq .Strength "secure"}}
|
||||||
|
<span class="shrink-0 px-2.5 py-0.5 bg-secondary/10 text-secondary border border-secondary/20 rounded-full text-[10px] font-bold uppercase tracking-wider flex items-center gap-1">
|
||||||
|
<svg class="w-3.5 h-3.5 text-secondary" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"/></svg>
|
||||||
|
SECURE
|
||||||
|
</span>
|
||||||
|
{{else if eq .Strength "moderate"}}
|
||||||
|
<span class="shrink-0 px-2.5 py-0.5 bg-purple-50 text-tertiary border border-tertiary/20 rounded-full text-[10px] font-bold uppercase tracking-wider flex items-center gap-1">
|
||||||
|
<svg class="w-3.5 h-3.5 text-tertiary" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"/></svg>
|
||||||
|
MODERATE
|
||||||
|
</span>
|
||||||
|
{{else}}
|
||||||
|
<span class="shrink-0 px-2.5 py-0.5 bg-red-50 text-error border border-error/20 rounded-full text-[10px] font-bold uppercase tracking-wider flex items-center gap-1">
|
||||||
|
<svg class="w-3.5 h-3.5 text-error" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.964-.833-2.732 0L3.34 16.5c-.77.833.192 2.5 1.732 2.5z"/></svg>
|
||||||
|
WEAK
|
||||||
|
</span>
|
||||||
|
{{end}}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="space-y-2 text-xs">
|
||||||
|
<div class="flex justify-between items-center py-1 border-b border-outline-variant/10">
|
||||||
|
<span class="text-outline font-semibold uppercase tracking-wider text-[10px]">User Login</span>
|
||||||
|
<span class="font-mono text-on-surface font-semibold">{{.Username}}</span>
|
||||||
|
</div>
|
||||||
|
<div class="flex justify-between items-center py-1 border-b border-outline-variant/10">
|
||||||
|
<span class="text-outline font-semibold uppercase tracking-wider text-[10px]">Credential Secrets</span>
|
||||||
|
<div class="flex items-center gap-2">
|
||||||
|
<span class="font-mono text-on-surface-variant" x-text="reveal ? '{{.Passphrase}}' : '••••••••••••••••'"></span>
|
||||||
|
<button @click="reveal = !reveal"
|
||||||
|
class="p-1 hover:bg-surface-container rounded text-outline transition-colors" title="Toggle visibility">
|
||||||
|
<svg x-show="reveal" class="w-3.5 h-3.5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13.875 18.825A10.05 10.05 0 0112 19c-4.478 0-8.268-2.943-9.543-7a10.06 10.06 0 011.563-3.029m5.858.908a3 3 0 114.243 4.243M9.878 9.878l4.242 4.242M9.88 9.88L6.59 6.59m7.532 7.532l3.29 3.29M3 3l3.59 3.59m0 0A9.953 9.953 0 0112 5c4.478 0 8.268 2.943 9.543 7a10.025 10.025 0 01-4.132 5.411m0 0L21 21"/></svg>
|
||||||
|
<svg x-show="!reveal" class="w-3.5 h-3.5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z"/><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"/></svg>
|
||||||
|
</button>
|
||||||
|
<button onclick="copyToClipboard('{{.Passphrase}}')"
|
||||||
|
class="p-1 hover:bg-surface-container rounded text-outline transition-colors" title="Copy secret">
|
||||||
|
<svg class="w-3.5 h-3.5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"/></svg>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{if .Fingerprint}}
|
||||||
|
<div class="py-1">
|
||||||
|
<span class="text-outline font-semibold uppercase tracking-wider text-[10px] block mb-0.5">SHA256 FINGERPRINT</span>
|
||||||
|
<code class="text-[10px] text-on-surface-variant font-mono block break-all bg-surface-container-low p-2 rounded border border-outline-variant/20 select-all">{{.Fingerprint}}</code>
|
||||||
|
</div>
|
||||||
|
{{end}}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="pt-3 border-t border-outline-variant/30 flex flex-col sm:flex-row sm:items-center justify-between gap-3 text-[10px] text-outline">
|
||||||
|
<span class="shrink-0">Created {{.CreatedAt}}</span>
|
||||||
|
<div class="flex items-center justify-between sm:justify-end gap-2 flex-1 min-w-0 w-full">
|
||||||
|
<div class="flex items-center gap-1.5 min-w-0 flex-1 justify-start sm:justify-end">
|
||||||
|
{{if .URL}}
|
||||||
|
<span class="bg-primary-container/15 text-primary px-1.5 py-0.5 rounded font-mono text-[9px] shrink-0">{{.URL}}</span>
|
||||||
|
{{end}}
|
||||||
|
</div>
|
||||||
|
<button hx-delete="/keys/{{.ID}}" hx-target="#key-grid" hx-confirm="Delete {{.Name}}?"
|
||||||
|
class="p-1 hover:bg-red-50 hover:text-error rounded text-outline transition-colors shrink-0 ml-1">
|
||||||
<svg class="w-3.5 h-3.5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"/></svg>
|
<svg class="w-3.5 h-3.5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"/></svg>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex items-center gap-2 text-xs text-on-surface-variant mb-3">
|
|
||||||
<span class="font-mono">{{.Passphrase}}</span>
|
|
||||||
<span class="text-xs font-medium px-1.5 py-0.5 rounded-full
|
|
||||||
{{if eq .Strength "secure"}}bg-secondary/10 text-secondary{{else if eq .Strength "moderate"}}bg-tertiary/10 text-tertiary{{else}}bg-red-50 text-red-500{{end}}">
|
|
||||||
{{.Strength}}
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<div class="flex items-center justify-between pt-3 border-t border-outline-variant/20">
|
|
||||||
<span class="text-xs text-on-surface-variant">{{.CreatedAt}}</span>
|
|
||||||
<button class="p-1.5 rounded-lg hover:bg-primary/10 text-on-surface-variant hover:text-primary transition-colors"
|
|
||||||
onclick="copyToClipboard('{{.Passphrase}}')" title="Copy">
|
|
||||||
<svg class="w-3.5 h-3.5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"/></svg>
|
|
||||||
</button>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|
||||||
{{if eq (len .Keys) 0}}
|
{{if eq (len .Keys) 0}}
|
||||||
<div class="col-span-full text-center py-12 text-on-surface-variant">
|
<div class="col-span-full p-12 border border-dashed border-outline-variant/40 rounded-2xl text-center text-outline">
|
||||||
<p class="text-lg font-medium">No keys found</p>
|
No credentials found. Add your first credential.
|
||||||
<p class="text-sm mt-1">Add your first credential</p>
|
|
||||||
</div>
|
</div>
|
||||||
{{end}}
|
{{end}}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -21,105 +21,90 @@
|
|||||||
<h1 class="text-lg font-semibold text-on-surface">{{.Title}}</h1>
|
<h1 class="text-lg font-semibold text-on-surface">{{.Title}}</h1>
|
||||||
</header>
|
</header>
|
||||||
<main id="main-content" class="flex-1 overflow-auto p-6">
|
<main id="main-content" class="flex-1 overflow-auto p-6">
|
||||||
<div id="keychain-page" class="max-w-7xl mx-auto">
|
<div class="max-w-7xl mx-auto space-y-8">
|
||||||
<div class="flex items-center gap-3 mb-6">
|
<!-- Header Panel -->
|
||||||
<div class="relative flex-1 max-w-md">
|
<div class="flex flex-col sm:flex-row sm:items-center justify-between gap-4 border-b border-outline-variant/30 pb-4">
|
||||||
<input type="search" placeholder="Search keys..."
|
<div>
|
||||||
hx-get="/keys/grid?q=..." hx-trigger="keyup delay:200ms"
|
<h2 class="text-xl font-bold text-on-surface tracking-tight">Keychain & Credentials</h2>
|
||||||
hx-target="#key-grid"
|
<p class="text-xs text-on-surface-variant mt-0.5">Secure sandbox containing cluster credentials, private SSH keys, and tokens</p>
|
||||||
class="w-full pl-9 pr-3 py-2 rounded-lg border border-outline-variant/50 bg-white text-sm text-on-surface placeholder-on-surface-variant focus:outline-none focus:ring-2 focus:ring-primary/30 focus:border-primary/50">
|
</div>
|
||||||
|
<div class="flex items-center gap-3">
|
||||||
|
<div class="relative">
|
||||||
|
<svg class="absolute left-3 top-1/2 -translate-y-1/2 text-outline w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"/></svg>
|
||||||
|
<input type="search" name="q" placeholder="Search credentials..."
|
||||||
|
hx-get="/keys/grid" hx-trigger="keyup delay:200ms" hx-target="#key-grid"
|
||||||
|
class="pl-9 pr-4 py-1.5 rounded-full bg-surface-container-low border border-outline-variant/30 text-sm focus:border-primary focus:bg-white focus:outline-none focus:ring-1 focus:ring-primary w-48 sm:w-60 transition-all">
|
||||||
</div>
|
</div>
|
||||||
<button @click="$dispatch('open-key-modal')"
|
<button @click="$dispatch('open-key-modal')"
|
||||||
class="px-4 py-2 rounded-lg text-sm font-medium bg-primary text-white hover:bg-primary/90 transition-colors flex items-center gap-2">
|
class="flex items-center gap-1.5 bg-primary text-white hover:bg-primary/90 font-bold text-xs py-2 px-4 rounded-xl shadow-md transition-all">
|
||||||
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4v16m8-8H4"/></svg>
|
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4v16m8-8H4"/></svg>
|
||||||
Add Key
|
Add Key
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div id="key-grid" class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4">
|
|
||||||
{{range .Keys}}
|
|
||||||
<div class="rounded-xl bg-white border border-outline-variant/30 p-4 hover:shadow-md transition-shadow animate-fade-in">
|
|
||||||
<div class="flex items-start justify-between mb-3">
|
|
||||||
<div class="flex items-center gap-2">
|
|
||||||
<div class="w-8 h-8 rounded-lg bg-tertiary/10 text-tertiary flex items-center justify-center">
|
|
||||||
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15.75 5.25a3 3 0 013 3m3 0a6 6 0 01-7.029 5.912c-.563-.097-1.159.026-1.563.43L10.5 17.25H8.25v2.25H6v2.25H2.25v-2.818c0-.597.237-1.17.659-1.591l6.499-6.499c.404-.404.527-1 .43-1.563A6 6 0 1121.75 8.25z"/></svg>
|
|
||||||
</div>
|
</div>
|
||||||
<div>
|
|
||||||
<p class="text-sm font-medium text-on-surface">{{.Name}}</p>
|
<!-- Grid List -->
|
||||||
<p class="text-xs text-on-surface-variant">{{.Username}} @ {{.URL}}</p>
|
<div id="key-grid" class="grid grid-cols-1 md:grid-cols-2 gap-6">
|
||||||
|
{{template "credential_grid" .}}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Security Advisory Bento -->
|
||||||
|
<div class="p-5 border border-outline-variant/60 rounded-2xl bg-white/40 flex items-start gap-4 text-xs text-on-surface">
|
||||||
|
<svg class="w-5 h-5 text-primary shrink-0 mt-0.5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"/></svg>
|
||||||
|
<div class="space-y-1">
|
||||||
|
<h4 class="font-bold text-on-surface">HostKeeper Security Policy & Local Sandbox</h4>
|
||||||
|
<p class="text-on-surface-variant leading-relaxed">
|
||||||
|
Keys are parsed locally inside your isolated browser environment and transmitted strictly within cryptographically verified SSH tunnels. Passphrases are hashed with Argon2id instantly and never touch intermediate telemetry systems.
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<button class="p-1.5 rounded-lg hover:bg-red-50 text-on-surface-variant hover:text-red-500 transition-colors shrink-0"
|
|
||||||
hx-delete="/keys/{{.ID}}" hx-target="#key-grid" hx-confirm="Delete {{.Name}}?">
|
|
||||||
<svg class="w-3.5 h-3.5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"/></svg>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
<div class="flex items-center gap-2 text-xs text-on-surface-variant mb-3">
|
|
||||||
<span class="font-mono">{{.Passphrase}}</span>
|
|
||||||
<span class="text-xs font-medium px-1.5 py-0.5 rounded-full
|
|
||||||
{{if eq .Strength "secure"}}bg-secondary/10 text-secondary{{else if eq .Strength "moderate"}}bg-tertiary/10 text-tertiary{{else}}bg-red-50 text-red-500{{end}}">
|
|
||||||
{{.Strength}}
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<div class="flex items-center justify-between pt-3 border-t border-outline-variant/20">
|
|
||||||
<span class="text-xs text-on-surface-variant">{{.CreatedAt}}</span>
|
|
||||||
<button class="p-1.5 rounded-lg hover:bg-primary/10 text-on-surface-variant hover:text-primary transition-colors"
|
|
||||||
onclick="copyToClipboard('{{.Passphrase}}')" title="Copy">
|
|
||||||
<svg class="w-3.5 h-3.5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"/></svg>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{{end}}
|
|
||||||
{{if eq (len .Keys) 0}}
|
|
||||||
<div class="col-span-full text-center py-12 text-on-surface-variant">
|
|
||||||
<p class="text-lg font-medium">No keys found</p>
|
|
||||||
<p class="text-sm mt-1">Add your first credential</p>
|
|
||||||
</div>
|
|
||||||
{{end}}
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- Add Credential Modal -->
|
||||||
<div id="key-modal" class="fixed inset-0 z-50" x-data="{ open: false }" x-show="open" x-cloak
|
<div id="key-modal" class="fixed inset-0 z-50" x-data="{ open: false }" x-show="open" x-cloak
|
||||||
@open-key-modal.window="open = true" @keydown.escape.window="open = false">
|
@open-key-modal.window="open = true" @keydown.escape.window="open = false">
|
||||||
<div class="absolute inset-0 bg-black/30 backdrop-blur-sm" @click="open = false"></div>
|
<div class="absolute inset-0 bg-black/40 backdrop-blur-sm" @click="open = false"></div>
|
||||||
<div class="absolute inset-0 flex items-center justify-center p-4" x-show="open" x-transition>
|
<div class="absolute inset-0 flex items-center justify-center p-4" x-show="open" x-transition>
|
||||||
<div class="bg-white rounded-xl shadow-xl w-full max-w-md p-6" @click.outside="open = false">
|
<div class="bg-white rounded-2xl max-w-md w-full border border-outline-variant/30 shadow-2xl p-6 space-y-4">
|
||||||
<div class="flex items-center justify-between mb-6">
|
<div class="flex justify-between items-center border-b border-outline-variant/30 pb-3">
|
||||||
<h2 class="text-lg font-semibold text-on-surface">Add New Credential</h2>
|
<h3 class="font-bold text-lg text-on-surface">Register Secure Credential</h3>
|
||||||
<button @click="open = false" class="p-1 rounded-lg hover:bg-surface-container-low text-on-surface-variant">
|
<button @click="open = false" class="text-outline hover:text-primary p-1 rounded">Cancel</button>
|
||||||
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"/></svg>
|
|
||||||
</button>
|
|
||||||
</div>
|
</div>
|
||||||
<form hx-post="/keys" hx-target="#key-grid" hx-swap="outerHTML"
|
<form hx-post="/keys" hx-target="#key-grid" hx-swap="outerHTML"
|
||||||
@submit="open = false" class="space-y-4">
|
@submit="open = false" class="space-y-4 text-sm">
|
||||||
<div>
|
<div class="flex flex-col gap-1">
|
||||||
<label class="block text-sm font-medium text-on-surface mb-1">Name</label>
|
<label class="text-xs font-bold text-on-surface-variant">CREDENTIAL NAME / LABEL</label>
|
||||||
<input type="text" name="name" required placeholder="e.g. AWS Prod"
|
<input type="text" name="name" required placeholder="e.g. key_aws_alex"
|
||||||
class="w-full px-3 py-2 rounded-lg border border-outline-variant/50 bg-white text-sm text-on-surface focus:outline-none focus:ring-2 focus:ring-primary/30">
|
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">
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div class="grid grid-cols-2 gap-4">
|
||||||
<label class="block text-sm font-medium text-on-surface mb-1">Username</label>
|
<div class="flex flex-col gap-1">
|
||||||
<input type="text" name="username" required placeholder="e.g. ec2-user"
|
<label class="text-xs font-bold text-on-surface-variant">CREDENTIAL TYPE</label>
|
||||||
class="w-full px-3 py-2 rounded-lg border border-outline-variant/50 bg-white text-sm text-on-surface focus:outline-none focus:ring-2 focus:ring-primary/30">
|
<select name="type"
|
||||||
|
class="bg-surface-container-low border border-outline-variant/40 rounded-lg py-2.5 px-3 focus:outline-none focus:border-primary">
|
||||||
|
<option value="ED25519">ED25519 (Modern)</option>
|
||||||
|
<option value="SSH RSA">SSH RSA (Legacy)</option>
|
||||||
|
<option value="PASSWORD">Master Password</option>
|
||||||
|
<option value="Bearer Token">Bearer Token</option>
|
||||||
|
<option value="AWS Key">AWS Access Key</option>
|
||||||
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div class="flex flex-col gap-1">
|
||||||
<label class="block text-sm font-medium text-on-surface mb-1">URL / Host</label>
|
<label class="text-xs font-bold text-on-surface-variant">LOGIN USERNAME</label>
|
||||||
<input type="text" name="url" required placeholder="e.g. github.com"
|
<input type="text" name="username" required placeholder="e.g. root or ubuntu"
|
||||||
class="w-full px-3 py-2 rounded-lg border border-outline-variant/50 bg-white text-sm text-on-surface focus:outline-none focus:ring-2 focus:ring-primary/30">
|
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 font-medium">
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<label class="block text-sm font-medium text-on-surface mb-1">Passphrase</label>
|
|
||||||
<div class="relative">
|
|
||||||
<input type="password" name="passphrase" required placeholder="Enter passphrase"
|
|
||||||
class="w-full px-3 py-2 rounded-lg border border-outline-variant/50 bg-white text-sm text-on-surface focus:outline-none focus:ring-2 focus:ring-primary/30 pr-10">
|
|
||||||
<button type="button" class="absolute right-2 top-1/2 -translate-y-1/2 p-1 text-on-surface-variant hover:text-on-surface" title="Toggle visibility">
|
|
||||||
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z"/><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"/></svg>
|
|
||||||
</button>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex justify-end gap-3 pt-2">
|
<div class="flex flex-col gap-1">
|
||||||
|
<label class="text-xs font-bold text-on-surface-variant">PASSPHRASE / TOKEN KEY</label>
|
||||||
|
<input type="password" name="passphrase" required placeholder="Enter secure password secret..."
|
||||||
|
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-mono">
|
||||||
|
</div>
|
||||||
|
<div class="pt-4 flex justify-end gap-3 border-t border-outline-variant/20">
|
||||||
<button type="button" @click="open = false"
|
<button type="button" @click="open = false"
|
||||||
class="px-4 py-2 rounded-lg text-sm font-medium text-on-surface-variant hover:bg-surface-container-low transition-colors">Cancel</button>
|
class="px-4 py-2 text-xs font-bold text-outline hover:text-on-surface">Cancel</button>
|
||||||
<button type="submit"
|
<button type="submit"
|
||||||
class="px-4 py-2 rounded-lg text-sm font-medium bg-primary text-white hover:bg-primary/90 transition-colors">Add Key</button>
|
class="bg-primary text-white py-2 px-5 rounded-lg font-bold text-xs shadow-md hover:bg-primary/90 transition-all">Save Credential</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
+216
-168
@@ -12,7 +12,6 @@
|
|||||||
<script src="/static/js/alpine.min.js" defer></script>
|
<script src="/static/js/alpine.min.js" defer></script>
|
||||||
<script src="/static/js/clipboard.js"></script>
|
<script src="/static/js/clipboard.js"></script>
|
||||||
<script src="/static/js/utils.js"></script>
|
<script src="/static/js/utils.js"></script>
|
||||||
<script src="/static/js/toggles.js"></script>
|
|
||||||
</head>
|
</head>
|
||||||
<body class="bg-surface text-on-surface antialiased dot-grid min-h-screen">
|
<body class="bg-surface text-on-surface antialiased dot-grid min-h-screen">
|
||||||
<div class="flex min-h-screen">
|
<div class="flex min-h-screen">
|
||||||
@@ -22,199 +21,248 @@
|
|||||||
<h1 class="text-lg font-semibold text-on-surface">{{.Title}}</h1>
|
<h1 class="text-lg font-semibold text-on-surface">{{.Title}}</h1>
|
||||||
</header>
|
</header>
|
||||||
<main id="main-content" class="flex-1 overflow-auto p-6">
|
<main id="main-content" class="flex-1 overflow-auto p-6">
|
||||||
<div class="max-w-3xl mx-auto space-y-8 pb-16">
|
<div class="max-w-7xl mx-auto space-y-8 text-sm" x-data="{ toast: '', showToast: false, saveSuccess: false }"
|
||||||
|
x-init="$watch('showToast', v => v && setTimeout(() => showToast = false, 3000))">
|
||||||
|
|
||||||
<section>
|
<!-- Toast -->
|
||||||
<h2 class="text-lg font-semibold text-on-surface mb-4">Profile</h2>
|
<div x-show="showToast" x-cloak
|
||||||
<div class="bg-white rounded-xl border border-outline-variant/30 p-6 space-y-4">
|
class="fixed bottom-6 right-6 z-[180] bg-inverse-surface text-inverse-on-surface px-5 py-3.5 rounded-xl shadow-xl flex items-center gap-3 border border-outline/20 animate-slide-in text-xs font-semibold">
|
||||||
<div class="flex items-center gap-4 mb-4">
|
<svg class="w-4 h-4 text-secondary animate-bounce" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"/></svg>
|
||||||
<div class="w-14 h-14 rounded-full bg-tertiary/20 flex items-center justify-center text-tertiary text-xl font-semibold">U</div>
|
<span x-text="toast"></span>
|
||||||
<div>
|
|
||||||
<p class="text-base font-medium text-on-surface">User</p>
|
|
||||||
<p class="text-sm text-on-surface-variant">Local administrator</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="grid grid-cols-2 gap-4">
|
|
||||||
<div>
|
|
||||||
<label class="block text-sm font-medium text-on-surface mb-1">Display Name</label>
|
|
||||||
<input type="text" value="User" readonly
|
|
||||||
class="w-full px-3 py-2 rounded-lg border border-outline-variant/50 bg-surface-container-low/30 text-sm text-on-surface">
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<label class="block text-sm font-medium text-on-surface mb-1">Username</label>
|
|
||||||
<input type="text" value="admin" readonly
|
|
||||||
class="w-full px-3 py-2 rounded-lg border border-outline-variant/50 bg-surface-container-low/30 text-sm text-on-surface">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
|
|
||||||
<section x-data="{ tab: 'appearance' }">
|
|
||||||
<div class="flex gap-1 mb-4 bg-surface-container-low/50 rounded-lg p-1 w-fit">
|
|
||||||
<button @click="tab = 'appearance'" :class="tab === 'appearance' ? 'bg-white shadow-sm text-on-surface' : 'text-on-surface-variant hover:text-on-surface'"
|
|
||||||
class="px-4 py-1.5 rounded-md text-sm font-medium transition-colors">Appearance</button>
|
|
||||||
<button @click="tab = 'terminal'" :class="tab === 'terminal' ? 'bg-white shadow-sm text-on-surface' : 'text-on-surface-variant hover:text-on-surface'"
|
|
||||||
class="px-4 py-1.5 rounded-md text-sm font-medium transition-colors">Terminal</button>
|
|
||||||
<button @click="tab = 'connection'" :class="tab === 'connection' ? 'bg-white shadow-sm text-on-surface' : 'text-on-surface-variant hover:text-on-surface'"
|
|
||||||
class="px-4 py-1.5 rounded-md text-sm font-medium transition-colors">Connection</button>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<form method="post" action="/settings" class="bg-white rounded-xl border border-outline-variant/30 p-6 space-y-5">
|
<!-- Header -->
|
||||||
<div x-show="tab === 'appearance'" x-cloak class="space-y-5">
|
<div class="border-b border-outline-variant/30 pb-4">
|
||||||
<div>
|
<h2 class="text-xl font-bold text-on-surface tracking-tight">Workspace Preferences</h2>
|
||||||
<label class="block text-sm font-medium text-on-surface mb-1">Theme</label>
|
<p class="text-xs text-on-surface-variant mt-0.5">Configure authentication sync protocols and cloud billing</p>
|
||||||
<select name="theme"
|
|
||||||
class="w-full max-w-xs px-3 py-2 rounded-lg border border-outline-variant/50 bg-white text-sm text-on-surface focus:outline-none focus:ring-2 focus:ring-primary/30">
|
|
||||||
<option value="light" {{if eq .Config.Theme "light"}}selected{{end}}>Light</option>
|
|
||||||
<option value="dark" {{if eq .Config.Theme "dark"}}selected{{end}}>Dark (coming soon)</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<label class="block text-sm font-medium text-on-surface mb-1">Font Size</label>
|
|
||||||
<select name="fontSize"
|
|
||||||
class="w-full max-w-xs px-3 py-2 rounded-lg border border-outline-variant/50 bg-white text-sm text-on-surface focus:outline-none focus:ring-2 focus:ring-primary/30">
|
|
||||||
<option value="12" {{if eq .Config.FontSize 12}}selected{{end}}>12px</option>
|
|
||||||
<option value="13" {{if eq .Config.FontSize 13}}selected{{end}}>13px</option>
|
|
||||||
<option value="14" {{if eq .Config.FontSize 14}}selected{{end}}>14px</option>
|
|
||||||
<option value="15" {{if eq .Config.FontSize 15}}selected{{end}}>15px</option>
|
|
||||||
<option value="16" {{if eq .Config.FontSize 16}}selected{{end}}>16px</option>
|
|
||||||
<option value="18" {{if eq .Config.FontSize 18}}selected{{end}}>18px</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div x-show="tab === 'terminal'" x-cloak class="space-y-5">
|
<div class="grid grid-cols-1 lg:grid-cols-12 gap-8">
|
||||||
<div>
|
<!-- Left: profile + toggles -->
|
||||||
<label class="block text-sm font-medium text-on-surface mb-1">Scrollback Lines</label>
|
<div class="lg:col-span-8 space-y-8">
|
||||||
<select name="scrollback"
|
|
||||||
class="w-full max-w-xs px-3 py-2 rounded-lg border border-outline-variant/50 bg-white text-sm text-on-surface focus:outline-none focus:ring-2 focus:ring-primary/30">
|
|
||||||
<option value="1000" {{if eq .Config.Scrollback 1000}}selected{{end}}>1,000</option>
|
|
||||||
<option value="5000" {{if eq .Config.Scrollback 5000}}selected{{end}}>5,000</option>
|
|
||||||
<option value="10000" {{if eq .Config.Scrollback 10000}}selected{{end}}>10,000</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<label class="flex items-center justify-between py-2">
|
|
||||||
<span class="text-sm text-on-surface">Blinking Cursor</span>
|
|
||||||
<button type="button" role="switch"
|
|
||||||
x-data="{ on: {{if .Config.BlinkCursor}}true{{else}}false{{end}} }"
|
|
||||||
@click="on = !on; $el.classList.toggle('active'); $el.nextElementSibling.value = on ? 'on' : 'off'"
|
|
||||||
:class="on ? 'active' : ''"
|
|
||||||
class="toggle-switch" aria-checked="{{if .Config.BlinkCursor}}true{{else}}false{{end}}">
|
|
||||||
<span class="toggle-knob"></span>
|
|
||||||
</button>
|
|
||||||
<input type="hidden" name="blinkCursor" value="{{if .Config.BlinkCursor}}on{{end}}">
|
|
||||||
</label>
|
|
||||||
<label class="flex items-center justify-between py-2">
|
|
||||||
<span class="text-sm text-on-surface">Terminal Bell</span>
|
|
||||||
<button type="button" role="switch"
|
|
||||||
x-data="{ on: {{if .Config.BellEnabled}}true{{else}}false{{end}} }"
|
|
||||||
@click="on = !on; $el.classList.toggle('active'); $el.nextElementSibling.value = on ? 'on' : 'off'"
|
|
||||||
:class="on ? 'active' : ''"
|
|
||||||
class="toggle-switch">
|
|
||||||
<span class="toggle-knob"></span>
|
|
||||||
</button>
|
|
||||||
<input type="hidden" name="bellEnabled" value="{{if .Config.BellEnabled}}on{{end}}">
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div x-show="tab === 'connection'" x-cloak class="space-y-5">
|
<!-- Profile Form -->
|
||||||
<div>
|
<div class="bg-white p-6 rounded-2xl border border-outline-variant/30 shadow-sm space-y-6">
|
||||||
<label class="block text-sm font-medium text-on-surface mb-1">Auto-Lock (minutes)</label>
|
<h3 class="font-bold text-on-surface text-base flex items-center gap-2">
|
||||||
<select name="autoLock"
|
<svg class="w-5 h-5 text-primary" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z"/></svg>
|
||||||
class="w-full max-w-xs px-3 py-2 rounded-lg border border-outline-variant/50 bg-white text-sm text-on-surface focus:outline-none focus:ring-2 focus:ring-primary/30">
|
Developer Profile
|
||||||
<option value="1" {{if eq .Config.AutoLock 1}}selected{{end}}>1 min</option>
|
</h3>
|
||||||
<option value="5" {{if eq .Config.AutoLock 5}}selected{{end}}>5 min</option>
|
<form method="post" action="/settings" class="grid grid-cols-1 sm:grid-cols-2 gap-5">
|
||||||
<option value="15" {{if eq .Config.AutoLock 15}}selected{{end}}>15 min</option>
|
<div class="flex flex-col gap-1.5">
|
||||||
<option value="30" {{if eq .Config.AutoLock 30}}selected{{end}}>30 min</option>
|
<label class="text-xs font-bold text-on-surface-variant">FULL NAME</label>
|
||||||
<option value="0" {{if eq .Config.AutoLock 0}}selected{{end}}>Never</option>
|
<input type="text" name="name" value="User"
|
||||||
</select>
|
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-semibold text-on-surface">
|
||||||
</div>
|
</div>
|
||||||
<label class="flex items-center justify-between py-2">
|
<div class="flex flex-col gap-1.5">
|
||||||
<span class="text-sm text-on-surface">TCP Keepalive</span>
|
<label class="text-xs font-bold text-on-surface-variant">EMAIL ADDRESS</label>
|
||||||
<button type="button" role="switch"
|
<input type="email" name="email" value="user@hostkeeper.io"
|
||||||
x-data="{ on: {{if .Config.Keepalive}}true{{else}}false{{end}} }"
|
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">
|
||||||
@click="on = !on; $el.classList.toggle('active'); $el.nextElementSibling.value = on ? 'on' : 'off'"
|
|
||||||
:class="on ? 'active' : ''"
|
|
||||||
class="toggle-switch">
|
|
||||||
<span class="toggle-knob"></span>
|
|
||||||
</button>
|
|
||||||
<input type="hidden" name="keepalive" value="{{if .Config.Keepalive}}on{{end}}">
|
|
||||||
</label>
|
|
||||||
<label class="flex items-center justify-between py-2">
|
|
||||||
<span class="text-sm text-on-surface">Copy on Select</span>
|
|
||||||
<button type="button" role="switch"
|
|
||||||
x-data="{ on: {{if .Config.CopyOnSelect}}true{{else}}false{{end}} }"
|
|
||||||
@click="on = !on; $el.classList.toggle('active'); $el.nextElementSibling.value = on ? 'on' : 'off'"
|
|
||||||
:class="on ? 'active' : ''"
|
|
||||||
class="toggle-switch">
|
|
||||||
<span class="toggle-knob"></span>
|
|
||||||
</button>
|
|
||||||
<input type="hidden" name="copyOnSelect" value="{{if .Config.CopyOnSelect}}on{{end}}">
|
|
||||||
</label>
|
|
||||||
<label class="flex items-center justify-between py-2">
|
|
||||||
<span class="text-sm text-on-surface">Auto-Reconnect</span>
|
|
||||||
<button type="button" role="switch"
|
|
||||||
x-data="{ on: {{if .Config.AutoReconnect}}true{{else}}false{{end}} }"
|
|
||||||
@click="on = !on; $el.classList.toggle('active'); $el.nextElementSibling.value = on ? 'on' : 'off'"
|
|
||||||
:class="on ? 'active' : ''"
|
|
||||||
class="toggle-switch">
|
|
||||||
<span class="toggle-knob"></span>
|
|
||||||
</button>
|
|
||||||
<input type="hidden" name="autoReconnect" value="{{if .Config.AutoReconnect}}on{{end}}">
|
|
||||||
</label>
|
|
||||||
</div>
|
</div>
|
||||||
|
<div class="flex flex-col gap-1.5 sm:col-span-2">
|
||||||
<div class="flex justify-end pt-2">
|
<label class="text-xs font-bold text-on-surface-variant">WORKPLACE DESIGNATION / ROLE</label>
|
||||||
|
<input type="text" name="role" value="DevOps Engineer"
|
||||||
|
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">
|
||||||
|
</div>
|
||||||
|
<div class="sm:col-span-2 pt-2 flex justify-end">
|
||||||
<button type="submit"
|
<button type="submit"
|
||||||
class="px-4 py-2 rounded-lg text-sm font-medium bg-primary text-white hover:bg-primary/90 transition-colors">Save Settings</button>
|
class="flex items-center gap-2 bg-primary text-white hover:bg-primary/90 font-bold text-xs py-2.5 px-6 rounded-xl shadow-md transition-all">
|
||||||
|
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 7H5a2 2 0 00-2 2v9a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-3m-1 4l-3 3m0 0l-3-3m3 3V4"/></svg>
|
||||||
|
Save Changes
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</section>
|
</div>
|
||||||
|
|
||||||
<section>
|
<!-- Feature Toggles -->
|
||||||
<h2 class="text-lg font-semibold text-on-surface mb-4">Connected Devices</h2>
|
<div class="bg-white p-6 rounded-2xl border border-outline-variant/30 shadow-sm space-y-6">
|
||||||
<div class="bg-white rounded-xl border border-outline-variant/30 divide-y divide-outline-variant/20">
|
<h3 class="font-bold text-on-surface text-base flex items-center gap-2">
|
||||||
|
<svg class="w-5 h-5 text-primary" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z"/></svg>
|
||||||
|
Security & Transmission Protocols
|
||||||
|
</h3>
|
||||||
|
<div class="space-y-4 divide-y divide-outline-variant/20">
|
||||||
|
<label class="flex items-center justify-between py-3">
|
||||||
|
<div class="space-y-0.5 pr-4">
|
||||||
|
<h4 class="font-bold text-on-surface text-xs sm:text-sm">Cryptographic Keychain Backup</h4>
|
||||||
|
<p class="text-xs text-on-surface-variant">Synchronize securely encrypted keys automatically inside iCloud/Google drive sandboxes.</p>
|
||||||
|
</div>
|
||||||
|
<button type="button" role="switch"
|
||||||
|
x-data="{ on: true }"
|
||||||
|
@click="on = !on; $el.classList.toggle('active')"
|
||||||
|
:class="on ? 'active' : ''"
|
||||||
|
class="toggle-switch" style="width:44px;height:24px">
|
||||||
|
<span class="toggle-knob"></span>
|
||||||
|
</button>
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<label class="flex items-center justify-between pt-3">
|
||||||
|
<div class="space-y-0.5 pr-4">
|
||||||
|
<h4 class="font-bold text-on-surface text-xs sm:text-sm">Real-time SFTP Connection Polling</h4>
|
||||||
|
<p class="text-xs text-on-surface-variant">Enable background file watchers to automatically refresh the directory tree upon local file modifications.</p>
|
||||||
|
</div>
|
||||||
|
<button type="button" role="switch"
|
||||||
|
x-data="{ on: true }"
|
||||||
|
@click="on = !on; $el.classList.toggle('active')"
|
||||||
|
:class="on ? 'active' : ''"
|
||||||
|
class="toggle-switch" style="width:44px;height:24px">
|
||||||
|
<span class="toggle-knob"></span>
|
||||||
|
</button>
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<label class="flex items-center justify-between pt-3">
|
||||||
|
<div class="space-y-0.5 pr-4">
|
||||||
|
<h4 class="font-bold text-on-surface text-xs sm:text-sm">Desktop Push Notifications</h4>
|
||||||
|
<p class="text-xs text-on-surface-variant">Trigger native system indicators upon complete transmissions of download/upload streams.</p>
|
||||||
|
</div>
|
||||||
|
<button type="button" role="switch"
|
||||||
|
x-data="{ on: false }"
|
||||||
|
@click="on = !on; $el.classList.toggle('active')"
|
||||||
|
:class="on ? 'active' : ''"
|
||||||
|
class="toggle-switch" style="width:44px;height:24px">
|
||||||
|
<span class="toggle-knob"></span>
|
||||||
|
</button>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Terminal Settings -->
|
||||||
|
<div class="bg-white p-6 rounded-2xl border border-outline-variant/30 shadow-sm space-y-6">
|
||||||
|
<h3 class="font-bold text-on-surface text-base flex items-center gap-2">
|
||||||
|
<svg class="w-5 h-5 text-primary" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 9l3 3-3 3m5 0h3M5 20h14a2 2 0 002-2V6a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"/></svg>
|
||||||
|
Terminal Preferences
|
||||||
|
</h3>
|
||||||
|
<form method="post" action="/settings" class="space-y-5">
|
||||||
|
<div class="grid grid-cols-2 gap-4">
|
||||||
|
<div class="flex flex-col gap-1">
|
||||||
|
<label class="text-xs font-bold text-on-surface-variant">FONT SIZE</label>
|
||||||
|
<select name="fontSize"
|
||||||
|
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">
|
||||||
|
<option value="12">12px</option>
|
||||||
|
<option value="13">13px</option>
|
||||||
|
<option value="14" selected>14px</option>
|
||||||
|
<option value="15">15px</option>
|
||||||
|
<option value="16">16px</option>
|
||||||
|
<option value="18">18px</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="flex flex-col gap-1">
|
||||||
|
<label class="text-xs font-bold text-on-surface-variant">SCROLLBACK</label>
|
||||||
|
<select name="scrollback"
|
||||||
|
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">
|
||||||
|
<option value="1000">1,000</option>
|
||||||
|
<option value="5000" selected>5,000</option>
|
||||||
|
<option value="10000">10,000</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<label class="flex items-center justify-between py-2">
|
||||||
|
<span class="text-sm font-medium text-on-surface">Blinking Cursor</span>
|
||||||
|
<button type="button" role="switch"
|
||||||
|
x-data="{ on: true }"
|
||||||
|
@click="on = !on; $el.classList.toggle('active')"
|
||||||
|
:class="on ? 'active' : ''"
|
||||||
|
class="toggle-switch" style="width:44px;height:24px">
|
||||||
|
<span class="toggle-knob"></span>
|
||||||
|
</button>
|
||||||
|
</label>
|
||||||
|
<label class="flex items-center justify-between py-2">
|
||||||
|
<span class="text-sm font-medium text-on-surface">Terminal Bell</span>
|
||||||
|
<button type="button" role="switch"
|
||||||
|
x-data="{ on: false }"
|
||||||
|
@click="on = !on; $el.classList.toggle('active')"
|
||||||
|
:class="on ? 'active' : ''"
|
||||||
|
class="toggle-switch" style="width:44px;height:24px">
|
||||||
|
<span class="toggle-knob"></span>
|
||||||
|
</button>
|
||||||
|
</label>
|
||||||
|
<label class="flex items-center justify-between py-2">
|
||||||
|
<span class="text-sm font-medium text-on-surface">Auto-Reconnect</span>
|
||||||
|
<button type="button" role="switch"
|
||||||
|
x-data="{ on: true }"
|
||||||
|
@click="on = !on; $el.classList.toggle('active')"
|
||||||
|
:class="on ? 'active' : ''"
|
||||||
|
class="toggle-switch" style="width:44px;height:24px">
|
||||||
|
<span class="toggle-knob"></span>
|
||||||
|
</button>
|
||||||
|
</label>
|
||||||
|
<div class="pt-2 flex justify-end">
|
||||||
|
<button type="submit"
|
||||||
|
class="bg-primary text-white py-2 px-6 rounded-xl font-bold text-xs shadow-md hover:bg-primary/90 transition-all">Save Settings</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Right: billing + devices + danger -->
|
||||||
|
<div class="lg:col-span-4 space-y-8">
|
||||||
|
|
||||||
|
<!-- Billing Card -->
|
||||||
|
<div class="bg-primary text-on-primary p-6 rounded-2xl shadow-lg relative overflow-hidden flex flex-col justify-between h-48">
|
||||||
|
<div class="relative z-10">
|
||||||
|
<div class="flex justify-between items-start">
|
||||||
|
<span class="px-2.5 py-1 bg-white/20 rounded-full font-bold text-[9px] uppercase tracking-wider text-white">HostKeeper Pro</span>
|
||||||
|
<svg class="w-5 h-5 text-white fill-white" viewBox="0 0 24 24"><path d="M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z"/></svg>
|
||||||
|
</div>
|
||||||
|
<h3 class="font-black text-2xl tracking-tight mt-3">Active Workspace</h3>
|
||||||
|
</div>
|
||||||
|
<div class="relative z-10 flex justify-between items-end">
|
||||||
|
<div>
|
||||||
|
<span class="text-xs opacity-80 uppercase font-semibold">RENEWAL CYCLE</span>
|
||||||
|
<p class="text-xs font-bold text-white">July 2026</p>
|
||||||
|
</div>
|
||||||
|
<span class="text-[10px] font-bold bg-white text-primary rounded-lg px-2.5 py-1 flex items-center gap-1">
|
||||||
|
<svg class="w-3.5 h-3.5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7"/></svg>
|
||||||
|
PAID ACCOUNT
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<div class="absolute right-0 bottom-0 opacity-10 pointer-events-none">
|
||||||
|
<svg class="w-48 h-48 -rotate-45" viewBox="0 0 24 24" fill="currentColor"><path d="M13 10V3L4 14h7v7l9-11h-7z"/></svg>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Devices -->
|
||||||
|
<div class="bg-white p-5 rounded-2xl border border-outline-variant/30 shadow-sm space-y-4">
|
||||||
|
<h3 class="font-bold text-on-surface text-sm flex items-center gap-2">
|
||||||
|
<svg class="w-4 h-4 text-primary" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 18h.01M8 21h8a2 2 0 002-2V5a2 2 0 00-2-2H8a2 2 0 00-2 2v14a2 2 0 002 2z"/></svg>
|
||||||
|
Synchronized Devices
|
||||||
|
</h3>
|
||||||
|
<div class="space-y-3.5">
|
||||||
{{range .Devices}}
|
{{range .Devices}}
|
||||||
<div class="flex items-center gap-4 px-6 py-4">
|
<div class="flex items-center justify-between text-xs">
|
||||||
<div class="w-8 h-8 rounded-lg bg-tertiary/10 text-tertiary flex items-center justify-center shrink-0">
|
<div class="flex items-center gap-2.5 min-w-0">
|
||||||
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
<div class="p-1.5 bg-surface-container-low border border-outline-variant/20 rounded-lg shrink-0">
|
||||||
|
<svg class="w-4 h-4 {{if eq .Type "desktop"}}text-primary{{else}}text-outline{{end}}" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||||
{{if eq .Type "desktop"}}<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9.75 17L9 20l-1 1h8l-1-1-.75-3M3 13h18M5 17h14a2 2 0 002-2V5a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"/>{{end}}
|
{{if eq .Type "desktop"}}<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9.75 17L9 20l-1 1h8l-1-1-.75-3M3 13h18M5 17h14a2 2 0 002-2V5a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"/>{{end}}
|
||||||
{{if eq .Type "mobile"}}<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 18h.01M8 21h8a2 2 0 002-2V5a2 2 0 00-2-2H8a2 2 0 00-2 2v14a2 2 0 002 2z"/>{{end}}
|
{{if eq .Type "mobile"}}<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 18h.01M8 21h8a2 2 0 002-2V5a2 2 0 00-2-2H8a2 2 0 00-2 2v14a2 2 0 002 2z"/>{{end}}
|
||||||
{{if eq .Type "tablet"}}<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 18h.01M7 21h10a2 2 0 002-2V5a2 2 0 00-2-2H7a2 2 0 00-2 2v14a2 2 0 002 2z"/>{{end}}
|
{{if eq .Type "tablet"}}<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 18h.01M7 21h10a2 2 0 002-2V5a2 2 0 00-2-2H7a2 2 0 00-2 2v14a2 2 0 002 2z"/>{{end}}
|
||||||
</svg>
|
</svg>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex-1 min-w-0">
|
<span class="font-bold text-on-surface truncate pr-2">{{.Name}}</span>
|
||||||
<div class="flex items-center gap-2">
|
|
||||||
<p class="text-sm font-medium text-on-surface">{{.Name}}</p>
|
|
||||||
{{if .Current}}<span class="text-xs font-medium px-1.5 py-0.5 rounded-full bg-secondary/10 text-secondary">Current</span>{{end}}
|
|
||||||
</div>
|
</div>
|
||||||
<p class="text-xs text-on-surface-variant">{{.OS}} · {{.LastSeen}}</p>
|
<span class="px-2 py-0.5 rounded-full text-[9px] font-bold uppercase tracking-wider flex items-center gap-1 shrink-0 {{if .Current}}bg-secondary/10 text-secondary{{else}}bg-surface-container text-outline{{end}}">
|
||||||
</div>
|
<span class="w-1 h-1 rounded-full {{if .Current}}bg-secondary animate-pulse{{else}}bg-outline{{end}}"></span>
|
||||||
<button class="text-xs font-medium text-red-500 hover:text-red-600 transition-colors">Remove</button>
|
{{if .Current}}Online{{else}}Offline{{end}}
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
{{end}}
|
{{end}}
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</div>
|
||||||
|
|
||||||
<section x-data="{ confirm: false }">
|
<!-- Danger Zone -->
|
||||||
<h2 class="text-lg font-semibold text-red-600 mb-4">Danger Zone</h2>
|
<div class="p-4 border border-error-container/40 rounded-2xl bg-error-container/5 space-y-3 text-xs" x-data="{ confirm: false }">
|
||||||
<div class="bg-white rounded-xl border border-red-200 p-6">
|
<h4 class="font-bold text-error flex items-center gap-2">
|
||||||
<p class="text-sm text-on-surface-variant mb-4">This will permanently delete all your data, including hosts, keys, snippets, and settings. This action cannot be undone.</p>
|
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M17 16l4-4m0 0l-4-4m4 4H7m6 4v1a3 3 0 01-3 3H6a3 3 0 01-3-3V7a3 3 0 013-3h4a3 3 0 013 3v1"/></svg>
|
||||||
<div x-show="!confirm">
|
Reset Local State
|
||||||
<button @click="confirm = true"
|
</h4>
|
||||||
class="px-4 py-2 rounded-lg text-sm font-medium bg-red-500 text-white hover:bg-red-600 transition-colors">Reset All Data</button>
|
<p class="text-on-surface-variant">Resetting will clear all your locally loaded keystores, snippets, and connection cache buffers from the browser storage.</p>
|
||||||
|
<button @click="if(confirm('Are you sure you want to flush all local storage configurations?')) { localStorage.clear(); alert('Workspace storage cleared successfully.'); window.location.reload(); }"
|
||||||
|
class="w-full py-2 border border-error/30 rounded-xl font-bold text-error hover:bg-error/10 transition-colors">
|
||||||
|
Flush All App State
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div x-show="confirm" x-cloak class="flex items-center gap-3">
|
|
||||||
<p class="text-sm font-medium text-red-600">Are you sure?</p>
|
|
||||||
<button @click="localStorage.clear(); confirm = false; alert('Data cleared')"
|
|
||||||
class="px-4 py-2 rounded-lg text-sm font-medium bg-red-500 text-white hover:bg-red-600 transition-colors">Yes, Delete Everything</button>
|
|
||||||
<button @click="confirm = false"
|
|
||||||
class="px-4 py-2 rounded-lg text-sm font-medium text-on-surface-variant hover:bg-surface-container-low transition-colors">Cancel</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</main>
|
</main>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
+94
-58
@@ -19,102 +19,138 @@
|
|||||||
<h1 class="text-lg font-semibold text-on-surface">{{.Title}}</h1>
|
<h1 class="text-lg font-semibold text-on-surface">{{.Title}}</h1>
|
||||||
</header>
|
</header>
|
||||||
<main id="main-content" class="flex-1 overflow-auto p-6">
|
<main id="main-content" class="flex-1 overflow-auto p-6">
|
||||||
<div id="sftp-page" class="max-w-7xl mx-auto"
|
<div id="sftp-page" class="max-w-7xl mx-auto space-y-6 relative"
|
||||||
x-data="{ toast: '', showToast: false, showFolderModal: false, folderPane: 'local' }"
|
x-data="{ toast: '', showToast: false, showFolderModal: false, folderPane: 'local' }"
|
||||||
x-init="$watch('showToast', v => v && setTimeout(() => showToast = false, 3500))">
|
x-init="$watch('showToast', v => v && setTimeout(() => showToast = false, 3500))">
|
||||||
|
|
||||||
<div class="grid grid-cols-1 lg:grid-cols-2 gap-6">
|
<!-- Toast -->
|
||||||
<!-- Local pane -->
|
<div x-show="showToast" x-cloak
|
||||||
<div class="rounded-xl bg-white/70 backdrop-blur-md border border-outline-variant/30 overflow-hidden">
|
class="fixed bottom-6 right-6 z-[180] bg-inverse-surface text-inverse-on-surface px-5 py-3.5 rounded-xl shadow-xl flex items-center gap-3 border border-outline/20 animate-slide-in text-xs font-semibold">
|
||||||
<div class="flex items-center gap-2 px-4 py-3 border-b border-outline-variant/20 bg-white/50">
|
<svg class="w-4 h-4 text-secondary animate-bounce" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"/></svg>
|
||||||
<svg class="w-4 h-4 text-on-surface-variant" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2z"/></svg>
|
<span x-text="toast"></span>
|
||||||
<span class="text-sm font-medium text-on-surface">Local Workstation</span>
|
</div>
|
||||||
<div class="flex-1"></div>
|
|
||||||
<button @click="folderPane = 'local'; showFolderModal = true"
|
<!-- Header Panel -->
|
||||||
class="p-1 rounded-lg hover:bg-surface-container-low text-on-surface-variant hover:text-on-surface transition-colors" title="New Folder">
|
<div class="flex flex-col sm:flex-row sm:items-center justify-between gap-4 border-b border-outline-variant/30 pb-4">
|
||||||
|
<div>
|
||||||
|
<h2 class="text-xl font-bold text-on-surface tracking-tight">SFTP Secure File Sync</h2>
|
||||||
|
<p class="text-xs text-on-surface-variant mt-0.5">Dual streams for real-time asset transmission and file editing</p>
|
||||||
|
</div>
|
||||||
|
<div class="flex items-center gap-2">
|
||||||
|
<button hx-get="/sftp" hx-target="#main-content"
|
||||||
|
class="flex items-center gap-2 px-3 py-1.5 rounded-lg border border-outline-variant/30 hover:border-primary text-xs font-semibold text-on-surface bg-white transition-all hover:bg-surface-container">
|
||||||
|
<svg class="w-3.5 h-3.5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"/></svg>
|
||||||
|
Reset State
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Dual Panel Body -->
|
||||||
|
<div class="grid grid-cols-1 lg:grid-cols-2 gap-8">
|
||||||
|
|
||||||
|
<!-- Local Pane -->
|
||||||
|
<div class="bg-white rounded-2xl border border-outline-variant/30 overflow-hidden shadow-sm flex flex-col h-[520px]">
|
||||||
|
<div class="p-4 border-b border-outline-variant/50 bg-surface-container-low flex items-center justify-between">
|
||||||
|
<div class="flex items-center gap-2 min-w-0">
|
||||||
|
<svg class="w-4 h-4 text-outline shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2z"/></svg>
|
||||||
|
<span class="font-bold text-xs text-on-surface truncate uppercase tracking-wider">Local Workstation</span>
|
||||||
|
</div>
|
||||||
|
<button @click="$dispatch('open-folder-modal', { pane: 'local' })"
|
||||||
|
class="text-primary hover:text-primary/80 p-1 rounded hover:bg-primary/5 transition-all" title="New Local Folder">
|
||||||
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 13h6m-3-3v6m-5-8H5a2 2 0 00-2 2v8a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2v2"/></svg>
|
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 13h6m-3-3v6m-5-8H5a2 2 0 00-2 2v8a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2v2"/></svg>
|
||||||
</button>
|
</button>
|
||||||
<input type="search" placeholder="Filter files..." hx-get="/sftp/pane?pane=local&q=..." hx-trigger="keyup delay:200ms" hx-target="#local-pane"
|
|
||||||
class="w-40 px-2 py-1 rounded-lg border border-outline-variant/30 bg-white text-xs text-on-surface placeholder-on-surface-variant focus:outline-none focus:ring-2 focus:ring-primary/30">
|
|
||||||
</div>
|
</div>
|
||||||
<div class="flex items-center gap-1 px-4 py-2 border-b border-outline-variant/10 text-xs text-on-surface-variant font-mono bg-surface-container-low/30">
|
|
||||||
|
<!-- Breadcrumb -->
|
||||||
|
<div class="px-4 py-2 border-b border-outline-variant/20 bg-surface-container-lowest flex items-center gap-1.5 text-xs text-outline font-mono overflow-x-auto">
|
||||||
{{range .LocalBreadcrumb}}
|
{{range .LocalBreadcrumb}}
|
||||||
<a href="#" hx-get="/sftp/pane?pane=local&dir={{.Path}}" hx-target="#local-pane"
|
<a href="#" hx-get="/sftp/pane?pane=local&dir={{.Path}}" hx-target="#local-pane"
|
||||||
class="hover:text-primary transition-colors">{{.Name}}</a>
|
class="text-primary hover:underline cursor-pointer">{{.Name}}</a>
|
||||||
<span class="text-on-surface-variant/40">/</span>
|
<svg class="w-3 h-3 text-outline/40 shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5l7 7-7 7"/></svg>
|
||||||
{{end}}
|
{{end}}
|
||||||
</div>
|
</div>
|
||||||
<div id="local-pane">
|
|
||||||
|
<!-- Search -->
|
||||||
|
<div class="p-3 border-b border-outline-variant/10 relative">
|
||||||
|
<svg class="absolute left-6 top-1/2 -translate-y-1/2 text-outline w-3.5 h-3.5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"/></svg>
|
||||||
|
<input type="search" name="q" placeholder="Filter local files..."
|
||||||
|
hx-get="/sftp/pane?pane=local" hx-trigger="keyup delay:200ms" hx-target="#local-pane"
|
||||||
|
class="w-full bg-surface-container-low pl-10 pr-4 py-1.5 border border-outline-variant/30 rounded-lg text-xs font-medium focus:outline-none focus:border-primary focus:bg-white">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="local-pane" class="flex-1 overflow-y-auto min-h-0">
|
||||||
{{template "sftp_pane" dict "Pane" "local" "Files" .LocalFiles "Breadcrumb" .LocalBreadcrumb}}
|
{{template "sftp_pane" dict "Pane" "local" "Files" .LocalFiles "Breadcrumb" .LocalBreadcrumb}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Remote pane -->
|
<!-- Remote Pane -->
|
||||||
<div class="rounded-xl bg-white/70 backdrop-blur-md border border-outline-variant/30 overflow-hidden">
|
<div class="bg-white rounded-2xl border border-outline-variant/30 overflow-hidden shadow-sm flex flex-col h-[520px]">
|
||||||
<div class="flex items-center gap-2 px-4 py-3 border-b border-outline-variant/20 bg-white/50">
|
<div class="p-4 border-b border-outline-variant/50 bg-surface-container-low flex items-center justify-between">
|
||||||
<svg class="w-4 h-4 text-on-surface-variant" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 12a9 9 0 01-9 9m9-9a9 9 0 00-9-9m9 9H3m9 9a9 9 0 01-9-9m9 9c1.657 0 3-4.03 3-9s-1.343-9-3-9m0 18c-1.657 0-3-4.03-3-9s1.343-9 3-9m-9 9a9 9 0 019-9"/></svg>
|
<div class="flex items-center gap-2 min-w-0">
|
||||||
<span class="text-sm font-medium text-on-surface">Remote Cluster Node</span>
|
<svg class="w-4 h-4 text-primary shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 12a9 9 0 01-9 9m9-9a9 9 0 00-9-9m9 9H3m9 9a9 9 0 01-9-9m9 9c1.657 0 3-4.03 3-9s-1.343-9-3-9m0 18c-1.657 0-3-4.03-3-9s1.343-9 3-9m-9 9a9 9 0 019-9"/></svg>
|
||||||
<div class="flex-1"></div>
|
<span class="font-bold text-xs text-on-surface truncate uppercase tracking-wider">Remote Cluster Node</span>
|
||||||
<button @click="folderPane = 'remote'; showFolderModal = true"
|
</div>
|
||||||
class="p-1 rounded-lg hover:bg-surface-container-low text-on-surface-variant hover:text-on-surface transition-colors" title="New Folder">
|
<button @click="$dispatch('open-folder-modal', { pane: 'remote' })"
|
||||||
|
class="text-primary hover:text-primary/80 p-1 rounded hover:bg-primary/5 transition-all" title="New Remote Folder">
|
||||||
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 13h6m-3-3v6m-5-8H5a2 2 0 00-2 2v8a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2v2"/></svg>
|
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 13h6m-3-3v6m-5-8H5a2 2 0 00-2 2v8a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2v2"/></svg>
|
||||||
</button>
|
</button>
|
||||||
<input type="search" placeholder="Filter files..." hx-get="/sftp/pane?pane=remote&q=..." hx-trigger="keyup delay:200ms" hx-target="#remote-pane"
|
|
||||||
class="w-40 px-2 py-1 rounded-lg border border-outline-variant/30 bg-white text-xs text-on-surface placeholder-on-surface-variant focus:outline-none focus:ring-2 focus:ring-primary/30">
|
|
||||||
</div>
|
</div>
|
||||||
<div class="flex items-center gap-1 px-4 py-2 border-b border-outline-variant/10 text-xs text-on-surface-variant font-mono bg-surface-container-low/30">
|
|
||||||
|
<!-- Breadcrumb -->
|
||||||
|
<div class="px-4 py-2 border-b border-outline-variant/20 bg-surface-container-lowest flex items-center gap-1.5 text-xs text-outline font-mono overflow-x-auto">
|
||||||
{{range .RemoteBreadcrumb}}
|
{{range .RemoteBreadcrumb}}
|
||||||
<a href="#" hx-get="/sftp/pane?pane=remote&dir={{.Path}}" hx-target="#remote-pane"
|
<a href="#" hx-get="/sftp/pane?pane=remote&dir={{.Path}}" hx-target="#remote-pane"
|
||||||
class="hover:text-primary transition-colors">{{.Name}}</a>
|
class="text-primary hover:underline cursor-pointer">{{.Name}}</a>
|
||||||
<span class="text-on-surface-variant/40">/</span>
|
<svg class="w-3 h-3 text-outline/40 shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5l7 7-7 7"/></svg>
|
||||||
{{end}}
|
{{end}}
|
||||||
</div>
|
</div>
|
||||||
<div id="remote-pane">
|
|
||||||
|
<!-- Search -->
|
||||||
|
<div class="p-3 border-b border-outline-variant/10 relative">
|
||||||
|
<svg class="absolute left-6 top-1/2 -translate-y-1/2 text-outline w-3.5 h-3.5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"/></svg>
|
||||||
|
<input type="search" name="q" placeholder="Filter remote files..."
|
||||||
|
hx-get="/sftp/pane?pane=remote" hx-trigger="keyup delay:200ms" hx-target="#remote-pane"
|
||||||
|
class="w-full bg-surface-container-low pl-10 pr-4 py-1.5 border border-outline-variant/30 rounded-lg text-xs font-medium focus:outline-none focus:border-primary focus:bg-white">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="remote-pane" class="flex-1 overflow-y-auto min-h-0">
|
||||||
{{template "sftp_pane" dict "Pane" "remote" "Files" .RemoteFiles "Breadcrumb" .RemoteBreadcrumb}}
|
{{template "sftp_pane" dict "Pane" "remote" "Files" .RemoteFiles "Breadcrumb" .RemoteBreadcrumb}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Drop zone -->
|
<!-- Drop Zone -->
|
||||||
<div class="mt-6 rounded-xl border-2 border-dashed border-outline-variant/30 p-8 flex flex-col items-center justify-center text-on-surface-variant/50 hover:border-primary/30 hover:text-primary/50 transition-colors cursor-pointer">
|
<div class="p-8 border-2 border-dashed border-outline-variant/40 rounded-2xl text-center bg-white/40 flex flex-col items-center justify-center space-y-2 relative group hover:border-primary transition-colors cursor-pointer">
|
||||||
<svg class="w-10 h-10 mb-3" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M7 16a4 4 0 01-.88-7.903A5 5 0 1115.9 6L16 6a5 5 0 011 9.9M15 13l-3-3m0 0l-3 3m3-3v12"/></svg>
|
<svg class="w-10 h-10 text-outline group-hover:text-primary group-hover:scale-110 transition-transform" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 7h12m0 0l-4-4m4 4l-4 4m0 6H4m0 0l4 4m-4-4l4-4"/></svg>
|
||||||
<p class="text-sm font-medium">Drop files here to upload</p>
|
<h3 class="font-bold text-sm text-on-surface">Drag files directly here to start batch upload</h3>
|
||||||
<p class="text-xs mt-1">or click to browse</p>
|
<p class="text-xs text-on-surface-variant max-w-sm">
|
||||||
|
Files are automatically split into parallel streams of 5MB chunks and secured with AES-256 keychain keys.
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Toast -->
|
<!-- Folder Modal -->
|
||||||
<div x-show="showToast" x-cloak
|
|
||||||
x-text="toast"
|
|
||||||
class="fixed bottom-6 right-6 bg-[#191c1e] text-white px-4 py-3 rounded-xl text-sm shadow-lg z-50 animate-slide-in"
|
|
||||||
style="max-width: 360px;">
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Folder create modal -->
|
|
||||||
<div id="folder-modal" class="fixed inset-0 z-50" x-data="{ open: false }" x-show="open" x-cloak
|
<div id="folder-modal" class="fixed inset-0 z-50" x-data="{ open: false }" x-show="open" x-cloak
|
||||||
@open-folder-modal.window="open = true; folderPane = $event.detail.pane" @keydown.escape.window="open = false">
|
@open-folder-modal.window="open = true; folderPane = $event.detail.pane" @keydown.escape.window="open = false">
|
||||||
<div class="absolute inset-0 bg-black/30 backdrop-blur-sm" @click="open = false"></div>
|
<div class="absolute inset-0 bg-black/40 backdrop-blur-sm" @click="open = false"></div>
|
||||||
<div class="absolute inset-0 flex items-center justify-center p-4" x-show="open" x-transition>
|
<div class="absolute inset-0 flex items-center justify-center p-4" x-show="open" x-transition>
|
||||||
<div class="bg-white rounded-xl shadow-xl w-full max-w-sm p-6" @click.outside="open = false">
|
<div class="bg-white rounded-2xl max-w-sm w-full border border-outline-variant/30 shadow-2xl p-6 space-y-4">
|
||||||
<div class="flex items-center justify-between mb-6">
|
<div class="flex justify-between items-center border-b border-outline-variant/30 pb-3">
|
||||||
<h2 class="text-lg font-semibold text-on-surface">New Folder</h2>
|
<h3 class="font-bold text-lg text-on-surface">New Folder</h3>
|
||||||
<button @click="open = false" class="p-1 rounded-lg hover:bg-surface-container-low text-on-surface-variant">
|
<button @click="open = false" class="text-outline hover:text-primary p-1 rounded">Cancel</button>
|
||||||
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"/></svg>
|
|
||||||
</button>
|
|
||||||
</div>
|
</div>
|
||||||
<form hx-post="/sftp/mkdir" hx-target="#local-pane" hx-swap="outerHTML"
|
<form hx-post="/sftp/mkdir" hx-target="#local-pane" hx-swap="outerHTML"
|
||||||
@submit="open = false"
|
@submit="open = false" class="space-y-4 text-sm">
|
||||||
class="space-y-4">
|
|
||||||
<input type="hidden" name="pane" :value="folderPane">
|
<input type="hidden" name="pane" :value="folderPane">
|
||||||
<div>
|
<div class="flex flex-col gap-1">
|
||||||
<label class="block text-sm font-medium text-on-surface mb-1">Folder Name</label>
|
<label class="text-xs font-bold text-on-surface-variant">FOLDER NAME</label>
|
||||||
<input type="text" name="name" required placeholder="e.g. new-project"
|
<input type="text" name="name" required placeholder="e.g. new-project"
|
||||||
class="w-full px-3 py-2 rounded-lg border border-outline-variant/50 bg-white text-sm text-on-surface focus:outline-none focus:ring-2 focus:ring-primary/30">
|
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">
|
||||||
</div>
|
</div>
|
||||||
<div class="flex justify-end gap-3 pt-2">
|
<div class="pt-4 flex justify-end gap-3 border-t border-outline-variant/20">
|
||||||
<button type="button" @click="open = false"
|
<button type="button" @click="open = false"
|
||||||
class="px-4 py-2 rounded-lg text-sm font-medium text-on-surface-variant hover:bg-surface-container-low transition-colors">Cancel</button>
|
class="px-4 py-2 text-xs font-bold text-outline hover:text-on-surface">Cancel</button>
|
||||||
<button type="submit"
|
<button type="submit"
|
||||||
class="px-4 py-2 rounded-lg text-sm font-medium bg-primary text-white hover:bg-primary/90 transition-colors">Create</button>
|
class="bg-primary text-white py-2 px-5 rounded-lg font-bold text-xs shadow-md hover:bg-primary/90 transition-all">Create Folder</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,10 +1,22 @@
|
|||||||
{{define "sftp_pane"}}
|
{{define "sftp_pane"}}
|
||||||
<div class="file-table" id="{{.Pane}}-pane-content" x-data="{ pane: '{{.Pane}}' }">
|
<div id="{{.Pane}}-pane-content" x-data="{ pane: '{{.Pane}}' }">
|
||||||
|
<table class="w-full text-left border-collapse text-xs">
|
||||||
|
<thead>
|
||||||
|
<tr class="border-b border-outline-variant/20 text-outline uppercase tracking-wider font-bold">
|
||||||
|
<th class="py-2.5 px-4 font-semibold text-[10px]">Name</th>
|
||||||
|
<th class="py-2.5 px-4 font-semibold text-[10px] text-right">Size</th>
|
||||||
|
<th class="py-2.5 px-4 font-semibold text-[10px] text-right">Modified</th>
|
||||||
|
<th class="py-2.5 px-4 font-semibold text-[10px]"></th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
{{range .Files}}
|
{{range .Files}}
|
||||||
<div class="file-table-row group transition-colors">
|
<tr class="border-b border-outline-variant/10 hover:bg-primary/5 transition-colors group cursor-pointer"
|
||||||
<div class="flex items-center gap-3">
|
hx-get="/sftp/pane?pane={{$.Pane}}&dir={{.Name}}" hx-target="#{{$.Pane}}-pane-content" hx-swap="outerHTML">
|
||||||
<span class="w-4 h-4 shrink-0 flex items-center justify-center
|
<td class="py-2.5 px-4">
|
||||||
{{if eq .Type "folder"}}text-yellow-500{{else if eq .Type "code"}}text-purple-500{{else if eq .Type "image"}}text-secondary{{else if eq .Type "lock"}}text-red-400{{else}}text-on-surface-variant/50{{end}}">
|
<div class="font-semibold text-on-surface flex items-center gap-2.5 max-w-[180px] cursor-pointer">
|
||||||
|
<span class="shrink-0
|
||||||
|
{{if eq .Type "folder"}}text-yellow-500{{else if eq .Type "code"}}text-purple-500{{else if eq .Type "image"}}text-secondary{{else if eq .Type "lock"}}text-red-400{{else}}text-outline/50{{end}}">
|
||||||
{{if eq .Type "folder"}}
|
{{if eq .Type "folder"}}
|
||||||
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2z"/></svg>
|
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2z"/></svg>
|
||||||
{{else if eq .Type "code"}}
|
{{else if eq .Type "code"}}
|
||||||
@@ -17,35 +29,49 @@
|
|||||||
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"/></svg>
|
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"/></svg>
|
||||||
{{end}}
|
{{end}}
|
||||||
</span>
|
</span>
|
||||||
<span class="text-sm text-on-surface truncate">{{.Name}}</span>
|
<span class="truncate group-hover:text-primary transition-colors">{{.Name}}</span>
|
||||||
</div>
|
</div>
|
||||||
<span class="text-xs text-on-surface-variant text-right tabular-nums w-20 shrink-0">{{.Size}}</span>
|
</td>
|
||||||
<span class="text-xs text-on-surface-variant w-24 shrink-0">{{.Modified}}</span>
|
<td class="py-2.5 px-4 text-right text-on-surface-variant font-mono">{{.Size}}</td>
|
||||||
<span class="text-xs text-on-surface-variant font-mono w-24 shrink-0 hidden md:inline">{{.Permissions}}</span>
|
<td class="py-2.5 px-4 text-right text-outline">{{.Modified}}</td>
|
||||||
<div class="flex gap-1 opacity-0 group-hover:opacity-100 transition-opacity shrink-0">
|
<td class="py-2.5 px-4 text-right" @click.stop>
|
||||||
|
<div class="flex items-center justify-end gap-1.5 opacity-0 group-hover:opacity-100 transition-opacity">
|
||||||
{{if ne .Type "folder"}}
|
{{if ne .Type "folder"}}
|
||||||
<button @click="document.querySelector('#sftp-page').__x.$data.toast = 'Downloading {{.Name}}...'; document.querySelector('#sftp-page').__x.$data.showToast = true"
|
{{if eq $.Pane "local"}}
|
||||||
class="p-1 rounded-lg hover:bg-primary/10 text-on-surface-variant hover:text-primary transition-colors" title="Download">
|
|
||||||
<svg class="w-3.5 h-3.5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 10v6m0 0l-3-3m3 3l3-3m2 8H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"/></svg>
|
|
||||||
</button>
|
|
||||||
<button @click="document.querySelector('#sftp-page').__x.$data.toast = 'Uploading {{.Name}}...'; document.querySelector('#sftp-page').__x.$data.showToast = true"
|
<button @click="document.querySelector('#sftp-page').__x.$data.toast = 'Uploading {{.Name}}...'; document.querySelector('#sftp-page').__x.$data.showToast = true"
|
||||||
class="p-1 rounded-lg hover:bg-primary/10 text-on-surface-variant hover:text-primary transition-colors" title="Upload">
|
class="p-1 hover:bg-primary/10 rounded text-primary transition-colors" title="Upload to remote">
|
||||||
<svg class="w-3.5 h-3.5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 16v2a2 2 0 002 2h12a2 2 0 002-2v-2M7 10l5-5m0 0l5 5m-5-5v12"/></svg>
|
<svg class="w-3.5 h-3.5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 16v2a2 2 0 002 2h12a2 2 0 002-2v-2M7 10l5-5m0 0l5 5m-5-5v12"/></svg>
|
||||||
</button>
|
</button>
|
||||||
{{end}}
|
{{end}}
|
||||||
|
{{if eq $.Pane "remote"}}
|
||||||
|
<button @click="document.querySelector('#sftp-page').__x.$data.toast = 'Downloading {{.Name}}...'; document.querySelector('#sftp-page').__x.$data.showToast = true"
|
||||||
|
class="p-1 hover:bg-primary/10 rounded text-primary transition-colors" title="Download to local">
|
||||||
|
<svg class="w-3.5 h-3.5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 10v6m0 0l-3-3m3 3l3-3m2 8H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"/></svg>
|
||||||
|
</button>
|
||||||
|
{{end}}
|
||||||
|
{{end}}
|
||||||
<button hx-delete="/sftp/rm?pane={{$.Pane}}&name={{.Name}}" hx-target="#{{$.Pane}}-pane-content" hx-swap="outerHTML"
|
<button hx-delete="/sftp/rm?pane={{$.Pane}}&name={{.Name}}" hx-target="#{{$.Pane}}-pane-content" hx-swap="outerHTML"
|
||||||
hx-confirm="Delete {{.Name}}?"
|
hx-confirm="Delete {{.Name}}?"
|
||||||
class="p-1 rounded-lg hover:bg-red-50 text-on-surface-variant hover:text-red-500 transition-colors" title="Delete">
|
class="p-1 hover:bg-red-50 hover:text-error rounded text-outline transition-colors" title="Delete file">
|
||||||
<svg class="w-3.5 h-3.5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"/></svg>
|
<svg class="w-3.5 h-3.5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"/></svg>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</td>
|
||||||
|
</tr>
|
||||||
{{end}}
|
{{end}}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
{{if eq (len .Files) 0}}
|
{{if eq (len .Files) 0}}
|
||||||
<div class="text-center py-8 text-on-surface-variant">
|
<div class="text-center py-8 text-on-surface-variant">
|
||||||
<p class="text-sm">This directory is empty</p>
|
<p class="text-sm">This directory is empty</p>
|
||||||
</div>
|
</div>
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|
||||||
|
{{if gt (len .Files) 0}}
|
||||||
|
<div class="p-3 bg-surface-container-low border-t border-outline-variant/30 text-[10px] text-outline text-center font-bold">
|
||||||
|
TIP: Click file or {{if eq .Pane "local"}}upload{{else}}download{{end}} button to transmit to server
|
||||||
|
</div>
|
||||||
|
{{end}}
|
||||||
</div>
|
</div>
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|||||||
@@ -1,32 +1,57 @@
|
|||||||
{{define "snippet_grid"}}
|
{{define "snippet_grid"}}
|
||||||
<div id="snippet-grid" class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4">
|
<div id="snippet-grid" class="space-y-6">
|
||||||
{{range .Snippets}}
|
{{range .Snippets}}
|
||||||
<div class="rounded-xl bg-white border border-outline-variant/30 p-4 hover:shadow-md transition-shadow animate-fade-in">
|
<div class="bg-white border border-outline-variant/30 rounded-2xl overflow-hidden shadow-sm flex flex-col group">
|
||||||
<div class="flex items-start justify-between mb-3">
|
<div class="p-5 flex justify-between items-start gap-4">
|
||||||
<div>
|
<div class="space-y-1">
|
||||||
<p class="text-sm font-medium text-on-surface">{{.Name}}</p>
|
<div class="flex flex-wrap items-center gap-2">
|
||||||
<span class="text-xs font-medium px-1.5 py-0.5 rounded-full bg-tertiary/10 text-tertiary">{{.Language}}</span>
|
<h3 class="font-bold text-on-surface text-base group-hover:text-primary transition-colors">{{.Name}}</h3>
|
||||||
|
<div class="flex flex-wrap gap-1">
|
||||||
|
{{range .Tags}}
|
||||||
|
<span class="px-2 py-0.5 bg-surface-container text-[10px] font-bold rounded text-on-surface-variant">{{.}}</span>
|
||||||
|
{{end}}
|
||||||
</div>
|
</div>
|
||||||
<button class="p-1.5 rounded-lg hover:bg-red-50 text-on-surface-variant hover:text-red-500 transition-colors shrink-0"
|
</div>
|
||||||
hx-delete="/snippets/{{.ID}}" hx-target="#snippet-grid" hx-confirm="Delete {{.Name}}?">
|
{{if .Description}}
|
||||||
<svg class="w-3.5 h-3.5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"/></svg>
|
<p class="text-xs text-on-surface-variant leading-relaxed">{{.Description}}</p>
|
||||||
|
{{end}}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="flex items-center gap-2 shrink-0">
|
||||||
|
<button onclick="copyToClipboard(`{{.Content}}`)"
|
||||||
|
class="p-1.5 border border-outline-variant/40 rounded-lg bg-surface-container-low hover:border-primary text-outline hover:text-primary transition-colors"
|
||||||
|
title="Copy code to clipboard">
|
||||||
|
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"/></svg>
|
||||||
|
</button>
|
||||||
|
<button hx-delete="/snippets/{{.ID}}" hx-target="#snippet-grid" hx-confirm="Delete {{.Name}}?"
|
||||||
|
class="p-1.5 border border-outline-variant/40 rounded-lg bg-surface-container-low hover:border-error text-outline hover:text-error transition-colors"
|
||||||
|
title="Delete code snippet">
|
||||||
|
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"/></svg>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<pre class="text-xs text-on-surface-variant bg-surface-container-low/50 rounded-lg p-3 mb-3 overflow-x-auto font-mono leading-relaxed">{{.Content}}</pre>
|
</div>
|
||||||
<div class="flex items-center justify-between pt-3 border-t border-outline-variant/20">
|
|
||||||
<span class="text-xs text-on-surface-variant">{{.CreatedAt}}</span>
|
<div class="bg-surface-container-low border-t border-outline-variant/40 p-4 font-mono text-xs text-on-surface relative group/code overflow-x-auto">
|
||||||
<button class="p-1.5 rounded-lg hover:bg-primary/10 text-on-surface-variant hover:text-primary transition-colors"
|
<pre class="text-on-surface select-all leading-relaxed whitespace-pre font-medium">{{.Content}}</pre>
|
||||||
onclick="copyToClipboard(`{{.Content}}`)" title="Copy">
|
<button onclick="copyToClipboard(`{{.Content}}`)"
|
||||||
<svg class="w-3.5 h-3.5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"/></svg>
|
class="absolute right-4 top-4 bg-white/90 backdrop-blur border border-outline-variant/30 shadow px-2.5 py-1 rounded text-[10px] font-mono font-bold hover:border-primary hover:text-primary transition-colors opacity-0 group-hover/code:opacity-100">
|
||||||
|
COPY
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="px-5 py-2 border-t border-outline-variant/20 bg-surface-container-lowest flex justify-between items-center text-[10px] text-outline font-semibold">
|
||||||
|
<span>Last adjusted {{.CreatedAt}}</span>
|
||||||
|
<span class="flex items-center gap-1 text-primary">
|
||||||
|
<svg class="w-3 h-3" viewBox="0 0 24 24" fill="none" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 10V3L4 14h7v7l9-11h-7z"/></svg>
|
||||||
|
Ready to inject to shell
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|
||||||
{{if eq (len .Snippets) 0}}
|
{{if eq (len .Snippets) 0}}
|
||||||
<div class="col-span-full text-center py-12 text-on-surface-variant">
|
<div class="p-12 border border-dashed border-outline-variant/40 rounded-2xl text-center text-outline">
|
||||||
<p class="text-lg font-medium">No snippets found</p>
|
No matching snippet found.
|
||||||
<p class="text-sm mt-1">Add your first snippet to get started</p>
|
|
||||||
</div>
|
</div>
|
||||||
{{end}}
|
{{end}}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
+130
-64
@@ -21,91 +21,131 @@
|
|||||||
<h1 class="text-lg font-semibold text-on-surface">{{.Title}}</h1>
|
<h1 class="text-lg font-semibold text-on-surface">{{.Title}}</h1>
|
||||||
</header>
|
</header>
|
||||||
<main id="main-content" class="flex-1 overflow-auto p-6">
|
<main id="main-content" class="flex-1 overflow-auto p-6">
|
||||||
<div id="snippets-page" class="max-w-7xl mx-auto">
|
<div class="max-w-7xl mx-auto space-y-8">
|
||||||
<div class="flex items-center gap-3 mb-6">
|
<!-- Search Header Panel -->
|
||||||
<div class="relative flex-1 max-w-md">
|
<div class="flex flex-col sm:flex-row sm:items-center justify-between gap-4 border-b border-outline-variant/30 pb-4">
|
||||||
<input type="search" placeholder="Search snippets..."
|
<div>
|
||||||
hx-get="/snippets/grid?q=..." hx-trigger="keyup delay:200ms"
|
<h2 class="text-xl font-bold text-on-surface tracking-tight">Snippets & Scripts Library</h2>
|
||||||
hx-target="#snippet-grid"
|
<p class="text-xs text-on-surface-variant mt-0.5">Quickly reuse and catalog command line shortcuts across remote clusters</p>
|
||||||
class="w-full pl-9 pr-3 py-2 rounded-lg border border-outline-variant/50 bg-white text-sm text-on-surface placeholder-on-surface-variant focus:outline-none focus:ring-2 focus:ring-primary/30 focus:border-primary/50">
|
</div>
|
||||||
|
<div class="flex items-center gap-3">
|
||||||
|
<div class="relative">
|
||||||
|
<svg class="absolute left-3 top-1/2 -translate-y-1/2 text-outline w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"/></svg>
|
||||||
|
<input type="search" name="q" placeholder="Search code snippets..."
|
||||||
|
hx-get="/snippets/grid" hx-trigger="keyup delay:200ms" hx-target="#snippet-grid"
|
||||||
|
class="pl-9 pr-4 py-1.5 rounded-full bg-surface-container-low border border-outline-variant/30 text-sm focus:border-primary focus:bg-white focus:outline-none focus:ring-1 focus:ring-primary w-48 sm:w-60 transition-all">
|
||||||
</div>
|
</div>
|
||||||
<button @click="$dispatch('open-snippet-modal')"
|
<button @click="$dispatch('open-snippet-modal')"
|
||||||
class="px-4 py-2 rounded-lg text-sm font-medium bg-primary text-white hover:bg-primary/90 transition-colors flex items-center gap-2">
|
class="flex items-center gap-1.5 bg-primary text-white hover:bg-primary/90 font-bold text-xs py-2 px-4 rounded-xl shadow-md transition-all">
|
||||||
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4v16m8-8H4"/></svg>
|
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4v16m8-8H4"/></svg>
|
||||||
Add Snippet
|
New Snippet
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
<div id="snippet-grid" class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4">
|
|
||||||
{{range .Snippets}}
|
|
||||||
<div class="rounded-xl bg-white border border-outline-variant/30 p-4 hover:shadow-md transition-shadow animate-fade-in">
|
|
||||||
<div class="flex items-start justify-between mb-3">
|
|
||||||
<div>
|
|
||||||
<p class="text-sm font-medium text-on-surface">{{.Name}}</p>
|
|
||||||
<span class="text-xs font-medium px-1.5 py-0.5 rounded-full bg-tertiary/10 text-tertiary">{{.Language}}</span>
|
|
||||||
</div>
|
|
||||||
<button class="p-1.5 rounded-lg hover:bg-red-50 text-on-surface-variant hover:text-red-500 transition-colors shrink-0"
|
|
||||||
hx-delete="/snippets/{{.ID}}" hx-target="#snippet-grid" hx-confirm="Delete {{.Name}}?">
|
|
||||||
<svg class="w-3.5 h-3.5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"/></svg>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
<pre class="text-xs text-on-surface-variant bg-surface-container-low/50 rounded-lg p-3 mb-3 overflow-x-auto font-mono leading-relaxed">{{.Content}}</pre>
|
|
||||||
<div class="flex items-center justify-between pt-3 border-t border-outline-variant/20">
|
|
||||||
<span class="text-xs text-on-surface-variant">{{.CreatedAt}}</span>
|
|
||||||
<button class="p-1.5 rounded-lg hover:bg-primary/10 text-on-surface-variant hover:text-primary transition-colors"
|
|
||||||
onclick="copyToClipboard(`{{.Content}}`)" title="Copy">
|
|
||||||
<svg class="w-3.5 h-3.5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"/></svg>
|
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{{end}}
|
|
||||||
{{if eq (len .Snippets) 0}}
|
<!-- Grid: Sidebar + Cards -->
|
||||||
<div class="col-span-full text-center py-12 text-on-surface-variant">
|
<div class="grid grid-cols-1 lg:grid-cols-12 gap-8">
|
||||||
<p class="text-lg font-medium">No snippets found</p>
|
<!-- Sidebar -->
|
||||||
<p class="text-sm mt-1">Add your first snippet to get started</p>
|
<div class="lg:col-span-3 space-y-5" x-data="sidebarManager()" x-init="init()">
|
||||||
|
<div class="bg-white rounded-2xl border border-outline-variant/30 p-4 space-y-4">
|
||||||
|
<h4 class="text-xs font-bold text-outline-variant uppercase tracking-wider px-2">Collections</h4>
|
||||||
|
<div class="space-y-1 text-sm font-semibold">
|
||||||
|
<button hx-get="/snippets/grid" hx-target="#snippet-grid"
|
||||||
|
:class="activeColl === 'all' ? 'bg-primary/10 text-primary' : 'text-on-surface-variant hover:bg-surface-container-low'"
|
||||||
|
class="w-full flex items-center justify-between p-2 rounded-lg transition-colors"
|
||||||
|
@click="activeColl = 'all'">
|
||||||
|
<span class="flex items-center gap-2"><svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2z"/></svg> All Code Blocks</span>
|
||||||
|
<span class="text-xs text-outline" x-text="total"></span>
|
||||||
|
</button>
|
||||||
|
<button hx-get="/snippets/grid?collection=favorites" hx-target="#snippet-grid"
|
||||||
|
:class="activeColl === 'favorites' ? 'bg-primary/10 text-primary' : 'text-on-surface-variant hover:bg-surface-container-low'"
|
||||||
|
class="w-full flex items-center justify-between p-2 rounded-lg transition-colors"
|
||||||
|
@click="activeColl = 'favorites'">
|
||||||
|
<span class="flex items-center gap-2"><svg class="w-4 h-4 text-amber-500" fill="currentColor" viewBox="0 0 24 24"><path d="M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z"/></svg> Starred Favorites</span>
|
||||||
|
<span class="text-xs text-outline" x-text="favCount"></span>
|
||||||
|
</button>
|
||||||
|
<button hx-get="/snippets/grid?collection=recent" hx-target="#snippet-grid"
|
||||||
|
:class="activeColl === 'recent' ? 'bg-primary/10 text-primary' : 'text-on-surface-variant hover:bg-surface-container-low'"
|
||||||
|
class="w-full flex items-center justify-between p-2 rounded-lg transition-colors"
|
||||||
|
@click="activeColl = 'recent'">
|
||||||
|
<span class="flex items-center gap-2"><svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"/></svg> Recent</span>
|
||||||
|
<span class="text-xs text-outline" x-text="recentCount"></span>
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="bg-white rounded-2xl border border-outline-variant/30 p-4 space-y-3">
|
||||||
|
<h4 class="text-xs font-bold text-outline-variant uppercase tracking-wider px-2">Tag Categories</h4>
|
||||||
|
<div class="flex flex-wrap gap-1.5 p-1">
|
||||||
|
<button hx-get="/snippets/grid" hx-target="#snippet-grid"
|
||||||
|
:class="activeTag === 'all' ? 'bg-primary text-white' : 'bg-surface-container-low text-on-surface-variant hover:bg-surface-container'"
|
||||||
|
class="px-3 py-1 rounded-full text-xs font-bold transition-all"
|
||||||
|
@click="activeTag = 'all'">All Tags</button>
|
||||||
|
{{range .AllTags}}
|
||||||
|
<button hx-get="/snippets/grid?tag={{.}}" hx-target="#snippet-grid"
|
||||||
|
:class="activeTag === '{{.}}' ? 'bg-primary text-white' : 'bg-surface-container-low text-on-surface-variant hover:bg-surface-container'"
|
||||||
|
class="px-3 py-1 rounded-full text-xs font-bold transition-all"
|
||||||
|
@click="activeTag = '{{.}}'">
|
||||||
|
{{.}}
|
||||||
|
</button>
|
||||||
{{end}}
|
{{end}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Snippet Cards -->
|
||||||
|
<div class="lg:col-span-9 space-y-6" id="snippet-grid">
|
||||||
|
{{template "snippet_grid" .}}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Add Snippet Modal -->
|
||||||
<div id="snippet-modal" class="fixed inset-0 z-50" x-data="{ open: false }" x-show="open" x-cloak
|
<div id="snippet-modal" class="fixed inset-0 z-50" x-data="{ open: false }" x-show="open" x-cloak
|
||||||
@open-snippet-modal.window="open = true" @keydown.escape.window="open = false">
|
@open-snippet-modal.window="open = true" @keydown.escape.window="open = false">
|
||||||
<div class="absolute inset-0 bg-black/30 backdrop-blur-sm" @click="open = false"></div>
|
<div class="absolute inset-0 bg-black/40 backdrop-blur-sm" @click="open = false"></div>
|
||||||
<div class="absolute inset-0 flex items-center justify-center p-4" x-show="open" x-transition>
|
<div class="absolute inset-0 flex items-center justify-center p-4" x-show="open" x-transition>
|
||||||
<div class="bg-white rounded-xl shadow-xl w-full max-w-lg p-6" @click.outside="open = false">
|
<div class="bg-white rounded-2xl max-w-lg w-full border border-outline-variant/30 shadow-2xl p-6 space-y-4">
|
||||||
<div class="flex items-center justify-between mb-6">
|
<div class="flex justify-between items-center border-b border-outline-variant/30 pb-3">
|
||||||
<h2 class="text-lg font-semibold text-on-surface">Add New Snippet</h2>
|
<h3 class="font-bold text-lg text-on-surface">Store Custom Snippet</h3>
|
||||||
<button @click="open = false" class="p-1 rounded-lg hover:bg-surface-container-low text-on-surface-variant">
|
<button @click="open = false" class="text-outline hover:text-primary p-1 rounded">Cancel</button>
|
||||||
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"/></svg>
|
|
||||||
</button>
|
|
||||||
</div>
|
</div>
|
||||||
<form hx-post="/snippets" hx-target="#snippet-grid" hx-swap="outerHTML"
|
<form hx-post="/snippets" hx-target="#snippet-grid" hx-swap="outerHTML"
|
||||||
@submit="open = false" class="space-y-4">
|
@submit="open = false" class="space-y-4 text-sm">
|
||||||
<div>
|
<div class="flex flex-col gap-1">
|
||||||
<label class="block text-sm font-medium text-on-surface mb-1">Name</label>
|
<label class="text-xs font-bold text-on-surface-variant">SNIPPET TITLE</label>
|
||||||
<input type="text" name="name" required placeholder="e.g. Health Check Script"
|
<input type="text" name="name" required placeholder="e.g. Purge Docker Cache"
|
||||||
class="w-full px-3 py-2 rounded-lg border border-outline-variant/50 bg-white text-sm text-on-surface focus:outline-none focus:ring-2 focus:ring-primary/30">
|
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">
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div class="flex flex-col gap-1">
|
||||||
<label class="block text-sm font-medium text-on-surface mb-1">Content</label>
|
<label class="text-xs font-bold text-on-surface-variant">SHORT DESCRIPTION / USAGE</label>
|
||||||
<textarea name="content" rows="6" required placeholder="Paste your snippet here..."
|
<input type="text" name="description" placeholder="e.g. Safe cleanup to recover workspace disk capacity."
|
||||||
class="w-full px-3 py-2 rounded-lg border border-outline-variant/50 bg-white text-sm text-on-surface font-mono focus:outline-none focus:ring-2 focus:ring-primary/30"></textarea>
|
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">
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div class="flex flex-col gap-1">
|
||||||
<label class="block text-sm font-medium text-on-surface mb-1">Language</label>
|
<label class="text-xs font-bold text-on-surface-variant">CODE SYNTAX BLOCK</label>
|
||||||
<select name="language"
|
<textarea name="content" required rows="4" placeholder="e.g. systemctl restart nginx"
|
||||||
class="w-full px-3 py-2 rounded-lg border border-outline-variant/50 bg-white text-sm text-on-surface focus:outline-none focus:ring-2 focus:ring-primary/30">
|
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-mono text-xs"></textarea>
|
||||||
<option value="bash">Bash</option>
|
</div>
|
||||||
<option value="nginx">Nginx</option>
|
<div class="flex flex-col gap-1">
|
||||||
<option value="yaml">YAML</option>
|
<label class="text-xs font-bold text-on-surface-variant">PRIMARY TAG CATEGORY</label>
|
||||||
<option value="json">JSON</option>
|
<select name="tags"
|
||||||
<option value="sql">SQL</option>
|
class="bg-surface-container-low border border-outline-variant/40 rounded-lg py-2 px-3 focus:outline-none focus:border-primary">
|
||||||
<option value="dockerfile">Dockerfile</option>
|
<option value="DevOps">DevOps</option>
|
||||||
|
<option value="Docker">Docker</option>
|
||||||
|
<option value="Nginx">Nginx</option>
|
||||||
|
<option value="Git">Git</option>
|
||||||
|
<option value="SSL">SSL</option>
|
||||||
|
<option value="Security">Security</option>
|
||||||
|
<option value="Database">Database</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex justify-end gap-3 pt-2">
|
<input type="hidden" name="collection" value="recent">
|
||||||
|
<div class="pt-4 flex justify-end gap-3 border-t border-outline-variant/20">
|
||||||
<button type="button" @click="open = false"
|
<button type="button" @click="open = false"
|
||||||
class="px-4 py-2 rounded-lg text-sm font-medium text-on-surface-variant hover:bg-surface-container-low transition-colors">Cancel</button>
|
class="px-4 py-2 text-xs font-bold text-outline hover:text-on-surface">Cancel</button>
|
||||||
<button type="submit"
|
<button type="submit"
|
||||||
class="px-4 py-2 rounded-lg text-sm font-medium bg-primary text-white hover:bg-primary/90 transition-colors">Add Snippet</button>
|
class="bg-primary text-white py-2 px-5 rounded-lg font-bold text-xs shadow-md hover:bg-primary/90 transition-all">Save Code Snippet</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
@@ -114,5 +154,31 @@
|
|||||||
</main>
|
</main>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
function sidebarManager() {
|
||||||
|
return {
|
||||||
|
activeColl: 'all',
|
||||||
|
activeTag: 'all',
|
||||||
|
total: 0,
|
||||||
|
favCount: 0,
|
||||||
|
recentCount: 0,
|
||||||
|
init() {
|
||||||
|
this.updateCounts();
|
||||||
|
document.body.addEventListener('htmx:afterSwap', () => this.updateCounts());
|
||||||
|
},
|
||||||
|
updateCounts() {
|
||||||
|
const el = document.getElementById('snippet-data');
|
||||||
|
if (!el) return;
|
||||||
|
try {
|
||||||
|
const snippets = JSON.parse(el.textContent) || [];
|
||||||
|
this.total = snippets.length;
|
||||||
|
this.favCount = snippets.filter(s => s.Collection === 'favorites').length;
|
||||||
|
this.recentCount = snippets.filter(s => s.Collection === 'recent').length;
|
||||||
|
} catch(e) {}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -15,42 +15,105 @@
|
|||||||
<body class="bg-surface text-on-surface antialiased dot-grid min-h-screen">
|
<body class="bg-surface text-on-surface antialiased dot-grid min-h-screen">
|
||||||
<div class="flex min-h-screen">
|
<div class="flex min-h-screen">
|
||||||
{{template "nav" .}}
|
{{template "nav" .}}
|
||||||
<div class="flex-1 flex flex-col overflow-hidden">
|
<div class="flex-1 flex flex-col overflow-hidden" x-data="terminalManager()" x-init="init()">
|
||||||
<header class="h-14 border-b border-outline-variant/30 flex items-center gap-2 px-6 bg-white/70 backdrop-blur-md">
|
<header class="h-14 border-b border-outline-variant/30 flex items-center gap-2 px-6 bg-white/70 backdrop-blur-md">
|
||||||
<h1 class="text-lg font-semibold text-on-surface">{{.Title}}</h1>
|
<h1 class="text-xl font-bold tracking-tight text-on-surface">{{.Title}}</h1>
|
||||||
|
<span class="text-xs text-on-surface-variant mt-0.5">Interactive SSH shell with multi-tab session management</span>
|
||||||
<div class="flex-1"></div>
|
<div class="flex-1"></div>
|
||||||
<button @click="addTab()"
|
<button @click="addTab()"
|
||||||
class="p-1.5 rounded-lg hover:bg-surface-container-low text-on-surface-variant hover:text-on-surface transition-colors" title="New Tab">
|
class="p-1.5 rounded-lg bg-surface-container hover:bg-primary-container hover:text-on-primary-container text-on-surface-variant transition-all" title="New Tab">
|
||||||
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4v16m8-8H4"/></svg>
|
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4v16m8-8H4"/></svg>
|
||||||
</button>
|
</button>
|
||||||
</header>
|
</header>
|
||||||
<main id="main-content" class="flex-1 flex flex-col overflow-hidden bg-[#0d1117]"
|
<main id="main-content" class="flex-1 flex flex-col overflow-auto p-6">
|
||||||
x-data="terminalManager()"
|
<div class="max-w-7xl mx-auto space-y-6 flex flex-col flex-1 min-h-0 w-full">
|
||||||
x-init="init()">
|
<!-- Session Tab Toolbar -->
|
||||||
<!-- Tab bar -->
|
<div class="flex flex-col sm:flex-row sm:items-center justify-between gap-4 border-b border-outline-variant/30 pb-3">
|
||||||
<div class="flex items-center bg-[#161b22] border-b border-[#30363d] overflow-x-auto no-scrollbar shrink-0" style="height: 36px;">
|
<div class="flex items-center gap-2 overflow-x-auto no-scrollbar scroll-smooth pr-6">
|
||||||
<template x-for="(tab, i) in tabs" :key="tab.id">
|
<template x-for="(tab, i) in tabs" :key="tab.id">
|
||||||
<div @click="switchTab(i)"
|
<div @click="switchTab(i)"
|
||||||
:class="activeTab === i ? 'bg-[#0d1117] text-white border-t-2 border-[#58a6ff]' : 'bg-[#161b22] text-[#8b949e] hover:text-[#c9d1d9]'"
|
:class="activeTab === i ? 'bg-white text-primary border-primary shadow-[0_-4px_12px_rgba(0,80,203,0.06)]' : 'bg-surface-container-low text-on-surface-variant hover:bg-surface-container border-transparent'"
|
||||||
class="flex items-center gap-1.5 px-3 text-xs cursor-pointer border-r border-[#30363d] shrink-0 select-none"
|
class="flex items-center gap-2 px-3.5 py-2 rounded-t-xl text-xs font-bold font-mono transition-all cursor-pointer border-t-2">
|
||||||
style="height: 34px; padding-top: 1px;">
|
<svg class="w-3.5 h-3.5" :class="activeTab === i ? 'text-primary' : 'text-outline'" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 17V7c0-.621.504-1.125 1.125-1.125h2.25c.621 0 1.125.504 1.125 1.125v10c0 .621-.504 1.125-1.125 1.125h-2.25A1.125 1.125 0 014 17zm6 0V7c0-.621.504-1.125 1.125-1.125h2.25c.621 0 1.125.504 1.125 1.125v10c0 .621-.504 1.125-1.125 1.125h-2.25A1.125 1.125 0 0110 17zm6 0V7c0-.621.504-1.125 1.125-1.125h2.25C19.496 5.875 20 6.379 20 7v10c0 .621-.504 1.125-1.125 1.125h-2.25A1.125 1.125 0 0116 17z"/></svg>
|
||||||
<span class="w-2 h-2 rounded-full" :class="tab.connected ? 'bg-[#3fb950]' : 'bg-[#8b949e]'"></span>
|
<span class="truncate max-w-[120px]" x-text="tab.name"></span>
|
||||||
<span x-text="tab.name"></span>
|
<button @click.stop="closeTab(i)" class="p-0.5 hover:bg-black/10 rounded transition-colors">
|
||||||
<button @click.stop="closeTab(i)" class="ml-0.5 p-0.5 rounded hover:bg-[#30363d] text-[#8b949e] hover:text-white transition-colors">
|
|
||||||
<svg class="w-3 h-3" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"/></svg>
|
<svg class="w-3 h-3" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"/></svg>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
<button @click="addTab()"
|
||||||
|
class="p-1.5 bg-surface-container hover:bg-primary-container hover:text-on-primary-container text-on-surface-variant rounded-lg transition-all" title="Open new terminal connection">
|
||||||
|
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4v16m8-8H4"/></svg>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div class="flex items-center gap-4 text-xs font-mono shrink-0">
|
||||||
|
<div class="flex items-center gap-1.5 text-secondary">
|
||||||
|
<span class="w-2 h-2 rounded-full bg-secondary animate-pulse"></span>
|
||||||
|
<span>SECURE CRYPTO PATH</span>
|
||||||
|
</div>
|
||||||
|
<div class="text-outline">
|
||||||
|
HOST: <span class="text-on-surface font-semibold" x-text="tabs.length ? tabs[activeTab].host : '—'"></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Terminal containers -->
|
<!-- Terminal shell frame -->
|
||||||
<div class="flex-1 relative">
|
<div class="flex-1 bg-white border border-outline-variant rounded-2xl shadow-sm flex flex-col overflow-hidden min-h-0">
|
||||||
<template x-for="(tab, i) in tabs" :key="tab.id">
|
<!-- Terminal Header -->
|
||||||
<div :id="'terminal-container-' + tab.id"
|
<div class="px-4 py-2 bg-surface-container-low border-b border-outline-variant/30 flex justify-between items-center">
|
||||||
x-show="activeTab === i"
|
<div class="flex items-center gap-1.5">
|
||||||
class="absolute inset-0">
|
<span class="w-3 h-3 rounded-full bg-error/80"></span>
|
||||||
|
<span class="w-3 h-3 rounded-full bg-primary-container/80"></span>
|
||||||
|
<span class="w-3 h-3 rounded-full bg-secondary/80"></span>
|
||||||
|
<span class="text-[10px] font-mono font-bold text-outline ml-2">ssh -i id_ed25519 root@<span x-text="tabs.length ? tabs[activeTab].host : '—'"></span></span>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="flex items-center gap-3">
|
||||||
|
<button @click="clearBuffer()"
|
||||||
|
class="text-[10px] uppercase font-bold text-outline hover:text-primary transition-colors flex items-center gap-1">
|
||||||
|
<svg class="w-3 h-3" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M16.023 9.348h4.992v-.001M2.985 19.644v-4.992m0 0h4.992m-4.993 0l3.181 3.183a8.25 8.25 0 0013.803-3.7M4.031 9.865a8.25 8.25 0 0113.803-3.7l3.181 3.182"/></svg>
|
||||||
|
Clear Buffer
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Console display -->
|
||||||
|
<div class="flex-1 overflow-y-auto min-h-0 font-mono text-sm leading-relaxed p-5 bg-white" id="terminal-output">
|
||||||
|
<template x-for="(line, idx) in history" :key="idx">
|
||||||
|
<div :class="line.type === 'input' ? 'text-on-surface font-bold' : line.type === 'error' ? 'text-error bg-error-container/20 px-2.5 py-1 rounded-md' : line.type === 'success' ? 'text-secondary bg-secondary-container/10 px-2.5 py-1 rounded-md font-semibold' : 'text-[#2244aa]'"
|
||||||
|
class="whitespace-pre-wrap" x-text="line.text"></div>
|
||||||
</template>
|
</template>
|
||||||
|
<div class="h-4"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Input prompt -->
|
||||||
|
<form @submit.prevent="submitCommand()"
|
||||||
|
class="p-3 border-t border-outline-variant/40 bg-surface-container-low flex items-center gap-2.5">
|
||||||
|
<span class="font-mono text-xs font-bold text-primary pl-2 shrink-0 flex items-center gap-1">
|
||||||
|
<svg class="w-3.5 h-3.5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15.75 17.25L12 21m0 0l-3.75-3.75M12 21V3"/></svg>
|
||||||
|
root@<span x-text="tabs.length ? tabs[activeTab].name : 'host'"></span>:~$
|
||||||
|
</span>
|
||||||
|
<input type="text" x-model="command" autofocus
|
||||||
|
placeholder='Type a command (e.g. "help", "ls", "docker ps", "ping google.com")...'
|
||||||
|
class="flex-1 bg-transparent border-none font-mono text-xs font-medium focus:ring-0 focus:outline-none text-on-surface p-0">
|
||||||
|
<button type="submit"
|
||||||
|
class="p-1.5 bg-primary text-white rounded-lg hover:bg-primary-container hover:text-on-primary-container transition-all" title="Execute Command">
|
||||||
|
<svg class="w-3.5 h-3.5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5.25 5.653c0-.856.917-1.398 1.667-.986l11.54 6.348a1.125 1.125 0 010 1.971l-11.54 6.347a1.125 1.125 0 01-1.667-.985V5.653z"/></svg>
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Shortcut pills -->
|
||||||
|
<div class="flex flex-wrap items-center gap-2 text-[11px] font-mono font-bold text-on-surface-variant">
|
||||||
|
<span class="text-outline">SHORTCUT SUGGESTIONS:</span>
|
||||||
|
<button type="button" @click="insertCommand('help')" class="px-2.5 py-1 rounded-md bg-surface-container border border-outline-variant/30 hover:border-primary hover:bg-primary-container/10 transition-colors">help</button>
|
||||||
|
<button type="button" @click="insertCommand('ls')" class="px-2.5 py-1 rounded-md bg-surface-container border border-outline-variant/30 hover:border-primary hover:bg-primary-container/10 transition-colors">ls</button>
|
||||||
|
<button type="button" @click="insertCommand('docker ps')" class="px-2.5 py-1 rounded-md bg-surface-container border border-outline-variant/30 hover:border-primary hover:bg-primary-container/10 transition-colors">docker ps</button>
|
||||||
|
<button type="button" @click="insertCommand('uname -a')" class="px-2.5 py-1 rounded-md bg-surface-container border border-outline-variant/30 hover:border-primary hover:bg-primary-container/10 transition-colors">uname -a</button>
|
||||||
|
<button type="button" @click="insertCommand('ping 8.8.8.8')" class="px-2.5 py-1 rounded-md bg-surface-container border border-outline-variant/30 hover:border-primary hover:bg-primary-container/10 transition-colors">ping 8.8.8.8</button>
|
||||||
|
<button type="button" @click="insertCommand('cat server.js')" class="px-2.5 py-1 rounded-md bg-surface-container border border-outline-variant/30 hover:border-primary hover:bg-primary-container/10 transition-colors">cat server.js</button>
|
||||||
|
<button type="button" @click="insertCommand('keychain')" class="px-2.5 py-1 rounded-md bg-surface-container border border-outline-variant/30 hover:border-primary hover:bg-primary-container/10 transition-colors">keychain</button>
|
||||||
|
<button type="button" @click="insertCommand('clear')" class="px-2.5 py-1 rounded-md bg-surface-container border border-outline-variant/30 hover:border-primary hover:bg-primary-container/10 transition-colors">clear</button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</main>
|
</main>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -0,0 +1,344 @@
|
|||||||
|
# 🔍 Hostkeeper V2 — UI/UX Audit & Perbaikan Checklist
|
||||||
|
|
||||||
|
> **Acuan perbaikan UI** — Bandingkan HTMX implementation dengan React template di `template/src/components/`
|
||||||
|
> **Target**: Menyamakan visual dengan Lumina Design System hingga level piksel
|
||||||
|
> **Last Updated**: 2026-07-07
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 🎨 Design System Reference
|
||||||
|
|
||||||
|
| Token | Value | Status |
|
||||||
|
|-------|-------|--------|
|
||||||
|
| Primary | `#0050cb` | ✅ OK |
|
||||||
|
| Secondary | `#006e2f` | ✅ OK |
|
||||||
|
| Tertiary | `#7e23cc` | ✅ OK |
|
||||||
|
| Surface | `#f7f9fb` | ✅ OK |
|
||||||
|
| On Surface | `#191c1e` | ✅ OK |
|
||||||
|
| On Surface Variant | `#424656` | ✅ OK |
|
||||||
|
| Outline | `#727686` | ✅ OK |
|
||||||
|
| Outline Variant | `#c2c6d8` | ✅ OK |
|
||||||
|
| Error | `#b3261e` | ✅ OK |
|
||||||
|
| Surface Container Low | `#f0f2f5` | ✅ OK |
|
||||||
|
| Surface Container | `#eaecf0` | ✅ OK |
|
||||||
|
| Font Sans | Inter (300–900) | ✅ OK |
|
||||||
|
| Font Mono | JetBrains Mono (300–700) | ✅ OK |
|
||||||
|
| Dot Grid | `radial-gradient(#e2e8f0 1.5px, transparent 1.5px) 16px` | ✅ OK |
|
||||||
|
| Sidebar Width | `260px` | ✅ OK |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 🔴 P0 — DASHBOARD (index.html + host_list.html + host_modal.html)
|
||||||
|
|
||||||
|
### ~~Task #1: Banner Stats~~ ✅ Selesai
|
||||||
|
|
||||||
|
### ~~Task #2: Status Filter~~ ✅ Selesai
|
||||||
|
|
||||||
|
### ~~Task #3: Search Bar~~ ✅ Selesai
|
||||||
|
|
||||||
|
### ~~Task #4: View Toggle~~ ✅ Selesai
|
||||||
|
|
||||||
|
### ~~Task #5: Section Title~~ ✅ Selesai
|
||||||
|
|
||||||
|
### ~~Task #6: Host Card Grid~~ ✅ Selesai
|
||||||
|
|
||||||
|
### ~~Task #7: Add Host Card~~ ✅ Selesai
|
||||||
|
|
||||||
|
### ~~Task #8: Host Card List~~ ✅ Selesai
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Task #9: Transfer Panel
|
||||||
|
|
||||||
|
**Referensi**: `template/src/components/DashboardView.tsx:306-356`
|
||||||
|
|
||||||
|
Template punya section "Background Transfers" dengan:
|
||||||
|
- Line separator + judul
|
||||||
|
- Table header: Source & File | Destination | Progress
|
||||||
|
- Tiap row: icon (download=tertiary/upload=primary), nama file, source, destination panah, progress bar (h-1.5, bg-secondary, shadow), percentage + speed
|
||||||
|
|
||||||
|
HTMX: Hanya "No active transfers" di sidebar ❌
|
||||||
|
|
||||||
|
**Files**: `app/backend/views/index.html` + `app/backend/views/host_list.html`
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### ~~Task #10: Add Host Modal~~ ✅ Selesai
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 🔴 P0 — TERMINAL (terminal.html + terminal.js)
|
||||||
|
|
||||||
|
### Task #11: Ubah theme dari dark ke light (Lumina)
|
||||||
|
|
||||||
|
**Referensi**: `template/src/components/TerminalView.tsx:208-284`
|
||||||
|
|
||||||
|
| Detail | Template (wajib) | HTMX Saat Ini |
|
||||||
|
|--------|----------|---------------|
|
||||||
|
| Background terminal | `bg-white` | `bg-[#0d1117]` ❌ |
|
||||||
|
| Tab bar | `bg-surface-container-low` | `bg-[#161b22]` ❌ |
|
||||||
|
| Tab border | `border-b border-outline-variant/30` | `border-[#30363d]` ❌ |
|
||||||
|
| Tab active | `bg-white text-primary border-primary shadow` | `bg-[#0d1117] text-white border-t-2 border-[#58a6ff]` ❌ |
|
||||||
|
| Tab inactive | `bg-surface-container-low text-on-surface-variant` | `bg-[#161b22] text-[#8b949e]` ❌ |
|
||||||
|
| Tab close | `hover:bg-black/10 rounded` | `hover:bg-[#30363d]` ❌ |
|
||||||
|
| New tab button | `bg-surface-container hover:bg-primary-container hover:text-on-primary-container` | styling dark ❌ |
|
||||||
|
| Terminal header | `bg-surface-container-low border-b border-outline-variant/30` | tidak ada |
|
||||||
|
|
||||||
|
**Files**: `app/backend/views/terminal.html`
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Task #12: Traffic Light Dots
|
||||||
|
|
||||||
|
**Referensi**: `template/src/components/TerminalView.tsx:212-216`
|
||||||
|
|
||||||
|
Tambah 3 dot (red `#b3261e`, yellow `#d6e3ff` / kuning, green `#006e2f`) di kiri terminal header.
|
||||||
|
|
||||||
|
**Files**: `app/backend/views/terminal.html`
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Task #13: SSH Connection String
|
||||||
|
|
||||||
|
**Referensi**: `template/src/components/TerminalView.tsx:216`
|
||||||
|
|
||||||
|
Tampilkan teks: `ssh -i id_ed25519 root@{host.ip}` dengan `text-[10px] font-mono font-bold text-outline`
|
||||||
|
|
||||||
|
**Files**: `app/backend/views/terminal.html`
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Task #14: "Clear Buffer" Button
|
||||||
|
|
||||||
|
**Referensi**: `template/src/components/TerminalView.tsx:219-232`
|
||||||
|
|
||||||
|
Button `text-[10px] uppercase font-bold text-outline hover:text-primary` dengan `RefreshCw` icon.
|
||||||
|
|
||||||
|
**Files**: `app/backend/views/terminal.html`
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Task #15: Terminal Output Styles
|
||||||
|
|
||||||
|
**Referensi**: `template/src/components/TerminalView.tsx:241-255`
|
||||||
|
|
||||||
|
| Type | Template | HTMX |
|
||||||
|
|------|----------|------|
|
||||||
|
| input | `text-on-surface font-bold` | (xterm.js) |
|
||||||
|
| error | `text-error bg-error-container/20 px-2.5 py-1 rounded-md` | (xterm.js) |
|
||||||
|
| success | `text-[#006e2f] bg-secondary-container/10 px-2.5 py-1 rounded-md font-semibold` | (xterm.js) |
|
||||||
|
| output | `text-[#2244aa]` | (xterm.js) |
|
||||||
|
|
||||||
|
Ini perlu disesuaikan di terminal.js / xterm theme.
|
||||||
|
|
||||||
|
**Files**: `app/backend/static/js/terminal.js`, `app/backend/views/terminal.html`
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Task #16: Input Prompt Bar
|
||||||
|
|
||||||
|
**Referensi**: `template/src/components/TerminalView.tsx:259-283`
|
||||||
|
|
||||||
|
| Detail | Template | HTMX |
|
||||||
|
|--------|----------|------|
|
||||||
|
| Background | `bg-surface-container-low` | dark ❌ |
|
||||||
|
| Prompt | `root@{host}:~$` dengan icon `CornerDownLeft` | (di mock WebSocket) |
|
||||||
|
| Input | `bg-transparent font-mono text-xs focus:ring-0` | (xterm.js) |
|
||||||
|
| Execute button | `bg-primary text-white rounded-lg hover:bg-primary-container` | tidak ada |
|
||||||
|
|
||||||
|
**Files**: `app/backend/views/terminal.html`
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Task #17: Shortcut Pills
|
||||||
|
|
||||||
|
**Referensi**: `template/src/components/TerminalView.tsx:287-301`
|
||||||
|
|
||||||
|
Tambah rail shortcut di bawah terminal: help, ls, docker ps, uname -a, ping 8.8.8.8, cat server.js, keychain, clear.
|
||||||
|
|
||||||
|
| Detail | Template |
|
||||||
|
|--------|----------|
|
||||||
|
| Container | `flex flex-wrap gap-2 text-[11px] font-mono font-bold text-on-surface-variant` |
|
||||||
|
| Label | "SHORTCUT SUGGESTIONS:" |
|
||||||
|
| Pill | `px-2.5 py-1 rounded-md bg-surface-container border border-outline-variant/30 hover:border-primary hover:bg-primary-container/10` |
|
||||||
|
|
||||||
|
**Files**: `app/backend/views/terminal.html`
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Task #18: Status Info (Security + Host IP)
|
||||||
|
|
||||||
|
**Referensi**: `template/src/components/TerminalView.tsx:197-205`
|
||||||
|
|
||||||
|
| Detail | Template |
|
||||||
|
|--------|----------|
|
||||||
|
| Kiri | "SECURE CRYPTO PATH" dengan green dot + animate-pulse |
|
||||||
|
| Kanan | "HOST: {host.ip}" |
|
||||||
|
|
||||||
|
**Files**: `app/backend/views/terminal.html`
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Task #19: Sync Mock Commands dengan Template
|
||||||
|
|
||||||
|
**Referensi**: `template/src/components/TerminalView.tsx:61-129`
|
||||||
|
|
||||||
|
Template punya command list: help, ls, docker ps, uname -a, ping 8.8.8.8, cat server.js, keychain, clear.
|
||||||
|
|
||||||
|
HTMX di Go handler punya: clear, exit, pwd, whoami, hostname, date, uptime, uname, ls, cd, cat, echo, ssh, help.
|
||||||
|
|
||||||
|
Output di tiap command juga harus disamakan dengan template (docker ps output, ls output, dll).
|
||||||
|
|
||||||
|
**Files**: `app/backend/internal/handler/terminal.go`
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 🔴 P0 — SNIPPETS (snippets.html + snippet_grid.html) ✅
|
||||||
|
|
||||||
|
### ~~Task #20: Layout — Ubah ke 12-col grid (sidebar + content)~~ ✅ Selesai
|
||||||
|
|
||||||
|
### ~~Task #21: Sidebar — Collections~~ ✅ Selesai
|
||||||
|
|
||||||
|
### ~~Task #22: Sidebar — Tag Categories~~ ✅ Selesai
|
||||||
|
|
||||||
|
### ~~Task #23: Snippet Card — Stacked Layout~~ ✅ Selesai
|
||||||
|
|
||||||
|
### ~~Task #24: Headers & Searching~~ ✅ Selesai
|
||||||
|
|
||||||
|
### ~~Task #25: Add Snippet Modal (style)~~ ✅ Selesai
|
||||||
|
|
||||||
|
### ~~Task #26: Data Model — Tambah field Snippet~~ ✅ Selesai
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 🟡 P1 — KEYCHAIN (keychain.html + key_grid.html) ✅
|
||||||
|
|
||||||
|
### ~~Task #27: Layout — 2 col~~ ✅ Selesai
|
||||||
|
|
||||||
|
### ~~Task #28: Key Card — Style Upgrade~~ ✅ Selesai
|
||||||
|
|
||||||
|
### ~~Task #29: Add Key Modal (style)~~ ✅ Selesai
|
||||||
|
|
||||||
|
### ~~Task #30: Security Advisory~~ ✅ Selesai
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 🟡 P1 — SFTP (sftp.html + sftp_pane.html) ✅
|
||||||
|
|
||||||
|
### ~~Task #31: Header — Tambah subtitle~~ ✅ Selesai
|
||||||
|
|
||||||
|
### ~~Task #32: File Pane — Table Structure~~ ✅ Selesai
|
||||||
|
### ~~Task #33: Drop Zone — Style~~ ✅ Selesai
|
||||||
|
|
||||||
|
### ~~Task #34: Toast Notification~~ ✅ Selesai
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 🟡 P1 — SETTINGS (settings.html) ✅
|
||||||
|
|
||||||
|
### ~~Task #35: Layout — 2-column grid~~ ✅ Selesai
|
||||||
|
|
||||||
|
### ~~Task #36: Profile — Editable Form~~ ✅ Selesai
|
||||||
|
|
||||||
|
### ~~Task #37: Toggles — iOS-Style~~ ✅ Selesai
|
||||||
|
|
||||||
|
### ~~Task #38: Billing Card (Kanan)~~ ✅ Selesai
|
||||||
|
|
||||||
|
### ~~Task #39: Danger Zone — Style~~ ✅ Selesai
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 🟡 P1 — BRIEF (brief.html)
|
||||||
|
|
||||||
|
### Task #40: Ubah jadi Overlay Panel ✅
|
||||||
|
|
||||||
|
**Referensi**: `template/src/components/BriefOverlay.tsx`
|
||||||
|
|
||||||
|
Styling updated — color palette visual, typography samples, elevation examples, keyboard shortcuts. Halaman stilistik mirror template content.
|
||||||
|
|
||||||
|
**Files**: `app/backend/views/brief.html`
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 🟡 GLOBAL ISSUES ✅
|
||||||
|
|
||||||
|
### Task #41: SVG Icons — Stroke-width
|
||||||
|
|
||||||
|
Periksa semua SVG inline, pastikan:
|
||||||
|
- Icon kecil (w-3.5, w-4): `stroke-width="1.5"`
|
||||||
|
- Icon besar (w-5, w-6, w-8+): `stroke-width="2"`
|
||||||
|
|
||||||
|
**Files**: Semua view files
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Task #42: Border Radius — `rounded-2xl`
|
||||||
|
|
||||||
|
Ubah dari `rounded-xl` ke `rounded-2xl` di:
|
||||||
|
- Host cards (host_list.html)
|
||||||
|
- Snippet cards (snippet_grid.html)
|
||||||
|
- Key cards (key_grid.html)
|
||||||
|
- Settings cards (settings.html)
|
||||||
|
- Modal containers (host_modal.html, snippets.html, keychain.html)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Task #43: Shadows
|
||||||
|
|
||||||
|
| Element | Target |
|
||||||
|
|---------|--------|
|
||||||
|
| Host card | `shadow-sm` normal, `shadow-lg` hover |
|
||||||
|
| Snippet card | `shadow-sm` |
|
||||||
|
| Key card | `shadow-sm` normal, `shadow-lg` hover |
|
||||||
|
| Modal | `shadow-2xl` |
|
||||||
|
| Settings card | `shadow-sm` |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Task #44: Text Styles
|
||||||
|
|
||||||
|
| Element | Target |
|
||||||
|
|---------|--------|
|
||||||
|
| Page title | `text-xl font-bold tracking-tight` |
|
||||||
|
| Subtitle | `text-xs text-on-surface-variant mt-0.5` |
|
||||||
|
| Card title | `font-bold text-base` |
|
||||||
|
| Label form | `text-xs font-bold text-on-surface-variant uppercase tracking-wider` |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Task #45: Search Input — `rounded-full`
|
||||||
|
|
||||||
|
Semua search input: `rounded-full` bukan `rounded-lg`.
|
||||||
|
|
||||||
|
**Files**: index.html, snippets.html, keychain.html, sftp.html
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Task #46: Nav — Icons
|
||||||
|
|
||||||
|
Periksa semua icon di nav (nav.html) apakah SVG sesuai dengan lucide equivalents:
|
||||||
|
- server → ok
|
||||||
|
- terminal → `TerminalSquare`
|
||||||
|
- folder-sync → `ArrowLeftRight`
|
||||||
|
- code2 → `Code`
|
||||||
|
- key-round → `Key`
|
||||||
|
- settings2 → `Settings`
|
||||||
|
|
||||||
|
**Files**: `app/backend/views/nav.html`
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 🗺️ Execution Order
|
||||||
|
|
||||||
|
```
|
||||||
|
1. Dashboard (P0) → index.html, host_list.html, host_modal.html
|
||||||
|
2. Terminal (P0) → terminal.html, terminal.js
|
||||||
|
3. Snippets (P0) → snippets.html, snippet_grid.html, model/handler
|
||||||
|
4. Keychain (P1) → keychain.html, key_grid.html
|
||||||
|
5. SFTP (P1) → sftp.html, sftp_pane.html
|
||||||
|
6. Settings (P1) → settings.html
|
||||||
|
7. Brief (P1) → brief.html, nav.html
|
||||||
|
8. Global (P1) → semua files
|
||||||
|
```
|
||||||
|
|
||||||
|
> **⚠️ Checklist selesai**: Setiap task di atas harus dihapus dari file ini setelah selesai dikerjakan.
|
||||||
Reference in New Issue
Block a user