feat: finish the fleets plugin, add ctx.hosts and host-commands SDK (B4)

This commit is contained in:
LukeGus committed 2026-09-23 13:10:18 -05:00
1 parent 37c015a760
commit c381955ed0
43 files changed
+835 -1999

No files matched your search

-46
View File
@@ -298,14 +298,6 @@ export const hosts = mysqlTable(
statsConfig: text("stats_config"),
dockerConfig: text("docker_config"),
webUiConfig: text("web_ui_config"),
enableProxmox: boolean("enable_proxmox")
.notNull()
.default(false),
proxmoxConfig: text("proxmox_config"),
enableProxmoxStats: boolean("enable_proxmox_stats")
.notNull()
.default(false),
proxmoxStatsConfig: text("proxmox_stats_config"),
terminalConfig: text("terminal_config"),
quickActions: text("quick_actions"),
notes: text("notes"),
@@ -1161,27 +1153,6 @@ export const hostMetricsPreferences = mysqlTable(
],
);
export const proxmoxStatsPreferences = mysqlTable(
"proxmox_stats_preferences",
{
id: int("id").autoincrement().primaryKey(),
userId: varchar("user_id", { length: 255 }).notNull().references(() => users.id, { onDelete: "cascade" }),
hostId: int("host_id").notNull().references(() => hosts.id, { onDelete: "cascade" }),
// JSON-encoded ProxmoxStatsLayout. Layout has no secrets, so it is stored as
// plain JSON (no field-level encryption), same convention as hostMetricsPreferences.layout.
layout: text("layout").notNull(),
createdAt: varchar("created_at", { length: 255 })
.notNull()
.default(sql`(CURRENT_TIMESTAMP)`),
updatedAt: varchar("updated_at", { length: 255 })
.notNull()
.default(sql`(CURRENT_TIMESTAMP)`),
},
(table) => [
uniqueIndex("idx_proxmox_stats_prefs_user_host").on(table.userId, table.hostId),
],
);
export const hostSidebarPreferences = mysqlTable("host_sidebar_preferences", {
userId: varchar("user_id", { length: 255 })
.primaryKey()
@@ -1387,23 +1358,6 @@ export const hostMetricsHistory = mysqlTable("host_metrics_history", {
});
// --- metrics-history end ---
// --- proxmox-node-history begin ---
export const proxmoxNodeHistory = mysqlTable("proxmox_node_history", {
id: int("id").autoincrement().primaryKey(),
hostId: int("host_id")
.notNull()
.references(() => hosts.id, { onDelete: "cascade" }),
ts: text("ts")
.notNull()
.default(sql`(CURRENT_TIMESTAMP)`),
cpuPercent: double("cpu_percent"),
memPercent: double("mem_percent"),
diskPercent: double("disk_percent"),
netRxBytes: int("net_rx_bytes"),
netTxBytes: int("net_tx_bytes"),
});
// --- proxmox-node-history end ---
// --- alerts begin ---
export const notificationChannels = mysqlTable("notification_channels", {
id: int("id").autoincrement().primaryKey(),