fix: modal scroll, SSH key textarea, nav full-page, remove OS/Provider
- Fix modal scroll: restructure overlay with scroll/centering wrapper - Add SSH key textarea + file upload to host modal (authType='key') - Fix textarea reset on new host (clear via DOM) - SSH username placeholder instead of default 'root' - Nav uses plain <a href> instead of HTMX for full-page navigation - /hosts route returns full page; /hosts/list for HTMX partials - Remove OS and Provider from host modal, grid card, and list card - Fix key modal x-data scope for Alpine $dispatch - Update key_grid to display multi-line key content properly - Simplify SSH key placeholder format
This commit is contained in:
@@ -20,7 +20,7 @@
|
||||
<header class="h-14 border-b border-outline-variant/30 flex items-center px-6 bg-white/70 backdrop-blur-md">
|
||||
<h1 class="text-lg font-semibold text-on-surface">{{.Title}}</h1>
|
||||
</header>
|
||||
<main id="main-content" class="flex-1 overflow-auto p-6">
|
||||
<main id="main-content" class="flex-1 overflow-auto p-6" x-data>
|
||||
<div class="max-w-7xl mx-auto space-y-8">
|
||||
<!-- Header Panel -->
|
||||
<div class="flex flex-col sm:flex-row sm:items-center justify-between gap-4 border-b border-outline-variant/30 pb-4">
|
||||
@@ -61,27 +61,42 @@
|
||||
</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-show="open" x-cloak
|
||||
x-data="{ open: false, readFile($event) {
|
||||
const file = $event.target.files[0];
|
||||
if (!file) return;
|
||||
const reader = new FileReader();
|
||||
reader.onload = (e) => {
|
||||
document.querySelector('textarea[name=passphrase]').value = e.target.result;
|
||||
document.querySelector('textarea[name=passphrase]').dispatchEvent(new Event('input'));
|
||||
};
|
||||
reader.readAsText(file);
|
||||
}}"
|
||||
@open-key-modal.window="open = true" @keydown.escape.window="open = false">
|
||||
<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="bg-white rounded-2xl max-w-md w-full border border-outline-variant/30 shadow-2xl p-6 space-y-4">
|
||||
<div class="flex justify-between items-center border-b border-outline-variant/30 pb-3">
|
||||
<div class="bg-white rounded-2xl max-w-lg w-full border border-outline-variant/30 shadow-2xl max-h-[90vh] overflow-y-auto">
|
||||
|
||||
<div class="flex justify-between items-center border-b border-outline-variant/30 p-6 pb-4">
|
||||
<h3 class="font-bold text-lg text-on-surface">Register Secure Credential</h3>
|
||||
<button @click="open = false" class="text-outline hover:text-primary p-1 rounded">Cancel</button>
|
||||
<button @click="open = false" 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>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<form hx-post="/keys" hx-target="#key-grid" hx-swap="innerHTML"
|
||||
@submit="open = false" class="space-y-4 text-sm">
|
||||
<div class="flex flex-col gap-1">
|
||||
<label class="text-xs font-bold text-on-surface-variant">CREDENTIAL NAME / LABEL</label>
|
||||
@submit="open = false" class="p-6 space-y-4 text-sm">
|
||||
<div class="flex flex-col gap-1.5">
|
||||
<label class="text-xs font-bold text-on-surface-variant uppercase">Credential Name / Label</label>
|
||||
<input type="text" name="name" required placeholder="e.g. key_aws_alex"
|
||||
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">
|
||||
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="grid grid-cols-2 gap-4">
|
||||
<div class="flex flex-col gap-1">
|
||||
<label class="text-xs font-bold text-on-surface-variant">CREDENTIAL TYPE</label>
|
||||
<div class="flex flex-col gap-1.5">
|
||||
<label class="text-xs font-bold text-on-surface-variant uppercase">Credential Type</label>
|
||||
<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">
|
||||
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="ED25519">ED25519 (Modern)</option>
|
||||
<option value="SSH RSA">SSH RSA (Legacy)</option>
|
||||
<option value="PASSWORD">Master Password</option>
|
||||
@@ -89,22 +104,33 @@
|
||||
<option value="AWS Key">AWS Access Key</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="flex flex-col gap-1">
|
||||
<label class="text-xs font-bold text-on-surface-variant">LOGIN USERNAME</label>
|
||||
<div class="flex flex-col gap-1.5">
|
||||
<label class="text-xs font-bold text-on-surface-variant uppercase">Login Username</label>
|
||||
<input type="text" name="username" required placeholder="e.g. root or ubuntu"
|
||||
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">
|
||||
class="w-full bg-surface-container-low border border-outline-variant/40 rounded-lg py-2.5 px-3 focus:outline-none focus:border-primary text-on-surface">
|
||||
</div>
|
||||
</div>
|
||||
<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 class="flex flex-col gap-1.5">
|
||||
<label class="text-xs font-bold text-on-surface-variant uppercase">Key / Secret Value</label>
|
||||
<textarea name="passphrase" required rows="5"
|
||||
placeholder="Paste your key or secret here... Example SSH key: -----BEGIN OPENSSH PRIVATE KEY----- b3BlbnNzaC1rZXktdjEAAAAIA... -----END OPENSSH PRIVATE KEY-----"
|
||||
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 text-xs resize-none leading-relaxed"></textarea>
|
||||
<div class="flex items-center gap-3 mt-1">
|
||||
<label class="flex items-center gap-1.5 text-xs text-on-surface-variant cursor-pointer hover:text-primary transition-colors">
|
||||
<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 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>
|
||||
Or upload a key file
|
||||
</label>
|
||||
<input type="file" class="hidden" accept=".pem,.key,.pub,.txt,.ppk,.p12,.pfx" @change="readFile($event)">
|
||||
<span class="text-[10px] text-outline">.pem .key .ppk .pub .txt</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="pt-4 flex justify-end gap-3 border-t border-outline-variant/20">
|
||||
<button type="button" @click="open = false"
|
||||
class="px-4 py-2 text-xs font-bold text-outline hover:text-on-surface">Cancel</button>
|
||||
class="px-4 py-2 text-xs font-bold text-outline hover:text-on-surface transition-colors">Cancel</button>
|
||||
<button type="submit"
|
||||
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>
|
||||
class="bg-primary text-white py-2 px-5 rounded-lg font-bold text-xs shadow-md hover:bg-primary-container hover:text-on-primary-container transition-all">Save Credential</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user