Major UI refresh on the nav-design-improvements branch. Drops 2013-era
inline styles and consolidates patterns behind shared primitives.
Foundation
- New Wulf brand layer in app/styles/brand.css repointing --primary to
the standards-guide blue (#0075AD) with utility classes for numerics
(.num / .num-lg / .num-xl), metric labels, surface tints, and the
wolf-mark watermark
- Switch primary face to IBM Plex Sans + IBM Plex Mono via next/font;
Helvetica/Arial stays in the fallback chain for brand fidelity
- Wordmark subtitle changed from "PSA Management System" to
"Operations console" everywhere it appeared
- Tagline footer ("Don't be afraid to cry") on every non-mobile page
Status moved out of /dashboard
- New /status route with integration tiles grouped by category, sync
health table, worker pulse cards (analyzer / RMM / sync scheduler),
token-expiry section, conditional alert banner
- Top-bar StatusIndicator polls integration health every 60s and links
to /status
- INTEGRATIONS_DISABLED env var suppresses operator-disabled
integrations (e.g. SentinelOne) — no failure noise from broken-on-
purpose entries. Aliases supported (sentinelone → s1, etc.)
Dashboard rebuilt around KPIs
- /api/dashboard/overview adds today snapshot (opened, resolved, open
total, SLA breaches) with delta math
- /api/dashboard/trends backs queue × priority heatmap, 30-day volume
area chart, 30-day mean resolution time line chart, today's active
engineers leaderboard
Components
- StatusBadge driven by lib/status-registry.ts (priority, ticket
status, classification, source, company type, publish, active /
yes-no / billable / approved registries)
- StatusLight (8px geometric square, five states, three sizes)
- EmptyState (shared dashed panel with icon + headline + optional CTA)
- KpiCard with delta indicator and tonal left border
- WulfMark (mark / wordmark variants from /public/branding)
- Skeleton helpers (SkeletonRow / Rows / Card / Chart / Header / Table)
Navigation
- Admin flat link → dropdown with seven shortcuts
- New UserMenu (initials avatar, role badge, settings + sign-out)
- Active-route highlight is now a 2px Wulf-blue underline echoing the
PageHeader rule (consistent across flat links and submenu triggers);
active children inside dropdowns use bg-primary/10
- Submenu width is content-driven (min-w 320 / max-w 440, single col)
- Mobile hamburger via Sheet, reuses the same nav config
Pages migrated
- 16 admin sub-pages adopt PageHeader (with accent prop)
- /addigy-devices: shadcn Table + Checkbox; PageHeader; status badges
- 10 raw <table> blocks across admin/sync/* migrated to shadcn Table
- /veeam-analysis migrated to shadcn Table (kept its expansion logic)
- Detail routes (analyzer ticket, analyzer analysis) get breadcrumbs
DataTable
- Rewritten on @tanstack/react-table v8 in manual mode; external API
unchanged so all 10+ data-browser pages keep working
- New optional props for drill-down rows: getRowCanExpand + renderSubRow
Mobile
- Multi-select Popover gets max-w-[calc(100vw-1rem)] and
collisionPadding so dropdowns can't overflow narrow viewports
- CI filter bar wraps and shrinks; stat pill flows below
Docs
- New ARCHITECTURE.md (load-bearing reference for runtime, data flow,
workers, analyzer pipeline, auth, deployment, gotchas)
- New DESIGN.md (tokens, layout, navigation IA, component vocabulary,
rolling backlog of remaining cleanup)
- CLAUDE.md refreshed with pointers to the two new docs and the
INTEGRATIONS_DISABLED operator config note
- shadcn registry registered as project-level MCP server (.mcp.json)
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
175 lines
5.7 KiB
TypeScript
175 lines
5.7 KiB
TypeScript
"use client";
|
|
|
|
import { useState, useEffect } from "react";
|
|
import { Loader2, Save } from "lucide-react";
|
|
import { toast } from "sonner";
|
|
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card";
|
|
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
|
|
import { Button } from "@/components/ui/button";
|
|
import { Input } from "@/components/ui/input";
|
|
import { Label } from "@/components/ui/label";
|
|
import { PageHeader } from '@/components/navigation/page-header';
|
|
|
|
export default function SettingsPage() {
|
|
const [settings, setSettings] = useState<Record<string, string>>({});
|
|
const [isLoading, setIsLoading] = useState(true);
|
|
const [isSaving, setIsSaving] = useState(false);
|
|
|
|
useEffect(() => {
|
|
fetchSettings();
|
|
}, []);
|
|
|
|
async function fetchSettings() {
|
|
try {
|
|
const response = await fetch("/api/admin/settings");
|
|
if (!response.ok) throw new Error("Failed to fetch settings");
|
|
const data = await response.json();
|
|
setSettings(data.settings);
|
|
} catch (error) {
|
|
toast.error("Failed to load settings");
|
|
} finally {
|
|
setIsLoading(false);
|
|
}
|
|
}
|
|
|
|
async function handleSave() {
|
|
setIsSaving(true);
|
|
try {
|
|
const response = await fetch("/api/admin/settings", {
|
|
method: "PATCH",
|
|
headers: { "Content-Type": "application/json" },
|
|
body: JSON.stringify({ settings }),
|
|
});
|
|
|
|
if (!response.ok) throw new Error("Failed to save settings");
|
|
toast.success("Settings saved successfully");
|
|
} catch (error) {
|
|
toast.error("Failed to save settings");
|
|
} finally {
|
|
setIsSaving(false);
|
|
}
|
|
}
|
|
|
|
function updateSetting(key: string, value: string) {
|
|
setSettings((prev) => ({ ...prev, [key]: value }));
|
|
}
|
|
|
|
if (isLoading) {
|
|
return (
|
|
<div className="container mx-auto py-8 px-4 flex justify-center">
|
|
<Loader2 className="h-8 w-8 animate-spin" />
|
|
</div>
|
|
);
|
|
}
|
|
|
|
return (
|
|
<>
|
|
<PageHeader
|
|
title="Settings"
|
|
description="Configure application settings"
|
|
breadcrumbs={[{ label: 'Admin', href: '/admin' }, { label: 'Settings' }]}
|
|
accent
|
|
/>
|
|
<div className="container mx-auto py-8 px-4">
|
|
<Tabs defaultValue="microsoft" className="space-y-6">
|
|
<TabsList>
|
|
<TabsTrigger value="microsoft">Microsoft</TabsTrigger>
|
|
<TabsTrigger value="sessions">Sessions</TabsTrigger>
|
|
<TabsTrigger value="audit">Audit</TabsTrigger>
|
|
</TabsList>
|
|
|
|
<TabsContent value="microsoft">
|
|
<Card>
|
|
<CardHeader>
|
|
<CardTitle>Microsoft Entra ID</CardTitle>
|
|
<CardDescription>
|
|
Configure Microsoft 365 authentication settings
|
|
</CardDescription>
|
|
</CardHeader>
|
|
<CardContent className="space-y-4">
|
|
<div className="space-y-2">
|
|
<Label htmlFor="tenant">Tenant ID</Label>
|
|
<Input
|
|
id="tenant"
|
|
value={settings.microsoft_tenant_id || ""}
|
|
onChange={(e) => updateSetting("microsoft_tenant_id", e.target.value)}
|
|
placeholder="common or your-tenant-id"
|
|
/>
|
|
<p className="text-sm text-muted-foreground">
|
|
Use "common" for multi-tenant or specify your organization's tenant ID
|
|
</p>
|
|
</div>
|
|
</CardContent>
|
|
</Card>
|
|
</TabsContent>
|
|
|
|
<TabsContent value="sessions">
|
|
<Card>
|
|
<CardHeader>
|
|
<CardTitle>Session Settings</CardTitle>
|
|
<CardDescription>
|
|
Configure session timeout and security policies
|
|
</CardDescription>
|
|
</CardHeader>
|
|
<CardContent className="space-y-4">
|
|
<div className="space-y-2">
|
|
<Label htmlFor="timeout">Default Session Timeout (seconds)</Label>
|
|
<Input
|
|
id="timeout"
|
|
type="number"
|
|
value={settings.default_session_timeout || "86400"}
|
|
onChange={(e) => updateSetting("default_session_timeout", e.target.value)}
|
|
/>
|
|
<p className="text-sm text-muted-foreground">
|
|
Default: 86400 (24 hours)
|
|
</p>
|
|
</div>
|
|
</CardContent>
|
|
</Card>
|
|
</TabsContent>
|
|
|
|
<TabsContent value="audit">
|
|
<Card>
|
|
<CardHeader>
|
|
<CardTitle>Audit Log Settings</CardTitle>
|
|
<CardDescription>
|
|
Configure audit log retention
|
|
</CardDescription>
|
|
</CardHeader>
|
|
<CardContent className="space-y-4">
|
|
<div className="space-y-2">
|
|
<Label htmlFor="retention">Retention Period (days)</Label>
|
|
<Input
|
|
id="retention"
|
|
type="number"
|
|
value={settings.audit_log_retention_days || "90"}
|
|
onChange={(e) => updateSetting("audit_log_retention_days", e.target.value)}
|
|
/>
|
|
<p className="text-sm text-muted-foreground">
|
|
Audit logs older than this will be automatically deleted
|
|
</p>
|
|
</div>
|
|
</CardContent>
|
|
</Card>
|
|
</TabsContent>
|
|
</Tabs>
|
|
|
|
<div className="mt-6">
|
|
<Button onClick={handleSave} disabled={isSaving}>
|
|
{isSaving ? (
|
|
<>
|
|
<Loader2 className="mr-2 h-4 w-4 animate-spin" />
|
|
Saving...
|
|
</>
|
|
) : (
|
|
<>
|
|
<Save className="mr-2 h-4 w-4" />
|
|
Save Settings
|
|
</>
|
|
)}
|
|
</Button>
|
|
</div>
|
|
</div>
|
|
</>
|
|
);
|
|
}
|