package pages import ( "git.ma-al.com/goc_marek/zfs/internal/server/templates/components" ) // AdminPage renders the main admin panel templ AdminPage(username string) { @components.Layout("ZFS Backup Admin Panel", username) {
@components.Header(username)
@components.StatsCard("Clients", "Loading...") @components.StatsCard("Total Snapshots", "Loading...") @components.StatsCard("Total Storage", "Loading...")
@components.TabButton("clients", "Clients", true) @components.TabButton("snapshots", "Snapshots", false) @components.TabButton("admins", "Admins", false)

Clients

Client ID Storage Type Quota Used Snapshots Status Actions
@AddClientModal() @EditClientModal() @AddAdminModal() @ChangePasswordModal() @ClientPasswordModal() @AdminScripts() } } // AddClientModal renders the add client modal templ AddClientModal() { @components.Modal("add-client-modal", "Add New Client") {
@components.FormInput("new-client-id", "Client ID", "text", "", true) @components.FormInput("new-client-apikey", "API Key", "text", "", true) @components.FormSelect("new-client-storage", "Storage Type", []components.SelectOption{ {Value: "s3", Label: "S3", Selected: true}, {Value: "local", Label: "Local ZFS", Selected: false}, }) @components.FormInput("new-client-dataset", "Target Dataset (for local storage)", "text", "backup/client1", false) @components.FormInput("new-client-quota", "Quota (GB)", "number", "100", true) @components.FormCheckbox("new-client-enabled", "Enabled", true)

Rotation Policy

@components.FormInput("new-client-hourly", "Keep Hourly", "number", "24", false) @components.FormInput("new-client-daily", "Keep Daily", "number", "7", false) @components.FormInput("new-client-weekly", "Keep Weekly", "number", "4", false) @components.FormInput("new-client-monthly", "Keep Monthly", "number", "12", false)
} } // EditClientModal renders the edit client modal templ EditClientModal() { @components.Modal("edit-client-modal", "Edit Client") {
@components.FormInput("edit-client-apikey", "New API Key (leave empty to keep current)", "text", "Leave empty to keep current", false) @components.FormSelect("edit-client-storage", "Storage Type", []components.SelectOption{ {Value: "s3", Label: "S3", Selected: true}, {Value: "local", Label: "Local ZFS", Selected: false}, }) @components.FormInput("edit-client-dataset", "Target Dataset", "text", "", false) @components.FormInput("edit-client-quota", "Quota (GB)", "number", "", true) @components.FormCheckbox("edit-client-enabled", "Enabled", false)

Rotation Policy

@components.FormInput("edit-client-hourly", "Keep Hourly", "number", "", false) @components.FormInput("edit-client-daily", "Keep Daily", "number", "", false) @components.FormInput("edit-client-weekly", "Keep Weekly", "number", "", false) @components.FormInput("edit-client-monthly", "Keep Monthly", "number", "", false)
} } // AddAdminModal renders the add admin modal templ AddAdminModal() { @components.Modal("add-admin-modal", "Add New Admin") {
@components.FormInput("new-admin-username", "Username", "text", "", true) @components.FormInput("new-admin-password", "Password", "password", "", true) @components.FormSelect("new-admin-role", "Role", []components.SelectOption{ {Value: "admin", Label: "Admin", Selected: true}, })
} } // ChangePasswordModal renders the change password modal for admins templ ChangePasswordModal() { @components.Modal("change-password-modal", "Change Password") {
@components.FormInput("change-password-username", "Admin Username", "text", "", true) @components.FormInput("change-password-new", "New Password", "password", "", true) @components.FormInput("change-password-confirm", "Confirm New Password", "password", "", true)
} } // ClientPasswordModal renders the set client API key modal templ ClientPasswordModal() { @components.Modal("client-password-modal", "Set Client API Key") {
@components.FormInput("client-password-client-name", "Client ID", "text", "", true) @components.FormInput("client-password-new", "New API Key", "text", "", true) @components.FormInput("client-password-confirm", "Confirm API Key", "text", "", true)
} } // AdminScripts renders the JavaScript for the admin panel templ AdminScripts() { }