Files
Docwell/Server/admin/src/main.ts
T
tajniak81andClaude Opus 5.5 ffc6cc4fbc 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>
2026-10-31 17:34:48 +01:00

53 lines
1.9 KiB
TypeScript

// SPDX-License-Identifier: AGPL-3.0-or-later
import { createApp } from "vue";
import { createRouter, createWebHistory } from "vue-router";
import App from "./App.vue";
import { currentUser, isSuperadmin, restoreSession } from "./session";
import "./style.css";
const router = createRouter({
history: createWebHistory("/admin/"),
routes: [
{ path: "/login", name: "login", component: () => import("./views/LoginView.vue"), meta: { public: true } },
{ path: "/", name: "overview", component: () => import("./views/OverviewView.vue") },
{ path: "/users", name: "users", component: () => import("./views/UsersView.vue") },
{ path: "/organizations", name: "organizations", component: () => import("./views/OrganizationsView.vue") },
{
path: "/authentication",
name: "authentication",
component: () => import("./views/AuthenticationView.vue"),
meta: { superadmin: true },
},
{
path: "/branding",
name: "branding",
component: () => import("./views/BrandingView.vue"),
meta: { superadmin: true },
},
{
path: "/storage",
name: "storage",
component: () => import("./views/StorageView.vue"),
meta: { superadmin: true },
},
{ path: "/email", name: "email", component: () => import("./views/EmailView.vue"), meta: { superadmin: true } },
{
path: "/maintenance",
name: "maintenance",
component: () => import("./views/MaintenanceView.vue"),
meta: { superadmin: true },
},
],
});
router.beforeEach(async (to) => {
await restoreSession();
if (!to.meta.public && !currentUser.value) return { name: "login", query: { redirect: to.fullPath } };
if (to.name === "login" && currentUser.value) return { name: "overview" };
// Instance-wide settings are for superadmins; org admins manage their org only.
if (to.meta.superadmin && !isSuperadmin.value) return { name: "overview" };
});
createApp(App).use(router).mount("#app");