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
@@ -1,8 +1,11 @@
|
||||
<!-- SPDX-License-Identifier: AGPL-3.0-or-later -->
|
||||
<script setup lang="ts">
|
||||
import { useTheme } from "@docwell/ui";
|
||||
import { useBrandingStore } from "./stores/branding";
|
||||
|
||||
useTheme();
|
||||
// The instance's accent colour and name apply everywhere, signed in or not.
|
||||
void useBrandingStore().load();
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
||||
@@ -1,20 +1,34 @@
|
||||
<!-- SPDX-License-Identifier: AGPL-3.0-or-later -->
|
||||
<script setup lang="ts">
|
||||
import { DwLogo } from "@docwell/ui";
|
||||
import { computed, onMounted } from "vue";
|
||||
import { useBrandingStore } from "../stores/branding";
|
||||
|
||||
defineProps<{ title: string }>();
|
||||
const branding = useBrandingStore();
|
||||
onMounted(() => branding.load());
|
||||
// An instance logo replaces the Docwell one; its name shows beside it.
|
||||
const logo = computed(() => branding.settings?.logo ?? "");
|
||||
const name = computed(() => branding.settings?.appName ?? "");
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="grid min-h-dvh lg:grid-cols-[minmax(0,5fr)_minmax(0,7fr)]">
|
||||
<!-- The sign-in screens are a brand moment: Ink Well with the reversed logo. -->
|
||||
<aside class="hidden flex-col justify-between bg-well p-12 text-white lg:flex">
|
||||
<DwLogo reversed class="h-10 self-start" />
|
||||
<div v-if="logo" class="flex items-center gap-3 self-start">
|
||||
<img :src="logo" alt="" class="h-10 max-w-40 rounded-sm bg-white/90 p-1" />
|
||||
<span class="text-ui-lg font-semibold">{{ name }}</span>
|
||||
</div>
|
||||
<DwLogo v-else reversed class="h-10 self-start" />
|
||||
<p class="max-w-sm font-serif text-doc-h2 text-white/90">{{ $t("auth.tagline") }}</p>
|
||||
</aside>
|
||||
<div class="grid place-items-center bg-surface-sunken px-4 py-10">
|
||||
<div class="w-full max-w-sm">
|
||||
<div class="mb-8 flex justify-center lg:hidden"><DwLogo class="h-8" /></div>
|
||||
<div class="mb-8 flex justify-center lg:hidden">
|
||||
<img v-if="logo" :src="logo" :alt="name" class="h-10 max-w-48" />
|
||||
<DwLogo v-else class="h-8" />
|
||||
</div>
|
||||
<div class="rounded-md border border-line bg-surface-raised p-6">
|
||||
<h1 class="mb-5 text-ui-lg">{{ title }}</h1>
|
||||
<slot />
|
||||
|
||||
@@ -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