Build out the admin panel
- Overview: users, organizations, workspaces, spaces, pages, files and storage (org admins see their organization), plus pages open right now, the search index size, and version, uptime and database health. - Users: invite people by email (with resend, revoke and a copyable link when mail fails) and send a password-reset email. - Authentication: sign-up on or off, the email-domain allow-list, and sign-in links by email. - Branding: instance name, accent colour and logo. The web app shows them on the sign-in pages and applies the accent colour everywhere. - Email and Storage: SMTP and S3 settings with test buttons. - Maintenance: create, download and delete database backups, and a view of the background jobs with their last run, duration and errors. On the server, a small jobs registry records each search-indexing pass, and "search.rebuild" replaces the separate reindex endpoint. A new instance package serves the dashboard numbers, health and backups. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
92cd81fd96
commit
ffc6cc4fbc
31 files changed
+2326
-134
No files matched your search
@@ -0,0 +1,47 @@
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
import type { PublicSettings } from "@docwell/api-client";
|
||||
import { defineStore } from "pinia";
|
||||
import { ref } from "vue";
|
||||
import { useApi } from "../api";
|
||||
|
||||
const styleId = "docwell-branding";
|
||||
|
||||
/**
|
||||
* Applies an instance accent colour over the design system's. Dark mode
|
||||
* gets a lighter mix, so links stay readable on dark surfaces.
|
||||
*/
|
||||
function applyAccent(color: string) {
|
||||
document.getElementById(styleId)?.remove();
|
||||
if (!/^#[0-9a-f]{6}$/i.test(color)) return;
|
||||
const style = document.createElement("style");
|
||||
style.id = styleId;
|
||||
style.textContent =
|
||||
`:root{--dw-accent:${color};--dw-accent-soft:color-mix(in srgb,${color} 14%,white)}` +
|
||||
`.dark{--dw-accent:color-mix(in srgb,${color} 55%,white);--dw-accent-soft:color-mix(in srgb,${color} 25%,#0f1716)}`;
|
||||
document.head.append(style);
|
||||
}
|
||||
|
||||
/** The instance's public settings: name, logo, accent colour, sign-up and magic links. */
|
||||
export const useBrandingStore = defineStore("branding", () => {
|
||||
const api = useApi();
|
||||
const settings = ref<PublicSettings | null>(null);
|
||||
let pending: Promise<void> | null = null;
|
||||
|
||||
function load() {
|
||||
pending ??= api.settings
|
||||
.public()
|
||||
.then((s) => {
|
||||
settings.value = s;
|
||||
applyAccent(s.accentColor);
|
||||
if (s.appName) document.title = s.appName;
|
||||
})
|
||||
.catch(() => {
|
||||
// Branding is cosmetic; the app works without it.
|
||||
pending = null;
|
||||
});
|
||||
return pending;
|
||||
}
|
||||
|
||||
return { settings, load };
|
||||
});
|
||||
Reference in new issue
Block a user