Toasts, logo icons, shared table toolbar with search, and a density toggle
Feedback: toasts confirm common actions, and a page's error or success message that appears out of view is also shown as a toast. Icons: the tab, app and home-screen icons are the house from the logo; a dev instance gets a coloured dot on its tab icon. Tables: Secrets, Admin Links, IP Addresses and Alerts share one toolbar (search, filters, row count, actions, Export CSV); twelve more tables get a multi-word search box; long tables keep their column headings in view on wide screens. Density: Compact / Normal / Roomy in the user menu, remembered per browser. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
7d56ad18b7
commit
617dc1ea2f
56 files changed
+757
-158
No files matched your search
@@ -6,6 +6,8 @@ import SortableTh from "../components/SortableTh";
|
||||
import { downloadCsv } from "../utils/csv";
|
||||
import { guessAdminUrl, portOptionLabel } from "../utils/adminLinkUrl";
|
||||
import { confirmDialog } from "../utils/dialogs";
|
||||
import { ErrorNotice } from "../components/Notice";
|
||||
import TableToolbar from "../components/TableToolbar";
|
||||
|
||||
interface LinkForm {
|
||||
serverId: number | "";
|
||||
@@ -153,7 +155,7 @@ export default function AdminLinks({ user }: { user: CurrentUser }) {
|
||||
Every admin bookmark added to a server's own page (Infrastructure → Servers → a server → Admin Links) — Dockge,
|
||||
Webmin, Cockpit, and the like — in one place, instead of visiting each server to find them.
|
||||
</p>
|
||||
{error && <div className="alert alert-danger">{error}</div>}
|
||||
<ErrorNotice error={error} />
|
||||
|
||||
{canEdit && showForm && (
|
||||
<div className="card mb-3">
|
||||
@@ -249,25 +251,22 @@ export default function AdminLinks({ user }: { user: CurrentUser }) {
|
||||
)}
|
||||
|
||||
<div className="card">
|
||||
<div className="card-header">
|
||||
<input
|
||||
className="form-control"
|
||||
style={{ maxWidth: 280 }}
|
||||
placeholder="Search server, label, URL…"
|
||||
value={search}
|
||||
onChange={(e) => setSearch(e.target.value)}
|
||||
/>
|
||||
<div className="card-actions">
|
||||
{canEdit && !showForm && (
|
||||
<TableToolbar
|
||||
search={search}
|
||||
onSearch={setSearch}
|
||||
placeholder="Search server, label, URL…"
|
||||
shown={filtered.length}
|
||||
total={links?.length}
|
||||
actions={
|
||||
canEdit && !showForm ? (
|
||||
<button className="btn btn-primary btn-sm" onClick={startAdd}>
|
||||
Add link
|
||||
</button>
|
||||
)}
|
||||
<button className="btn btn-sm btn-outline-secondary" onClick={exportCsv} disabled={!sorted?.length}>
|
||||
Export CSV
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
) : undefined
|
||||
}
|
||||
onExport={exportCsv}
|
||||
exportDisabled={!sorted?.length}
|
||||
/>
|
||||
<div className="table-responsive">
|
||||
<table className="table table-vcenter card-table">
|
||||
<thead>
|
||||
|
||||
+32
-26
@@ -9,6 +9,8 @@ import { downloadCsv } from "../utils/csv";
|
||||
import { formatDateTime } from "../utils/date";
|
||||
import { formatAgo } from "../utils/duration";
|
||||
import { readableError } from "../utils/errors";
|
||||
import { ErrorNotice } from "../components/Notice";
|
||||
import TableToolbar from "../components/TableToolbar";
|
||||
|
||||
const SEVERITY: Record<AlertSeverity, { label: string; badge: string; rank: number }> = {
|
||||
critical: { label: "Critical", badge: "bg-red-lt text-red", rank: 0 },
|
||||
@@ -113,7 +115,7 @@ export default function Alerts(_props: { user: CurrentUser }) {
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
{error && <div className="alert alert-danger">{error}</div>}
|
||||
<ErrorNotice error={error} />
|
||||
|
||||
{!report && !error && (
|
||||
<div className="card">
|
||||
@@ -172,31 +174,35 @@ export default function Alerts(_props: { user: CurrentUser }) {
|
||||
</div>
|
||||
) : (
|
||||
<div className="card">
|
||||
<div className="card-header">
|
||||
<div className="d-flex flex-wrap gap-2 align-items-center w-100">
|
||||
<input className="form-control" style={{ maxWidth: 260 }} placeholder="Search alerts…" value={search} onChange={(e) => setSearch(e.target.value)} />
|
||||
<select className="form-select w-auto" value={severity} onChange={(e) => setSeverity(e.target.value as "all" | AlertSeverity)}>
|
||||
<option value="all">All severities</option>
|
||||
<option value="critical">Critical</option>
|
||||
<option value="warning">Warning</option>
|
||||
<option value="info">Info</option>
|
||||
</select>
|
||||
<select className="form-select w-auto" value={category} onChange={(e) => setCategory(e.target.value as "all" | AlertCategory)}>
|
||||
<option value="all">All kinds</option>
|
||||
{presentCategories.map((c) => (
|
||||
<option key={c} value={c}>
|
||||
{CATEGORY_LABELS[c]}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
{(counts?.silenced ?? 0) > 0 && (
|
||||
<label className="form-check mb-0">
|
||||
<input type="checkbox" className="form-check-input" checked={showSilenced} onChange={(e) => setShowSilenced(e.target.checked)} />
|
||||
<span className="form-check-label">Show silenced</span>
|
||||
</label>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
<TableToolbar
|
||||
search={search}
|
||||
onSearch={setSearch}
|
||||
placeholder="Search alerts…"
|
||||
filters={
|
||||
<>
|
||||
<select className="form-select form-select-sm w-auto" value={severity} onChange={(e) => setSeverity(e.target.value as "all" | AlertSeverity)}>
|
||||
<option value="all">All severities</option>
|
||||
<option value="critical">Critical</option>
|
||||
<option value="warning">Warning</option>
|
||||
<option value="info">Info</option>
|
||||
</select>
|
||||
<select className="form-select form-select-sm w-auto" value={category} onChange={(e) => setCategory(e.target.value as "all" | AlertCategory)}>
|
||||
<option value="all">All kinds</option>
|
||||
{presentCategories.map((c) => (
|
||||
<option key={c} value={c}>
|
||||
{CATEGORY_LABELS[c]}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
{(counts?.silenced ?? 0) > 0 && (
|
||||
<label className="form-check mb-0">
|
||||
<input type="checkbox" className="form-check-input" checked={showSilenced} onChange={(e) => setShowSilenced(e.target.checked)} />
|
||||
<span className="form-check-label">Show silenced</span>
|
||||
</label>
|
||||
)}
|
||||
</>
|
||||
}
|
||||
/>
|
||||
<div className="table-responsive">
|
||||
<table className="table table-vcenter card-table">
|
||||
<thead>
|
||||
|
||||
@@ -6,6 +6,9 @@ import SortableTh from "../components/SortableTh";
|
||||
import { usePagination } from "../hooks/usePagination";
|
||||
import Pagination from "../components/Pagination";
|
||||
import { downloadCsv } from "../utils/csv";
|
||||
import { ErrorNotice } from "../components/Notice";
|
||||
import { SearchBox } from "../components/TableToolbar";
|
||||
import { useTableSearch } from "../hooks/useTableSearch";
|
||||
|
||||
function targetLabel(e: AuditLogEntry): string {
|
||||
if (!e.targetType) return "—";
|
||||
@@ -50,7 +53,8 @@ export default function AuditLog() {
|
||||
.catch((err) => setError(String(err)));
|
||||
}, []);
|
||||
|
||||
const { sorted, sortKey, sortDir, requestSort } = useSortable(entries, "createdAt", "desc");
|
||||
const tableSearch = useTableSearch(entries);
|
||||
const { sorted, sortKey, sortDir, requestSort } = useSortable(tableSearch.filtered, "createdAt", "desc");
|
||||
const { pageItems, page, setPage, pageCount, totalCount } = usePagination(sorted);
|
||||
|
||||
function exportCsv() {
|
||||
@@ -70,8 +74,11 @@ export default function AuditLog() {
|
||||
Export CSV
|
||||
</button>
|
||||
</div>
|
||||
{error && <div className="alert alert-danger">{error}</div>}
|
||||
<ErrorNotice error={error} />
|
||||
<div className="card">
|
||||
<div className="card-header">
|
||||
<SearchBox value={tableSearch.query} onChange={tableSearch.setQuery} />
|
||||
</div>
|
||||
<div className="table-responsive">
|
||||
<table className="table table-vcenter card-table">
|
||||
<thead>
|
||||
|
||||
@@ -6,6 +6,7 @@ import { formatDateTime, parseDbTimestamp } from "../utils/date";
|
||||
import { formatAgo } from "../utils/duration";
|
||||
import { readableError } from "../utils/errors";
|
||||
import { promptDialog } from "../utils/dialogs";
|
||||
import { ErrorNotice, SuccessNotice } from "../components/Notice";
|
||||
|
||||
const KINDS: { kind: ConsistencyKind; title: string; blurb: string }[] = [
|
||||
{ kind: "ip_conflict", title: "Address conflicts", blurb: "The same address reported by more than one server." },
|
||||
@@ -169,8 +170,8 @@ export default function Consistency({ user }: { user: CurrentUser }) {
|
||||
Where IPAM, DNS and your servers disagree about what lives at an address. It compares what's already stored — nothing is
|
||||
fetched from the servers or DNS providers when you open this page.
|
||||
</div>
|
||||
{error && <div className="alert alert-danger">{error}</div>}
|
||||
{notice && <div className="alert alert-success">{notice}</div>}
|
||||
<ErrorNotice error={error} />
|
||||
<SuccessNotice notice={notice} />
|
||||
|
||||
{report && (
|
||||
<div className="card mb-3">
|
||||
|
||||
@@ -14,6 +14,7 @@ import {
|
||||
} from "../api/client";
|
||||
import { formatAgo } from "../utils/duration";
|
||||
import StatusStrip from "../components/StatusStrip";
|
||||
import { ErrorNotice } from "../components/Notice";
|
||||
|
||||
const DNS_TYPE_COLORS: Record<string, string> = {
|
||||
A: "#60a5fa",
|
||||
@@ -576,7 +577,7 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
|
||||
)
|
||||
}
|
||||
>
|
||||
{dnsError && <div className="alert alert-danger mb-2">{dnsError}</div>}
|
||||
<ErrorNotice error={dnsError} className="mb-2" />
|
||||
{!dnsStats ? (
|
||||
<div className="text-secondary">Fetching status…</div>
|
||||
) : dnsStats.totalProviders === 0 ? (
|
||||
@@ -669,7 +670,7 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
|
||||
)
|
||||
}
|
||||
>
|
||||
{serverError && <div className="alert alert-danger mb-2">{serverError}</div>}
|
||||
<ErrorNotice error={serverError} className="mb-2" />
|
||||
{!serverSummary ? (
|
||||
!serverError && <div className="text-secondary">Fetching status…</div>
|
||||
) : serverSummary.total === 0 ? (
|
||||
@@ -762,7 +763,7 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
|
||||
)
|
||||
}
|
||||
>
|
||||
{domainError && <div className="alert alert-danger mb-2">{domainError}</div>}
|
||||
<ErrorNotice error={domainError} className="mb-2" />
|
||||
{!domainList ? (
|
||||
!domainError && <div className="text-secondary">Fetching status…</div>
|
||||
) : domains.length === 0 ? (
|
||||
|
||||
@@ -5,6 +5,7 @@ import { useSortable } from "../hooks/useSortable";
|
||||
import SortableTh from "../components/SortableTh";
|
||||
import { downloadCsv } from "../utils/csv";
|
||||
import { confirmDialog } from "../utils/dialogs";
|
||||
import { ErrorNotice } from "../components/Notice";
|
||||
|
||||
const SOURCE_LABELS: Record<string, string> = {
|
||||
cloudflare: "Cloudflare",
|
||||
@@ -103,7 +104,7 @@ export default function DiagLog() {
|
||||
{clearing ? "Clearing…" : "Clear log"}
|
||||
</button>
|
||||
</div>
|
||||
{error && <div className="alert alert-danger">{error}</div>}
|
||||
<ErrorNotice error={error} />
|
||||
|
||||
<div className="card mb-3">
|
||||
<div className="card-body">
|
||||
|
||||
@@ -17,6 +17,8 @@ import { usePagination } from "../hooks/usePagination";
|
||||
import Pagination from "../components/Pagination";
|
||||
import { downloadCsv } from "../utils/csv";
|
||||
import { confirmDialog } from "../utils/dialogs";
|
||||
import { ErrorNotice } from "../components/Notice";
|
||||
import { toast } from "../utils/toast";
|
||||
|
||||
const PROVIDER_LABELS: Record<DnsProviderType, string> = {
|
||||
cloudflare: "Cloudflare",
|
||||
@@ -168,8 +170,10 @@ export default function Dns({ user }: { user: CurrentUser }) {
|
||||
try {
|
||||
if (editingRecordId) {
|
||||
await api.dns.records.update(selectedProviderId, selectedZone.id, editingRecordId, recordForm);
|
||||
toast.success("Record updated.");
|
||||
} else {
|
||||
await api.dns.records.create(selectedProviderId, selectedZone.id, recordForm);
|
||||
toast.success("Record added.");
|
||||
}
|
||||
setRecordForm(null);
|
||||
setEditingRecordId(null);
|
||||
@@ -187,6 +191,7 @@ export default function Dns({ user }: { user: CurrentUser }) {
|
||||
setError(null);
|
||||
try {
|
||||
await api.dns.records.remove(selectedProviderId, selectedZone.id, r.id);
|
||||
toast.success(`Deleted ${r.type} record ${r.name}.`);
|
||||
loadRecords(selectedProviderId, selectedZone);
|
||||
} catch (err) {
|
||||
setError(err instanceof Error ? err.message : String(err));
|
||||
@@ -270,7 +275,7 @@ export default function Dns({ user }: { user: CurrentUser }) {
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
{error && <div className="alert alert-danger">{error}</div>}
|
||||
<ErrorNotice error={error} />
|
||||
|
||||
{managingProviders ? (
|
||||
<>
|
||||
@@ -402,7 +407,7 @@ export default function Dns({ user }: { user: CurrentUser }) {
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
{zonesError && <div className="alert alert-danger m-3 mb-0">{zonesError}</div>}
|
||||
<ErrorNotice error={zonesError} className="m-3 mb-0" />
|
||||
<div className="table-responsive">
|
||||
<table className="table table-vcenter card-table">
|
||||
<thead>
|
||||
|
||||
@@ -14,6 +14,10 @@ import Pagination from "../components/Pagination";
|
||||
import { downloadCsv } from "../utils/csv";
|
||||
import { confirmDialog } from "../utils/dialogs";
|
||||
import IntegrationPageTitle from "../components/IntegrationPageTitle";
|
||||
import { ErrorNotice } from "../components/Notice";
|
||||
import { toast } from "../utils/toast";
|
||||
import { SearchBox } from "../components/TableToolbar";
|
||||
import { useTableSearch } from "../hooks/useTableSearch";
|
||||
|
||||
function updateBadge(c: DockhandContainer) {
|
||||
if (c.updateAvailable === null) return <span className="text-secondary">—</span>;
|
||||
@@ -91,7 +95,8 @@ export default function Docker({ user }: { user: CurrentUser }) {
|
||||
const hosts = [...new Set((data?.containers ?? []).map((c) => c.environmentName))].sort();
|
||||
const filteredContainers = (data?.containers ?? []).filter((c) => !hostFilter || c.environmentName === hostFilter);
|
||||
|
||||
const { sorted, sortKey, sortDir, requestSort } = useSortable(filteredContainers);
|
||||
const tableSearch = useTableSearch(filteredContainers);
|
||||
const { sorted, sortKey, sortDir, requestSort } = useSortable(tableSearch.filtered);
|
||||
const { pageItems, page, setPage, pageCount, totalCount } = usePagination(sorted);
|
||||
|
||||
function exportCsv() {
|
||||
@@ -131,6 +136,7 @@ export default function Docker({ user }: { user: CurrentUser }) {
|
||||
setError(null);
|
||||
try {
|
||||
await api.integrations.dockhand[action](selectedId, c.environmentId, c.id);
|
||||
toast.success(`${action === "start" ? "Started" : action === "stop" ? "Stopped" : "Restarted"} ${c.name}.`);
|
||||
loadContainers(selectedId);
|
||||
} catch (err) {
|
||||
setError(err instanceof Error ? err.message : String(err));
|
||||
@@ -142,7 +148,7 @@ export default function Docker({ user }: { user: CurrentUser }) {
|
||||
return (
|
||||
<>
|
||||
<IntegrationPageTitle title="Docker" adminName="Dockhand" integration={selected} />
|
||||
{error && <div className="alert alert-danger">{error}</div>}
|
||||
<ErrorNotice error={error} />
|
||||
|
||||
{integrations?.length === 0 ? (
|
||||
<div className="card">
|
||||
@@ -193,6 +199,7 @@ export default function Docker({ user }: { user: CurrentUser }) {
|
||||
</span>
|
||||
)}
|
||||
</h3>
|
||||
<SearchBox value={tableSearch.query} onChange={tableSearch.setQuery} className="ms-3" />
|
||||
<div className="card-actions d-flex gap-2">
|
||||
{hosts.length > 1 && (
|
||||
<select
|
||||
|
||||
@@ -9,6 +9,9 @@ import { usePagination } from "../hooks/usePagination";
|
||||
import SortableTh from "../components/SortableTh";
|
||||
import Pagination from "../components/Pagination";
|
||||
import { confirmDialog } from "../utils/dialogs";
|
||||
import { ErrorNotice } from "../components/Notice";
|
||||
import { SearchBox } from "../components/TableToolbar";
|
||||
import { useTableSearch } from "../hooks/useTableSearch";
|
||||
|
||||
function statusBadge(d: DomainRecord) {
|
||||
switch (d.status) {
|
||||
@@ -40,7 +43,8 @@ export default function Domains({ user }: { user: CurrentUser }) {
|
||||
.catch((err) => setError(readableError(err)));
|
||||
}, []);
|
||||
|
||||
const { sorted, sortKey, sortDir, requestSort } = useSortable(data?.domains, "expiresAt");
|
||||
const tableSearch = useTableSearch(data?.domains);
|
||||
const { sorted, sortKey, sortDir, requestSort } = useSortable(tableSearch.filtered, "expiresAt");
|
||||
const { pageItems, page, setPage, pageCount, totalCount } = usePagination(sorted);
|
||||
|
||||
async function add(e: React.FormEvent) {
|
||||
@@ -130,7 +134,7 @@ export default function Domains({ user }: { user: CurrentUser }) {
|
||||
When each domain registration expires, read from the registry itself. Domains for the DNS zones you've added show up
|
||||
here automatically; add any others by hand.
|
||||
</div>
|
||||
{error && <div className="alert alert-danger">{error}</div>}
|
||||
<ErrorNotice error={error} />
|
||||
{notice && <div className="alert alert-info">{notice}</div>}
|
||||
|
||||
{canEdit && (
|
||||
@@ -158,6 +162,7 @@ export default function Domains({ user }: { user: CurrentUser }) {
|
||||
<div className="card mb-3">
|
||||
<div className="card-header">
|
||||
<h3 className="card-title">Registrations</h3>
|
||||
<SearchBox value={tableSearch.query} onChange={tableSearch.setQuery} className="ms-3" />
|
||||
<div className="card-actions">
|
||||
<button className="btn btn-sm btn-outline-secondary" onClick={exportCsv} disabled={!sorted || sorted.length === 0}>
|
||||
Export CSV
|
||||
|
||||
@@ -12,6 +12,7 @@ import {
|
||||
type UsernameOptions,
|
||||
type PasswordOptions,
|
||||
} from "../utils/generators";
|
||||
import { ErrorNotice } from "../components/Notice";
|
||||
|
||||
const MIXED = "mixed";
|
||||
|
||||
@@ -103,7 +104,7 @@ export default function Generator({ user }: { user: CurrentUser }) {
|
||||
</>
|
||||
)}
|
||||
</p>
|
||||
{themesError && <div className="alert alert-danger py-2">{themesError}</div>}
|
||||
<ErrorNotice error={themesError} className="py-2" />
|
||||
<label className="form-label">Theme</label>
|
||||
<select className="form-select mb-1" value={theme} onChange={(e) => setTheme(e.target.value)} disabled={!themes}>
|
||||
<option value={MIXED}>Mixed — all lists</option>
|
||||
|
||||
@@ -9,6 +9,9 @@ import Pagination from "../components/Pagination";
|
||||
import { downloadCsv } from "../utils/csv";
|
||||
import { formatDateTime } from "../utils/date";
|
||||
import { formatAgo } from "../utils/duration";
|
||||
import { ErrorNotice } from "../components/Notice";
|
||||
import { SearchBox } from "../components/TableToolbar";
|
||||
import { useTableSearch } from "../hooks/useTableSearch";
|
||||
|
||||
function runStatusBadge(repo: GiteaRepo) {
|
||||
const run = repo.latestRun;
|
||||
@@ -93,7 +96,8 @@ export default function Gitea({ user }: { user: CurrentUser }) {
|
||||
}
|
||||
}
|
||||
|
||||
const { sorted, sortKey, sortDir, requestSort } = useSortable(repos);
|
||||
const tableSearch = useTableSearch(repos);
|
||||
const { sorted, sortKey, sortDir, requestSort } = useSortable(tableSearch.filtered);
|
||||
const { pageItems, page, setPage, pageCount, totalCount } = usePagination(sorted);
|
||||
|
||||
function exportCsv() {
|
||||
@@ -115,7 +119,7 @@ export default function Gitea({ user }: { user: CurrentUser }) {
|
||||
return (
|
||||
<>
|
||||
<IntegrationPageTitle title="Gitea" integration={selected} />
|
||||
{error && <div className="alert alert-danger">{error}</div>}
|
||||
<ErrorNotice error={error} />
|
||||
|
||||
{integrations?.length === 0 ? (
|
||||
<div className="card">
|
||||
@@ -153,6 +157,7 @@ export default function Gitea({ user }: { user: CurrentUser }) {
|
||||
<div className="card">
|
||||
<div className="card-header">
|
||||
<h3 className="card-title">Repositories</h3>
|
||||
<SearchBox value={tableSearch.query} onChange={tableSearch.setQuery} className="ms-3" />
|
||||
<div className="card-actions">
|
||||
<button className="btn btn-sm btn-outline-secondary" onClick={exportCsv} disabled={!sorted || sorted.length === 0}>
|
||||
Export CSV
|
||||
|
||||
@@ -7,6 +7,8 @@ import { useSortable } from "../hooks/useSortable";
|
||||
import SortableTh from "../components/SortableTh";
|
||||
import { downloadCsv } from "../utils/csv";
|
||||
import { confirmDialog } from "../utils/dialogs";
|
||||
import { ErrorNotice } from "../components/Notice";
|
||||
import { toast } from "../utils/toast";
|
||||
|
||||
const TYPE_LABELS: Record<IntegrationType, string> = {
|
||||
tailscale: "Tailscale",
|
||||
@@ -61,6 +63,7 @@ export default function Integrations({ user }: { user: CurrentUser }) {
|
||||
async function toggleEnabled(i: IntegrationSummary) {
|
||||
try {
|
||||
await api.integrations.update(i.id, { enabled: !i.enabled });
|
||||
toast.success(`${i.name} ${i.enabled ? "disabled" : "enabled"}.`);
|
||||
loadIntegrations();
|
||||
} catch (err) {
|
||||
setError(err instanceof Error ? err.message : String(err));
|
||||
@@ -83,6 +86,7 @@ export default function Integrations({ user }: { user: CurrentUser }) {
|
||||
if (!(await confirmDialog({ title: "Delete integration", message: `Delete integration "${i.name}"?`, confirmLabel: "Delete", danger: true }))) return;
|
||||
try {
|
||||
await api.integrations.remove(i.id);
|
||||
toast.success(`Deleted ${i.name}.`);
|
||||
loadIntegrations();
|
||||
} catch (err) {
|
||||
setError(err instanceof Error ? err.message : String(err));
|
||||
@@ -116,7 +120,7 @@ export default function Integrations({ user }: { user: CurrentUser }) {
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
{error && <div className="alert alert-danger">{error}</div>}
|
||||
<ErrorNotice error={error} />
|
||||
|
||||
{editingIntegration ? (
|
||||
<IntegrationEditForm
|
||||
|
||||
+32
-32
@@ -8,6 +8,8 @@ import { usePagination } from "../hooks/usePagination";
|
||||
import Pagination from "../components/Pagination";
|
||||
import { useSelection } from "../hooks/useSelection";
|
||||
import { confirmDialog, promptDialog } from "../utils/dialogs";
|
||||
import { ErrorNotice } from "../components/Notice";
|
||||
import TableToolbar from "../components/TableToolbar";
|
||||
|
||||
const emptyForm: IpamInput = { ipAddress: "", label: "", vendor: "", location: "", notes: "" };
|
||||
|
||||
@@ -219,7 +221,7 @@ export default function Ipam({ user }: { user: CurrentUser }) {
|
||||
return (
|
||||
<>
|
||||
<h2 className="page-title mb-3">IP Addresses</h2>
|
||||
{error && <div className="alert alert-danger">{error}</div>}
|
||||
<ErrorNotice error={error} />
|
||||
{syncResult && <div className="alert alert-success">Synced from {syncResult}</div>}
|
||||
|
||||
<div className="card mb-3">
|
||||
@@ -351,38 +353,36 @@ export default function Ipam({ user }: { user: CurrentUser }) {
|
||||
)}
|
||||
|
||||
<div className="card">
|
||||
<div className="card-header">
|
||||
<div className="d-flex flex-wrap gap-2 align-items-center w-100">
|
||||
<input
|
||||
className="form-control"
|
||||
style={{ maxWidth: 280 }}
|
||||
placeholder="Search IP, label, vendor, location…"
|
||||
value={search}
|
||||
onChange={(e) => setSearch(e.target.value)}
|
||||
/>
|
||||
{canEdit && !showForm && (
|
||||
<button className="btn btn-primary" onClick={startAdd}>
|
||||
Add IP address
|
||||
</button>
|
||||
)}
|
||||
{canEdit && (
|
||||
<>
|
||||
<button className="btn btn-outline-secondary" onClick={() => runSync("tailscale")} disabled={!!syncing}>
|
||||
{syncing === "tailscale" ? "Syncing…" : "Sync from Tailscale"}
|
||||
<TableToolbar
|
||||
search={search}
|
||||
onSearch={setSearch}
|
||||
placeholder="Search IP, label, vendor, location…"
|
||||
shown={filtered.length}
|
||||
total={entries?.length}
|
||||
actions={
|
||||
<>
|
||||
{canEdit && !showForm && (
|
||||
<button className="btn btn-sm btn-primary" onClick={startAdd}>
|
||||
Add IP address
|
||||
</button>
|
||||
<button className="btn btn-outline-secondary" onClick={() => runSync("proxmox")} disabled={!!syncing}>
|
||||
{syncing === "proxmox" ? "Syncing…" : "Sync from Proxmox"}
|
||||
</button>
|
||||
<button className="btn btn-outline-secondary" onClick={() => runSync("phpipam")} disabled={!!syncing}>
|
||||
{syncing === "phpipam" ? "Syncing…" : "Sync from phpIPAM"}
|
||||
</button>
|
||||
</>
|
||||
)}
|
||||
<button className="btn btn-outline-secondary ms-auto" onClick={exportCsv}>
|
||||
Export CSV
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
{canEdit && (
|
||||
<>
|
||||
<button className="btn btn-sm btn-outline-secondary" onClick={() => runSync("tailscale")} disabled={!!syncing}>
|
||||
{syncing === "tailscale" ? "Syncing…" : "Sync from Tailscale"}
|
||||
</button>
|
||||
<button className="btn btn-sm btn-outline-secondary" onClick={() => runSync("proxmox")} disabled={!!syncing}>
|
||||
{syncing === "proxmox" ? "Syncing…" : "Sync from Proxmox"}
|
||||
</button>
|
||||
<button className="btn btn-sm btn-outline-secondary" onClick={() => runSync("phpipam")} disabled={!!syncing}>
|
||||
{syncing === "phpipam" ? "Syncing…" : "Sync from phpIPAM"}
|
||||
</button>
|
||||
</>
|
||||
)}
|
||||
</>
|
||||
}
|
||||
onExport={exportCsv}
|
||||
/>
|
||||
{canEdit && selection.count > 0 && (
|
||||
<div className="card-header bg-blue-lt d-flex align-items-center gap-2">
|
||||
<span>{selection.count} selected</span>
|
||||
|
||||
@@ -13,6 +13,8 @@ import {
|
||||
import { formatDateTime } from "../utils/date";
|
||||
import { formatRemaining } from "../utils/duration";
|
||||
import { readableError } from "../utils/errors";
|
||||
import { ErrorNotice } from "../components/Notice";
|
||||
import { toast } from "../utils/toast";
|
||||
|
||||
const DURATIONS: { minutes: number; label: string }[] = [
|
||||
{ minutes: 30, label: "30 minutes" },
|
||||
@@ -102,6 +104,7 @@ export default function Maintenance({ user }: { user: CurrentUser }) {
|
||||
});
|
||||
setTarget("");
|
||||
setReason("");
|
||||
toast.success("Maintenance started. Alerts for it are silenced until it ends.");
|
||||
load();
|
||||
announceChange();
|
||||
} catch (err) {
|
||||
@@ -143,6 +146,7 @@ export default function Maintenance({ user }: { user: CurrentUser }) {
|
||||
setError(null);
|
||||
try {
|
||||
await api.maintenance.end(w.id);
|
||||
toast.success(w.startedAt > new Date().toISOString() ? "Scheduled window cancelled." : "Maintenance ended. Alerts for it are active again.");
|
||||
load();
|
||||
announceChange();
|
||||
} catch (err) {
|
||||
@@ -194,7 +198,7 @@ export default function Maintenance({ user }: { user: CurrentUser }) {
|
||||
Silence alerts about one server or integration while you work on it. Every window ends on its own — anything
|
||||
still wrong when it ends alerts then, so nothing stays hidden.
|
||||
</div>
|
||||
{error && <div className="alert alert-danger">{error}</div>}
|
||||
<ErrorNotice error={error} />
|
||||
|
||||
{canEdit && (
|
||||
<div className="card mb-3">
|
||||
|
||||
@@ -6,6 +6,9 @@ import SortableTh from "../components/SortableTh";
|
||||
import { downloadCsv } from "../utils/csv";
|
||||
import { formatDateTime } from "../utils/date";
|
||||
import { formatAgo } from "../utils/duration";
|
||||
import { ErrorNotice } from "../components/Notice";
|
||||
import { SearchBox } from "../components/TableToolbar";
|
||||
import { useTableSearch } from "../hooks/useTableSearch";
|
||||
|
||||
function priorityBadge(t: OsTicketTicket) {
|
||||
if (!t.priorityName) return <span className="text-secondary">—</span>;
|
||||
@@ -58,7 +61,8 @@ export default function OsTicket({ user: _user }: { user: CurrentUser }) {
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [selectedId]);
|
||||
|
||||
const { sorted: sortedTickets, sortKey, sortDir, requestSort } = useSortable(data?.tickets);
|
||||
const tableSearch = useTableSearch(data?.tickets);
|
||||
const { sorted: sortedTickets, sortKey, sortDir, requestSort } = useSortable(tableSearch.filtered);
|
||||
|
||||
function exportCsv() {
|
||||
if (!sortedTickets) return;
|
||||
@@ -85,7 +89,7 @@ export default function OsTicket({ user: _user }: { user: CurrentUser }) {
|
||||
return (
|
||||
<>
|
||||
<h2 className="page-title mb-3">osTicket</h2>
|
||||
{error && <div className="alert alert-danger">{error}</div>}
|
||||
<ErrorNotice error={error} />
|
||||
|
||||
{integrations?.length === 0 ? (
|
||||
<div className="card">
|
||||
@@ -157,6 +161,7 @@ export default function OsTicket({ user: _user }: { user: CurrentUser }) {
|
||||
<div className="card">
|
||||
<div className="card-header">
|
||||
<h3 className="card-title">Open tickets</h3>
|
||||
<SearchBox value={tableSearch.query} onChange={tableSearch.setQuery} className="ms-3" />
|
||||
<div className="card-actions">
|
||||
<button
|
||||
className="btn btn-sm btn-outline-secondary"
|
||||
|
||||
@@ -12,6 +12,7 @@ import { useSortable } from "../hooks/useSortable";
|
||||
import SortableTh from "../components/SortableTh";
|
||||
import { downloadCsv } from "../utils/csv";
|
||||
import IntegrationPageTitle from "../components/IntegrationPageTitle";
|
||||
import { ErrorNotice } from "../components/Notice";
|
||||
|
||||
function formatBytes(bytes: number | null): string {
|
||||
if (bytes === null) return "—";
|
||||
@@ -128,7 +129,7 @@ export default function PbsBackup({ user: _user }: { user: CurrentUser }) {
|
||||
return (
|
||||
<>
|
||||
<IntegrationPageTitle title="Proxmox Backup Server" integration={selected} />
|
||||
{error && <div className="alert alert-danger">{error}</div>}
|
||||
<ErrorNotice error={error} />
|
||||
|
||||
{integrations?.length === 0 ? (
|
||||
<div className="card">
|
||||
|
||||
@@ -15,6 +15,7 @@ import Pagination from "../components/Pagination";
|
||||
import { downloadCsv } from "../utils/csv";
|
||||
import { formatAgo } from "../utils/duration";
|
||||
import { confirmDialog } from "../utils/dialogs";
|
||||
import { ErrorNotice } from "../components/Notice";
|
||||
|
||||
const emptyForm: PortForwardInput = {
|
||||
label: "",
|
||||
@@ -197,7 +198,7 @@ export default function Ports({ user }: { user: CurrentUser }) {
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
{agentError && <div className="alert alert-danger m-3">{agentError}</div>}
|
||||
<ErrorNotice error={agentError} className="m-3" />
|
||||
<div className="table-responsive">
|
||||
<table className="table table-vcenter card-table">
|
||||
<thead>
|
||||
@@ -366,7 +367,7 @@ export default function Ports({ user }: { user: CurrentUser }) {
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
{forwardError && <div className="alert alert-danger m-3">{forwardError}</div>}
|
||||
<ErrorNotice error={forwardError} className="m-3" />
|
||||
<div className="table-responsive">
|
||||
<table className="table table-vcenter card-table">
|
||||
<thead>
|
||||
|
||||
@@ -4,6 +4,7 @@ import { api, type PrivacyOverview } from "../api/client";
|
||||
import { formatDateTime } from "../utils/date";
|
||||
import { formatAgo } from "../utils/duration";
|
||||
import { readableError } from "../utils/errors";
|
||||
import { ErrorNotice } from "../components/Notice";
|
||||
|
||||
const CHANNEL_LABELS = { gotify: "Gotify", ntfy: "ntfy", smtp: "email (SMTP)", webhook: "webhook" } as const;
|
||||
|
||||
@@ -57,7 +58,7 @@ export default function Privacy() {
|
||||
for this installation.
|
||||
</div>
|
||||
</div>
|
||||
{error && <div className="alert alert-danger">{error}</div>}
|
||||
<ErrorNotice error={error} />
|
||||
|
||||
{data && (
|
||||
<div className="card mb-3">
|
||||
|
||||
@@ -17,6 +17,10 @@ import Pagination from "../components/Pagination";
|
||||
import { downloadCsv } from "../utils/csv";
|
||||
import { confirmDialog } from "../utils/dialogs";
|
||||
import IntegrationPageTitle from "../components/IntegrationPageTitle";
|
||||
import { ErrorNotice } from "../components/Notice";
|
||||
import { toast } from "../utils/toast";
|
||||
import { SearchBox } from "../components/TableToolbar";
|
||||
import { useTableSearch } from "../hooks/useTableSearch";
|
||||
|
||||
function proxmoxStatusBadge(status: string) {
|
||||
return status === "running" ? (
|
||||
@@ -181,6 +185,7 @@ export default function Proxmox({ user }: { user: CurrentUser }) {
|
||||
setError(null);
|
||||
try {
|
||||
await api.integrations.proxmox[action](selectedId, g.node, g.type, g.vmid);
|
||||
toast.success(`${{ start: "Started", stop: "Stopped", restart: "Restarted", shutdown: "Shut down" }[action]} ${g.name}.`);
|
||||
loadGuests(selectedId);
|
||||
} catch (err) {
|
||||
setError(err instanceof Error ? err.message : String(err));
|
||||
@@ -189,7 +194,8 @@ export default function Proxmox({ user }: { user: CurrentUser }) {
|
||||
}
|
||||
}
|
||||
|
||||
const { sorted: sortedGuests, sortKey: guestSortKey, sortDir: guestSortDir, requestSort: requestGuestSort } = useSortable(data?.guests);
|
||||
const tableSearch = useTableSearch(data?.guests);
|
||||
const { sorted: sortedGuests, sortKey: guestSortKey, sortDir: guestSortDir, requestSort: requestGuestSort } = useSortable(tableSearch.filtered);
|
||||
const { pageItems: guestPageItems, page: guestPage, setPage: setGuestPage, pageCount: guestPageCount, totalCount: guestTotalCount } =
|
||||
usePagination(sortedGuests);
|
||||
|
||||
@@ -205,7 +211,7 @@ export default function Proxmox({ user }: { user: CurrentUser }) {
|
||||
return (
|
||||
<>
|
||||
<IntegrationPageTitle title="Proxmox" integration={selected} />
|
||||
{error && <div className="alert alert-danger">{error}</div>}
|
||||
<ErrorNotice error={error} />
|
||||
|
||||
{integrations?.length === 0 ? (
|
||||
<div className="card">
|
||||
@@ -241,7 +247,7 @@ export default function Proxmox({ user }: { user: CurrentUser }) {
|
||||
</div>
|
||||
) : (
|
||||
<>
|
||||
{nodeStatsError && <div className="alert alert-danger">{nodeStatsError}</div>}
|
||||
<ErrorNotice error={nodeStatsError} />
|
||||
<div className="row row-cards mb-3">
|
||||
{nodeStats?.map((n) => (
|
||||
<div className="col-12" key={n.node}>
|
||||
@@ -355,7 +361,7 @@ export default function Proxmox({ user }: { user: CurrentUser }) {
|
||||
</div>
|
||||
</div>
|
||||
<div className="card-body">
|
||||
{backupsError && <div className="alert alert-danger mb-3">{backupsError}</div>}
|
||||
<ErrorNotice error={backupsError} className="mb-3" />
|
||||
{backupTasks && backupTasks.length > 0 && !backupTasks[0].ok && backupTasks[0].status !== "running" && (
|
||||
<div className="alert alert-danger">
|
||||
Most recent backup run on <strong>{backupTasks[0].node}</strong>
|
||||
@@ -473,6 +479,7 @@ export default function Proxmox({ user }: { user: CurrentUser }) {
|
||||
</span>
|
||||
)}
|
||||
</h3>
|
||||
<SearchBox value={tableSearch.query} onChange={tableSearch.setQuery} className="ms-3" />
|
||||
<div className="card-actions">
|
||||
<button
|
||||
className="btn btn-sm btn-outline-secondary"
|
||||
|
||||
+18
-17
@@ -10,6 +10,9 @@ import { usePagination } from "../hooks/usePagination";
|
||||
import Pagination from "../components/Pagination";
|
||||
import { useSelection } from "../hooks/useSelection";
|
||||
import { confirmDialog } from "../utils/dialogs";
|
||||
import { ErrorNotice } from "../components/Notice";
|
||||
import { toast } from "../utils/toast";
|
||||
import TableToolbar from "../components/TableToolbar";
|
||||
|
||||
const TYPE_LABELS: Record<SecretRecord["type"], string> = {
|
||||
api_token: "API Token",
|
||||
@@ -119,8 +122,10 @@ export default function Secrets({ user }: { user: CurrentUser }) {
|
||||
};
|
||||
if (editingId) {
|
||||
await api.secrets.update(editingId, payload);
|
||||
toast.success(`Saved ${form.name}.`);
|
||||
} else {
|
||||
await api.secrets.create(payload);
|
||||
toast.success(`Added ${form.name}.`);
|
||||
}
|
||||
cancelEdit();
|
||||
load();
|
||||
@@ -150,6 +155,7 @@ export default function Secrets({ user }: { user: CurrentUser }) {
|
||||
setError(null);
|
||||
try {
|
||||
await api.secrets.remove(s.id);
|
||||
toast.success(`Deleted ${s.name}.`);
|
||||
load();
|
||||
} catch (err) {
|
||||
setError(err instanceof Error ? err.message : String(err));
|
||||
@@ -199,7 +205,7 @@ export default function Secrets({ user }: { user: CurrentUser }) {
|
||||
return (
|
||||
<>
|
||||
<h2 className="page-title mb-3">Secrets</h2>
|
||||
{error && <div className="alert alert-danger">{error}</div>}
|
||||
<ErrorNotice error={error} />
|
||||
|
||||
{canEdit && (
|
||||
<div className="card mb-3">
|
||||
@@ -324,18 +330,13 @@ export default function Secrets({ user }: { user: CurrentUser }) {
|
||||
)}
|
||||
|
||||
<div className="card">
|
||||
<div className="card-header">
|
||||
<div className="d-flex flex-wrap gap-2 align-items-center w-100">
|
||||
<input
|
||||
className="form-control"
|
||||
style={{ maxWidth: 260 }}
|
||||
placeholder="Search name or description…"
|
||||
value={search}
|
||||
onChange={(e) => setSearch(e.target.value)}
|
||||
/>
|
||||
<TableToolbar
|
||||
search={search}
|
||||
onSearch={setSearch}
|
||||
placeholder="Search name or description…"
|
||||
filters={
|
||||
<select
|
||||
className="form-select"
|
||||
style={{ maxWidth: 160 }}
|
||||
className="form-select form-select-sm w-auto"
|
||||
value={statusFilter}
|
||||
onChange={(e) => setStatusFilter(e.target.value as typeof statusFilter)}
|
||||
>
|
||||
@@ -345,11 +346,11 @@ export default function Secrets({ user }: { user: CurrentUser }) {
|
||||
<option value="expired">Expired</option>
|
||||
<option value="never">No expiry</option>
|
||||
</select>
|
||||
<button className="btn btn-outline-secondary ms-auto" onClick={exportCsv}>
|
||||
Export CSV
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
shown={filtered.length}
|
||||
total={secrets?.length}
|
||||
onExport={exportCsv}
|
||||
/>
|
||||
{canEdit && selection.count > 0 && (
|
||||
<div className="card-header bg-blue-lt d-flex align-items-center gap-2">
|
||||
<span>{selection.count} selected</span>
|
||||
|
||||
@@ -15,6 +15,9 @@ import Pagination from "../components/Pagination";
|
||||
import { downloadCsv } from "../utils/csv";
|
||||
import { confirmDialog } from "../utils/dialogs";
|
||||
import IntegrationPageTitle from "../components/IntegrationPageTitle";
|
||||
import { ErrorNotice } from "../components/Notice";
|
||||
import { SearchBox } from "../components/TableToolbar";
|
||||
import { useTableSearch } from "../hooks/useTableSearch";
|
||||
|
||||
function semaphoreStatusBadge(template: SemaphoreTemplate) {
|
||||
const status = template.lastTask?.status;
|
||||
@@ -100,7 +103,8 @@ export default function Semaphore({ user }: { user: CurrentUser }) {
|
||||
}
|
||||
}
|
||||
|
||||
const { sorted, sortKey, sortDir, requestSort } = useSortable(data?.templates);
|
||||
const tableSearch = useTableSearch(data?.templates);
|
||||
const { sorted, sortKey, sortDir, requestSort } = useSortable(tableSearch.filtered);
|
||||
const { pageItems, page, setPage, pageCount, totalCount } = usePagination(sorted);
|
||||
|
||||
function exportCsv() {
|
||||
@@ -120,7 +124,7 @@ export default function Semaphore({ user }: { user: CurrentUser }) {
|
||||
return (
|
||||
<>
|
||||
<IntegrationPageTitle title="Semaphore" integration={selected} />
|
||||
{error && <div className="alert alert-danger">{error}</div>}
|
||||
<ErrorNotice error={error} />
|
||||
|
||||
{integrations?.length === 0 ? (
|
||||
<div className="card">
|
||||
@@ -164,6 +168,7 @@ export default function Semaphore({ user }: { user: CurrentUser }) {
|
||||
<span className="text-red fw-normal ms-2">{data.summary.failing} failing</span>
|
||||
)}
|
||||
</h3>
|
||||
<SearchBox value={tableSearch.query} onChange={tableSearch.setQuery} className="ms-3" />
|
||||
<div className="card-actions">
|
||||
<button className="btn btn-sm btn-outline-secondary" onClick={exportCsv} disabled={!sorted || sorted.length === 0}>
|
||||
Export CSV
|
||||
|
||||
@@ -18,6 +18,7 @@ import ServerTaskTable, { SCHEDULE_TYPE_LABELS } from "../components/ServerTaskT
|
||||
import { formatDateTime } from "../utils/date";
|
||||
import { guessAdminUrl, portOptionLabel } from "../utils/adminLinkUrl";
|
||||
import { confirmDialog } from "../utils/dialogs";
|
||||
import { ErrorNotice } from "../components/Notice";
|
||||
|
||||
const SCHEDULE_TYPE_OPTIONS: { value: ScheduleType; label: string }[] = Object.entries(SCHEDULE_TYPE_LABELS).map(
|
||||
([value, label]) => ({ value: value as ScheduleType, label }),
|
||||
@@ -391,7 +392,7 @@ export default function ServerDetail({ user }: { user: CurrentUser }) {
|
||||
{refreshing ? "Refreshing…" : "Refresh"}
|
||||
</button>
|
||||
</div>
|
||||
{error && <div className="alert alert-danger">{error}</div>}
|
||||
<ErrorNotice error={error} />
|
||||
|
||||
<ServerTags
|
||||
serverId={serverId}
|
||||
@@ -412,7 +413,7 @@ export default function ServerDetail({ user }: { user: CurrentUser }) {
|
||||
)}
|
||||
</div>
|
||||
<div className="card-body">
|
||||
{adminLinkError && <div className="alert alert-danger">{adminLinkError}</div>}
|
||||
<ErrorNotice error={adminLinkError} />
|
||||
|
||||
{adminLinkForm && (
|
||||
<form onSubmit={submitAdminLink} className="row g-2 align-items-end mb-3">
|
||||
@@ -629,7 +630,7 @@ export default function ServerDetail({ user }: { user: CurrentUser }) {
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
{guestActionError && <div className="alert alert-danger">{guestActionError}</div>}
|
||||
<ErrorNotice error={guestActionError} />
|
||||
<div className="row g-3">
|
||||
<div className="col-sm-6">
|
||||
<div className="text-secondary small">CPU</div>
|
||||
|
||||
@@ -12,6 +12,10 @@ import { TagBadges } from "../components/ServerTags";
|
||||
import { AGENT_RUN_HINT, agentOsOf, installCommand, uninstallCommand, type AgentOs } from "../utils/agentCommands";
|
||||
import { tagBadge, useTagColors } from "../utils/tags";
|
||||
import { confirmDialog } from "../utils/dialogs";
|
||||
import { ErrorNotice } from "../components/Notice";
|
||||
import { toast } from "../utils/toast";
|
||||
import { SearchBox } from "../components/TableToolbar";
|
||||
import { useTableSearch } from "../hooks/useTableSearch";
|
||||
|
||||
function typeBadgeStyle(colors: Record<string, string>, type: string): CSSProperties {
|
||||
const color = colors[type];
|
||||
@@ -66,6 +70,7 @@ export default function Servers({ user }: { user: CurrentUser }) {
|
||||
osType: serverOs,
|
||||
});
|
||||
setNewToken(result);
|
||||
toast.success(`Added ${serverName}. Its install command is shown below.`);
|
||||
setServerName("");
|
||||
setServerHostname("");
|
||||
setServerDescription("");
|
||||
@@ -89,13 +94,15 @@ export default function Servers({ user }: { user: CurrentUser }) {
|
||||
if (!(await confirmDialog({ title: "Remove server", message: "Remove this server and all its tracked tasks?", confirmLabel: "Remove", danger: true }))) return;
|
||||
try {
|
||||
await api.servers.remove(id);
|
||||
toast.success("Server removed.");
|
||||
await loadServers();
|
||||
} catch (err) {
|
||||
setError(err instanceof Error ? err.message : String(err));
|
||||
}
|
||||
}
|
||||
|
||||
const { sorted: sortedServers, sortKey, sortDir, requestSort } = useSortable(servers);
|
||||
const tableSearch = useTableSearch(servers);
|
||||
const { sorted: sortedServers, sortKey, sortDir, requestSort } = useSortable(tableSearch.filtered);
|
||||
const { pageItems: serverPageItems, page: serverPage, setPage: setServerPage, pageCount: serverPageCount, totalCount: serverTotalCount } =
|
||||
usePagination(sortedServers);
|
||||
|
||||
@@ -136,7 +143,7 @@ export default function Servers({ user }: { user: CurrentUser }) {
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
{error && <div className="alert alert-danger">{error}</div>}
|
||||
<ErrorNotice error={error} />
|
||||
|
||||
{managingServers ? (
|
||||
<>
|
||||
@@ -257,8 +264,9 @@ export default function Servers({ user }: { user: CurrentUser }) {
|
||||
)}
|
||||
|
||||
<div className="card">
|
||||
<div className="card-header justify-content-end">
|
||||
<button className="btn btn-outline-secondary btn-sm" onClick={exportCsv} disabled={servers.length === 0}>
|
||||
<div className="card-header">
|
||||
<SearchBox value={tableSearch.query} onChange={tableSearch.setQuery} />
|
||||
<button className="btn btn-outline-secondary btn-sm ms-auto" onClick={exportCsv} disabled={servers.length === 0}>
|
||||
Export CSV
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@@ -5,6 +5,9 @@ import { useSortable } from "../hooks/useSortable";
|
||||
import SortableTh from "../components/SortableTh";
|
||||
import { downloadCsv } from "../utils/csv";
|
||||
import { confirmDialog } from "../utils/dialogs";
|
||||
import { ErrorNotice } from "../components/Notice";
|
||||
import { SearchBox } from "../components/TableToolbar";
|
||||
import { useTableSearch } from "../hooks/useTableSearch";
|
||||
|
||||
function friendlyUserAgent(ua: string | null): string {
|
||||
if (!ua) return "—";
|
||||
@@ -72,7 +75,8 @@ export default function Sessions() {
|
||||
}
|
||||
}
|
||||
|
||||
const { sorted, sortKey, sortDir, requestSort } = useSortable(sessions);
|
||||
const tableSearch = useTableSearch(sessions);
|
||||
const { sorted, sortKey, sortDir, requestSort } = useSortable(tableSearch.filtered);
|
||||
|
||||
function exportCsv() {
|
||||
if (!sorted) return;
|
||||
@@ -102,8 +106,11 @@ export default function Sessions() {
|
||||
Export CSV
|
||||
</button>
|
||||
</div>
|
||||
{error && <div className="alert alert-danger">{error}</div>}
|
||||
<ErrorNotice error={error} />
|
||||
<div className="card">
|
||||
<div className="card-header">
|
||||
<SearchBox value={tableSearch.query} onChange={tableSearch.setQuery} />
|
||||
</div>
|
||||
<div className="table-responsive">
|
||||
<table className="table table-vcenter card-table">
|
||||
<thead>
|
||||
|
||||
@@ -13,6 +13,7 @@ import { useSortable } from "../hooks/useSortable";
|
||||
import SortableTh from "../components/SortableTh";
|
||||
import { downloadCsv } from "../utils/csv";
|
||||
import IntegrationPageTitle from "../components/IntegrationPageTitle";
|
||||
import { ErrorNotice } from "../components/Notice";
|
||||
|
||||
function healthBadge(status: string) {
|
||||
return status === "normal" ? (
|
||||
@@ -135,7 +136,7 @@ export default function Synology({ user: _user }: { user: CurrentUser }) {
|
||||
return (
|
||||
<>
|
||||
<IntegrationPageTitle title="Synology" integration={selected} />
|
||||
{error && <div className="alert alert-danger">{error}</div>}
|
||||
<ErrorNotice error={error} />
|
||||
|
||||
{integrations?.length === 0 ? (
|
||||
<div className="card">
|
||||
|
||||
@@ -16,6 +16,10 @@ import { downloadCsv } from "../utils/csv";
|
||||
import { useSelection } from "../hooks/useSelection";
|
||||
import { confirmDialog } from "../utils/dialogs";
|
||||
import IntegrationPageTitle from "../components/IntegrationPageTitle";
|
||||
import { ErrorNotice } from "../components/Notice";
|
||||
import { toast } from "../utils/toast";
|
||||
import { SearchBox } from "../components/TableToolbar";
|
||||
import { useTableSearch } from "../hooks/useTableSearch";
|
||||
|
||||
const KEY_EXPIRY_WARN_DAYS = 30;
|
||||
|
||||
@@ -83,6 +87,7 @@ export default function Tailscale({ user }: { user: CurrentUser }) {
|
||||
if (!selectedId) return;
|
||||
try {
|
||||
await api.integrations.tailscale.setAuthorized(selectedId, device.id, authorized);
|
||||
toast.success(`${authorized ? "Authorized" : "Deauthorized"} ${device.label || device.hostname}.`);
|
||||
loadDevices(selectedId);
|
||||
} catch (err) {
|
||||
setError(err instanceof Error ? err.message : String(err));
|
||||
@@ -94,6 +99,7 @@ export default function Tailscale({ user }: { user: CurrentUser }) {
|
||||
if (!(await confirmDialog({ title: "Remove device", message: `Remove device "${device.label || device.hostname}" from the tailnet?`, confirmLabel: "Remove", danger: true }))) return;
|
||||
try {
|
||||
await api.integrations.tailscale.remove(selectedId, device.id);
|
||||
toast.success(`Removed ${device.label || device.hostname} from the tailnet.`);
|
||||
loadDevices(selectedId);
|
||||
} catch (err) {
|
||||
setError(err instanceof Error ? err.message : String(err));
|
||||
@@ -135,7 +141,8 @@ export default function Tailscale({ user }: { user: CurrentUser }) {
|
||||
}
|
||||
}
|
||||
|
||||
const { sorted, sortKey, sortDir, requestSort } = useSortable(data?.devices);
|
||||
const tableSearch = useTableSearch(data?.devices);
|
||||
const { sorted, sortKey, sortDir, requestSort } = useSortable(tableSearch.filtered);
|
||||
const { pageItems, page, setPage, pageCount, totalCount } = usePagination(sorted);
|
||||
|
||||
function exportCsv() {
|
||||
@@ -158,7 +165,7 @@ export default function Tailscale({ user }: { user: CurrentUser }) {
|
||||
return (
|
||||
<>
|
||||
<IntegrationPageTitle title="Tailscale" url="https://login.tailscale.com/admin/machines" integration={selected} />
|
||||
{error && <div className="alert alert-danger">{error}</div>}
|
||||
<ErrorNotice error={error} />
|
||||
|
||||
{integrations?.length === 0 ? (
|
||||
<div className="card">
|
||||
@@ -206,6 +213,7 @@ export default function Tailscale({ user }: { user: CurrentUser }) {
|
||||
</span>
|
||||
)}
|
||||
</h3>
|
||||
<SearchBox value={tableSearch.query} onChange={tableSearch.setQuery} className="ms-3" />
|
||||
<div className="card-actions">
|
||||
<button className="btn btn-sm btn-outline-secondary" onClick={exportCsv} disabled={!sorted || sorted.length === 0}>
|
||||
Export CSV
|
||||
|
||||
@@ -8,6 +8,9 @@ import Pagination from "../components/Pagination";
|
||||
import { downloadCsv } from "../utils/csv";
|
||||
import { readableError } from "../utils/errors";
|
||||
import IntegrationPageTitle from "../components/IntegrationPageTitle";
|
||||
import { ErrorNotice } from "../components/Notice";
|
||||
import { SearchBox } from "../components/TableToolbar";
|
||||
import { useTableSearch } from "../hooks/useTableSearch";
|
||||
|
||||
function statusBadge(monitor: UptimeKumaMonitor) {
|
||||
switch (monitor.status) {
|
||||
@@ -74,7 +77,8 @@ export default function UptimeKuma({ user: _user }: { user: CurrentUser }) {
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [selectedId]);
|
||||
|
||||
const { sorted, sortKey, sortDir, requestSort } = useSortable(data?.monitors, "name");
|
||||
const tableSearch = useTableSearch(data?.monitors);
|
||||
const { sorted, sortKey, sortDir, requestSort } = useSortable(tableSearch.filtered, "name");
|
||||
const { pageItems, page, setPage, pageCount, totalCount } = usePagination(sorted);
|
||||
|
||||
function exportCsv() {
|
||||
@@ -99,7 +103,7 @@ export default function UptimeKuma({ user: _user }: { user: CurrentUser }) {
|
||||
return (
|
||||
<>
|
||||
<IntegrationPageTitle title="Uptime Kuma" integration={selected} />
|
||||
{error && <div className="alert alert-danger">{error}</div>}
|
||||
<ErrorNotice error={error} />
|
||||
|
||||
{integrations?.length === 0 ? (
|
||||
<div className="card">
|
||||
@@ -138,6 +142,7 @@ export default function UptimeKuma({ user: _user }: { user: CurrentUser }) {
|
||||
<span className="text-yellow fw-normal ms-2">{data.summary.pending} pending</span>
|
||||
)}
|
||||
</h3>
|
||||
<SearchBox value={tableSearch.query} onChange={tableSearch.setQuery} className="ms-3" />
|
||||
<div className="card-actions">
|
||||
<button className="btn btn-sm btn-outline-secondary" onClick={exportCsv} disabled={!sorted || sorted.length === 0}>
|
||||
Export CSV
|
||||
|
||||
@@ -4,6 +4,9 @@ import { formatDateTime } from "../utils/date";
|
||||
import { useSortable } from "../hooks/useSortable";
|
||||
import SortableTh from "../components/SortableTh";
|
||||
import { downloadCsv } from "../utils/csv";
|
||||
import { ErrorNotice } from "../components/Notice";
|
||||
import { SearchBox } from "../components/TableToolbar";
|
||||
import { useTableSearch } from "../hooks/useTableSearch";
|
||||
|
||||
const ROLES: UserRole[] = ["viewer", "operator", "admin"];
|
||||
|
||||
@@ -34,7 +37,8 @@ export default function Users() {
|
||||
}
|
||||
}
|
||||
|
||||
const { sorted, sortKey, sortDir, requestSort } = useSortable(users);
|
||||
const tableSearch = useTableSearch(users);
|
||||
const { sorted, sortKey, sortDir, requestSort } = useSortable(tableSearch.filtered);
|
||||
|
||||
function exportCsv() {
|
||||
if (!sorted) return;
|
||||
@@ -53,8 +57,11 @@ export default function Users() {
|
||||
Export CSV
|
||||
</button>
|
||||
</div>
|
||||
{error && <div className="alert alert-danger">{error}</div>}
|
||||
<ErrorNotice error={error} />
|
||||
<div className="card">
|
||||
<div className="card-header">
|
||||
<SearchBox value={tableSearch.query} onChange={tableSearch.setQuery} />
|
||||
</div>
|
||||
<div className="table-responsive">
|
||||
<table className="table table-vcenter card-table">
|
||||
<thead>
|
||||
|
||||
@@ -4,6 +4,7 @@ import { api, type AlertTicketOverview, type AlertTicketRunSummary, type AlertTi
|
||||
import { formatDateTime } from "../../utils/date";
|
||||
import { formatAgo } from "../../utils/duration";
|
||||
import { readableError } from "../../utils/errors";
|
||||
import { ErrorNotice, SuccessNotice } from "../../components/Notice";
|
||||
|
||||
const SEVERITIES: { value: AlertTicketSeverity; label: string; hint: string }[] = [
|
||||
{ value: "critical", label: "Critical", hint: "A server down, a disk nearly full, a failed backup, something expired" },
|
||||
@@ -108,8 +109,8 @@ export default function AlertTicketSettings() {
|
||||
|
||||
return (
|
||||
<>
|
||||
{error && <div className="alert alert-danger">{error}</div>}
|
||||
{notice && <div className="alert alert-success">{notice}</div>}
|
||||
<ErrorNotice error={error} />
|
||||
<SuccessNotice notice={notice} />
|
||||
|
||||
<div className="card mb-3">
|
||||
<div className="card-header">
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { useRef, useState } from "react";
|
||||
import { api, type EncryptedExportFile, type ImportResult } from "../../api/client";
|
||||
import { confirmDialog } from "../../utils/dialogs";
|
||||
import { ErrorNotice } from "../../components/Notice";
|
||||
|
||||
function downloadJson(filename: string, data: unknown) {
|
||||
const blob = new Blob([JSON.stringify(data)], { type: "application/json" });
|
||||
@@ -103,7 +104,7 @@ export default function BackupSettings() {
|
||||
somewhere you trust and don't lose the passphrase — it can't be recovered.
|
||||
</p>
|
||||
<p className="text-secondary">Not included: DNS records, secrets, IPAM, servers, or the audit/diagnostic logs — this is configuration only.</p>
|
||||
{exportError && <div className="alert alert-danger">{exportError}</div>}
|
||||
<ErrorNotice error={exportError} />
|
||||
<div className="mb-2">
|
||||
<label className="form-label">Passphrase</label>
|
||||
<input
|
||||
@@ -149,8 +150,8 @@ export default function BackupSettings() {
|
||||
onto the current ones. Integrations and DNS providers are only <strong>added</strong> — anything
|
||||
that already exists with the same name is left alone, so this is safe to run more than once.
|
||||
</p>
|
||||
{importError && <div className="alert alert-danger">{importError}</div>}
|
||||
{importFileError && <div className="alert alert-danger">{importFileError}</div>}
|
||||
<ErrorNotice error={importError} />
|
||||
<ErrorNotice error={importFileError} />
|
||||
{importResult && (
|
||||
<div className="alert alert-success">
|
||||
<div>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { useEffect, useState } from "react";
|
||||
import { api } from "../../api/client";
|
||||
import { ErrorNotice } from "../../components/Notice";
|
||||
|
||||
const PROVIDER_NAMES: Record<string, string> = {
|
||||
cloudflare: "Cloudflare",
|
||||
@@ -106,7 +107,7 @@ export default function BadgeSettings() {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{loadError && <div className="alert alert-danger">{loadError}</div>}
|
||||
<ErrorNotice error={loadError} />
|
||||
|
||||
<div className="row row-cards">
|
||||
<div className="col-md-6">
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { useState } from "react";
|
||||
import { api } from "../../api/client";
|
||||
import { confirmDialog } from "../../utils/dialogs";
|
||||
import { ErrorNotice } from "../../components/Notice";
|
||||
|
||||
export default function CacheSettings() {
|
||||
const [clearing, setClearing] = useState(false);
|
||||
@@ -35,7 +36,7 @@ export default function CacheSettings() {
|
||||
The DNS module keeps a local copy of every synced zone and record so pages load instantly. Clear it if
|
||||
you see stale or incorrect data — every zone will need to be re-synced from its provider afterwards.
|
||||
</p>
|
||||
{error && <div className="alert alert-danger">{error}</div>}
|
||||
<ErrorNotice error={error} />
|
||||
</div>
|
||||
<div className="card-footer">
|
||||
<button className="btn btn-danger" onClick={handleClear} disabled={clearing}>
|
||||
|
||||
@@ -2,6 +2,7 @@ import { useEffect, useState } from "react";
|
||||
import { api, type AppSettings, type DateFormat, type TimeFormat } from "../../api/client";
|
||||
import { setDateTimeSettings } from "../../utils/date";
|
||||
import { setPageSize } from "../../utils/pageSize";
|
||||
import { ErrorNotice } from "../../components/Notice";
|
||||
|
||||
const DATE_FORMAT_OPTIONS: { value: DateFormat; label: string; example: string }[] = [
|
||||
{ value: "ymd", label: "Year-Month-Day", example: "2026-09-15" },
|
||||
@@ -69,7 +70,7 @@ export default function DisplaySettings() {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{loadError && <div className="alert alert-danger">{loadError}</div>}
|
||||
<ErrorNotice error={loadError} />
|
||||
|
||||
<div className="row row-cards">
|
||||
<div className="col-md-7">
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { useEffect, useState } from "react";
|
||||
import { api, type AppSettings } from "../../api/client";
|
||||
import { confirmDialog } from "../../utils/dialogs";
|
||||
import { ErrorNotice } from "../../components/Notice";
|
||||
|
||||
const INTERVAL_OPTIONS: { value: number; label: string }[] = [
|
||||
{ value: 1, label: "Every hour" },
|
||||
@@ -81,7 +82,7 @@ export default function LogSettings() {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{loadError && <div className="alert alert-danger">{loadError}</div>}
|
||||
<ErrorNotice error={loadError} />
|
||||
|
||||
<div className="row row-cards">
|
||||
<div className="col-md-7">
|
||||
@@ -145,7 +146,7 @@ export default function LogSettings() {
|
||||
Runs a purge immediately using the retention period above, regardless of whether automatic
|
||||
purging is enabled.
|
||||
</p>
|
||||
{purgeError && <div className="alert alert-danger mb-0">{purgeError}</div>}
|
||||
<ErrorNotice error={purgeError} className="mb-0" />
|
||||
{purgeResult && (
|
||||
<div className="alert alert-success mb-0">
|
||||
Deleted {purgeResult.diagDeleted} diagnostic log and {purgeResult.auditDeleted} audit log
|
||||
|
||||
@@ -4,6 +4,7 @@ import { confirmDialog } from "../../utils/dialogs";
|
||||
import { formatDateTime } from "../../utils/date";
|
||||
import { readableError } from "../../utils/errors";
|
||||
import { parseNames } from "../../utils/nameLists";
|
||||
import { ErrorNotice, SuccessNotice } from "../../components/Notice";
|
||||
|
||||
/** One list as it's being edited. The names are kept as the text in the box, so typing stays natural. */
|
||||
interface Draft {
|
||||
@@ -221,8 +222,8 @@ export default function NameSettings() {
|
||||
|
||||
return (
|
||||
<>
|
||||
{error && <div className="alert alert-danger">{error}</div>}
|
||||
{notice && <div className="alert alert-success">{notice}</div>}
|
||||
<ErrorNotice error={error} />
|
||||
<SuccessNotice notice={notice} />
|
||||
|
||||
<div className="card mb-3">
|
||||
<div className="card-header">
|
||||
@@ -334,7 +335,7 @@ export default function NameSettings() {
|
||||
{fetching ? "Fetching…" : "Fetch names"}
|
||||
</button>
|
||||
</div>
|
||||
{importError && <div className="alert alert-danger mt-3 mb-0">{importError}</div>}
|
||||
<ErrorNotice error={importError} className="mt-3 mb-0" />
|
||||
{preview && (
|
||||
<div className="mt-3">
|
||||
<div className="mb-2">
|
||||
|
||||
@@ -10,6 +10,7 @@ import {
|
||||
type QuietHoursSettings,
|
||||
type HealthCheckSettings,
|
||||
} from "../../api/client";
|
||||
import { ErrorNotice } from "../../components/Notice";
|
||||
|
||||
const TIMEZONES = [
|
||||
"UTC",
|
||||
@@ -212,7 +213,7 @@ export default function NotificationSettings() {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{loadError && <div className="alert alert-danger">{loadError}</div>}
|
||||
<ErrorNotice error={loadError} />
|
||||
|
||||
<div className="row row-cards">
|
||||
<div className="col-md-6">
|
||||
|
||||
@@ -3,6 +3,7 @@ import { api, type TagEntry } from "../../api/client";
|
||||
import { readableError } from "../../utils/errors";
|
||||
import { normalizeTagInput, refreshTagColors, tagBadge } from "../../utils/tags";
|
||||
import { confirmDialog, promptDialog } from "../../utils/dialogs";
|
||||
import { ErrorNotice, SuccessNotice } from "../../components/Notice";
|
||||
|
||||
const DEFAULT_PICK = "#3b82f6";
|
||||
|
||||
@@ -99,8 +100,8 @@ export default function TagSettings() {
|
||||
|
||||
return (
|
||||
<>
|
||||
{error && <div className="alert alert-danger">{error}</div>}
|
||||
{notice && <div className="alert alert-success">{notice}</div>}
|
||||
<ErrorNotice error={error} />
|
||||
<SuccessNotice notice={notice} />
|
||||
|
||||
<div className="card mb-3">
|
||||
<div className="card-header">
|
||||
|
||||
Reference in new issue
Block a user