fixes and improvements
This commit is contained in:
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user