fixes and improvements

This commit is contained in:
2026-05-07 12:34:16 +02:00
parent 2ecca84892
commit bba23165ab
14 changed files with 860 additions and 158 deletions
+26
View File
@@ -33,6 +33,8 @@ import type {
ResolvedPath,
ResetLocalDatabaseInput,
ResetLocalDatabaseResponse,
DashboardShortcut,
DashboardShortcutInput,
} from "../types";
const BASE_URL = import.meta.env.VITE_API_URL || "/api";
@@ -165,6 +167,30 @@ export const fetchMonitoringPoller = () =>
get<MonitoringPollerStatus>("/api/monitoring/poller");
export const fetchMonitoringOverview = () =>
get<MonitoringOverviewResponse>("/api/dashboard/monitoring");
export const fetchDashboardShortcuts = () =>
get<DashboardShortcut[]>("/api/dashboard/shortcuts");
export const saveDashboardShortcut = (shortcut: DashboardShortcutInput) =>
fetch(
buildUrl(
shortcut.id
? `/api/dashboard/shortcuts/${encodeURIComponent(shortcut.id)}`
: "/api/dashboard/shortcuts",
),
{
method: shortcut.id ? "PUT" : "POST",
headers: buildHeaders(true),
body: JSON.stringify(shortcut),
},
).then(async (response) => {
if (!response.ok) {
throw new Error(`${response.status}: ${await readErrorDetail(response)}`);
}
return response.json() as Promise<DashboardShortcut>;
});
export const deleteDashboardShortcut = (shortcutId: string) =>
del<{ status: string }>(
`/api/dashboard/shortcuts/${encodeURIComponent(shortcutId)}`,
);
export const fetchMonitoringStatus = (machineId?: string) =>
get<MonitoringStatus>(
"/api/monitoring/status",