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,112 @@
|
||||
<!-- SPDX-License-Identifier: AGPL-3.0-or-later -->
|
||||
<script setup lang="ts">
|
||||
import { DwButton, DwCallout } from "@docwell/ui";
|
||||
import { reactive, ref, watch } from "vue";
|
||||
import { useInstanceSettings } from "../settings";
|
||||
import { api, currentUser, errorMessage } from "../session";
|
||||
|
||||
// Outgoing mail: verification, password reset, invites and sign-in links.
|
||||
const { settings, error, saved, busy, save } = useInstanceSettings();
|
||||
const form = reactive({
|
||||
enabled: false,
|
||||
host: "",
|
||||
port: 587,
|
||||
username: "",
|
||||
password: "",
|
||||
tls: false,
|
||||
senderName: "",
|
||||
senderAddress: "",
|
||||
});
|
||||
const testTo = ref("");
|
||||
const testState = ref<{ ok: boolean; text: string } | null>(null);
|
||||
|
||||
watch(settings, (s) => {
|
||||
if (!s) return;
|
||||
Object.assign(form, { ...s.smtp, password: "" });
|
||||
testTo.value ||= currentUser.value?.email ?? "";
|
||||
});
|
||||
|
||||
function submit() {
|
||||
// An empty password keeps the stored one.
|
||||
const { password, ...rest } = form;
|
||||
save({ smtp: { ...rest, passwordSet: false, ...(password ? { password } : {}) } });
|
||||
}
|
||||
|
||||
async function sendTest() {
|
||||
testState.value = null;
|
||||
try {
|
||||
await api.settings.testEmail(testTo.value);
|
||||
testState.value = { ok: true, text: `Sent to ${testTo.value}. Check the inbox (and the spam folder).` };
|
||||
} catch (e) {
|
||||
testState.value = { ok: false, text: errorMessage(e) };
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<h1 class="text-2xl font-semibold tracking-tight">Email</h1>
|
||||
<p class="mt-1 text-ink-muted">
|
||||
Docwell sends verification, password reset, invite and sign-in emails through this server.
|
||||
</p>
|
||||
<DwCallout v-if="error" tone="danger" size="ui" class="mt-4">{{ error }}</DwCallout>
|
||||
<DwCallout v-if="saved" tone="success" size="ui" class="mt-4">Saved.</DwCallout>
|
||||
<DwCallout size="ui" class="mt-4 max-w-xl">
|
||||
If DOCWELL_SMTP_HOST is set for docwell-db, those environment values are applied again whenever it starts.
|
||||
</DwCallout>
|
||||
|
||||
<form v-if="settings" class="mt-6 grid max-w-xl gap-4 dw-card sm:grid-cols-2" @submit.prevent="submit">
|
||||
<label class="flex items-center gap-3 sm:col-span-2">
|
||||
<input v-model="form.enabled" type="checkbox" class="accent-primary" />
|
||||
<span class="font-medium">Send email through an SMTP server</span>
|
||||
</label>
|
||||
<label class="flex flex-col gap-1.5">
|
||||
<span class="text-ui-sm font-semibold">Host</span>
|
||||
<input v-model="form.host" :required="form.enabled" class="dw-input" placeholder="smtp.example.com" />
|
||||
</label>
|
||||
<label class="flex flex-col gap-1.5">
|
||||
<span class="text-ui-sm font-semibold">Port</span>
|
||||
<input v-model.number="form.port" type="number" min="1" max="65535" class="dw-input" />
|
||||
</label>
|
||||
<label class="flex flex-col gap-1.5">
|
||||
<span class="text-ui-sm font-semibold">Username</span>
|
||||
<input v-model="form.username" autocomplete="off" class="dw-input" />
|
||||
</label>
|
||||
<label class="flex flex-col gap-1.5">
|
||||
<span class="text-ui-sm font-semibold">Password</span>
|
||||
<input
|
||||
v-model="form.password"
|
||||
type="password"
|
||||
autocomplete="new-password"
|
||||
class="dw-input"
|
||||
:placeholder="settings.smtp.passwordSet ? 'Unchanged' : ''"
|
||||
/>
|
||||
</label>
|
||||
<label class="flex items-center gap-3 sm:col-span-2">
|
||||
<input v-model="form.tls" type="checkbox" class="accent-primary" />
|
||||
<span>Use TLS from the start (usually port 465; port 587 upgrades on its own)</span>
|
||||
</label>
|
||||
<label class="flex flex-col gap-1.5">
|
||||
<span class="text-ui-sm font-semibold">Sender name</span>
|
||||
<input v-model="form.senderName" class="dw-input" />
|
||||
</label>
|
||||
<label class="flex flex-col gap-1.5">
|
||||
<span class="text-ui-sm font-semibold">Sender address</span>
|
||||
<input v-model="form.senderAddress" type="email" required class="dw-input" />
|
||||
</label>
|
||||
<div class="sm:col-span-2">
|
||||
<DwButton type="submit" variant="primary" :disabled="busy">Save</DwButton>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<section v-if="settings" class="mt-6 max-w-xl dw-card">
|
||||
<h2 class="text-ui-lg">Test</h2>
|
||||
<p class="mt-1 text-ui-sm text-ink-muted">Sends a short email with the saved settings.</p>
|
||||
<form class="mt-3 flex flex-wrap gap-2" @submit.prevent="sendTest">
|
||||
<input v-model="testTo" type="email" required class="dw-input min-w-48 flex-1" aria-label="Send the test to" />
|
||||
<DwButton type="submit">Send test email</DwButton>
|
||||
</form>
|
||||
<DwCallout v-if="testState" :tone="testState.ok ? 'success' : 'danger'" size="ui" class="mt-3">
|
||||
{{ testState.text }}
|
||||
</DwCallout>
|
||||
</section>
|
||||
</template>
|
||||
Reference in new issue
Block a user