Add an osTicket integration: list open tickets from its database

osTicket's own REST API only supports creating tickets, not listing or
reading them, so this reads osTicket's MySQL/MariaDB database directly
with a read-only user instead - the only integration in this app that
isn't a REST API. Joins the ticket, status, priority, department,
staff, team, and user tables, filtered to tickets in the "open" state
(status names are customizable per install, but that state flag isn't).

Surfaces per-ticket subject, priority, department, assignee, requester,
and osTicket's own overdue/awaiting-reply flags, plus a page at
/osticket and a Dashboard widget with open/overdue/awaiting-reply
counts.

Not verified against a live instance: unlike the HTTP-based
integrations, there was no way to fake a MySQL server to test against
in this environment, so the query is built from osTicket's published
schema but has never actually run against a real database. See
INTEGRATIONS.md for the read-only grant needed and further caveats.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
bobbanandClaude Sonnet 5 committed 2026-09-29 23:09:56 +02:00
1 parent 69e9325927
commit de5c39dddf
20 files changed
+754 -12

No files matched your search

+51 -2
View File
@@ -6,6 +6,7 @@ import {
type DomainList,
type IntegrationSummary,
type IntegrationType,
type OsTicketTicketsResponse,
type PbsDatastoresResponse,
type SecretRecord,
type ServerSummary,
@@ -204,6 +205,7 @@ const WIDGETS: { type: IntegrationType; label: string }[] = [
{ type: "dockhand", label: "Dockhand / Docker" },
{ type: "uptimekuma", label: "Uptime Kuma" },
{ type: "pbs", label: "Proxmox Backup Server" },
{ type: "osticket", label: "osTicket" },
];
interface UptimeKumaSummary {
@@ -214,6 +216,12 @@ interface UptimeKumaSummary {
statusBreakdown: { label: string; count: number }[];
}
interface OsTicketSummary {
total: number;
overdue: number;
awaitingReply: number;
}
interface PbsSummary {
datastoreCount: number;
failedSnapshotCount: number;
@@ -286,6 +294,7 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
const [synologySummary, setSynologySummary] = useState<SynologySummary | null>(null);
const [uptimeKumaSummary, setUptimeKumaSummary] = useState<UptimeKumaSummary | null>(null);
const [pbsSummary, setPbsSummary] = useState<PbsSummary | null>(null);
const [osTicketSummary, setOsTicketSummary] = useState<OsTicketSummary | null>(null);
const [dnsStats, setDnsStats] = useState<Awaited<ReturnType<typeof api.dns.stats>> | null>(null);
const [dnsError, setDnsError] = useState<string | null>(null);
@@ -487,6 +496,24 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
.catch(() => setPbsSummary(null));
}, [integrations]);
useEffect(() => {
const osticket = integrations?.find((i) => i.type === "osticket" && i.enabled);
if (!osticket) {
setOsTicketSummary(null);
return;
}
api.integrations.osticket
.tickets(osticket.id)
.then((res: OsTicketTicketsResponse) =>
setOsTicketSummary({
total: res.summary.total,
overdue: res.summary.overdue,
awaitingReply: res.summary.awaitingReply,
}),
)
.catch(() => setOsTicketSummary(null));
}, [integrations]);
const domains = domainList?.domains ?? [];
const expiredDomains = domains.filter((d) => d.status === "expired");
const expiringDomains = domains.filter((d) => d.status === "expiring");
@@ -791,7 +818,7 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
<SectionHeader
title="Integrations"
hint="Live status widgets for Proxmox, Synology, Semaphore, Tailscale, Gitea, Dockhand, Uptime Kuma, and Proxmox Backup Server will appear here as each integration is connected."
hint="Live status widgets for Proxmox, Synology, Semaphore, Tailscale, Gitea, Dockhand, Uptime Kuma, Proxmox Backup Server, and osTicket will appear here as each integration is connected."
/>
<div className="row row-cards">
{WIDGETS.map(({ type, label }) => {
@@ -804,6 +831,7 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
const isLiveSynology = type === "synology" && integration && synologySummary;
const isLiveUptimeKuma = type === "uptimekuma" && integration && uptimeKumaSummary;
const isLivePbs = type === "pbs" && integration && pbsSummary;
const isLiveOsTicket = type === "osticket" && integration && osTicketSummary;
const isLive =
isLiveTailscale ||
isLiveGitea ||
@@ -812,7 +840,8 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
isLiveProxmox ||
isLiveSynology ||
isLiveUptimeKuma ||
isLivePbs;
isLivePbs ||
isLiveOsTicket;
return (
<WidgetCard
@@ -1008,6 +1037,26 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
/>
</div>
</div>
) : isLiveOsTicket ? (
<div className="row g-2 mb-3">
<div className="col-4">
<MiniStat label="Open" value={osTicketSummary!.total} />
</div>
<div className="col-4">
<MiniStat
label="Overdue"
value={osTicketSummary!.overdue}
accent={osTicketSummary!.overdue > 0 ? "#ef4444" : undefined}
/>
</div>
<div className="col-4">
<MiniStat
label="Awaiting reply"
value={osTicketSummary!.awaitingReply}
accent={osTicketSummary!.awaitingReply > 0 ? "#f59e0b" : undefined}
/>
</div>
</div>
) : (
<div className="text-secondary mt-2">
{integration ? (