feat: move proxmox node stats and collectors into the proxmox plugin

This commit is contained in:
LukeGus committed 2026-09-23 13:06:18 -05:00
1 parent 218c5088e7
commit 37c015a760
37 files changed
+3775 -227

No files matched your search

+48 -2
View File
@@ -1,15 +1,21 @@
import { useEffect, useState, type ComponentType } from "react";
import { Boxes, Server } from "lucide-react";
import { Boxes, HardDrive, Server } from "lucide-react";
import {
useHosts,
useTranslation,
type HostEditorSectionProps,
type StandaloneViewProps,
type TabProps,
type TermixApp,
} from "@termix/plugin-sdk/frontend";
import { ComponentSlot, DropdownMenuItem } from "@termix/plugin-sdk/ui";
import type { SSHHostWithStatus } from "@/main-axios";
import { ProxmoxDiscoverDialog } from "./ProxmoxDiscoverDialog";
import { HostProxmoxTab } from "./HostProxmoxTab";
import { ProxmoxStatsTab } from "./stats/ProxmoxStatsTab";
import ProxmoxStatsApp from "./stats/ProxmoxStatsApp";
import { HostProxmoxStatsTab } from "./stats/HostProxmoxStatsTab";
import type { SSHHost } from "@/types";
interface DiscoverRequest {
hostId?: number;
@@ -26,12 +32,32 @@ function ProxmoxHostSection({ form, setField }: HostEditorSectionProps) {
form={form}
setField={setField as Parameters<typeof HostProxmoxTab>[0]["setField"]}
/>
{/* Other plugins add Proxmox-related settings here (stats). */}
<HostProxmoxStatsTab
form={form}
setField={setField as Parameters<typeof HostProxmoxTab>[0]["setField"]}
/>
{/* Other plugins add Proxmox-related settings here. */}
<ComponentSlot slotId="proxmox.hostEditor" props={{ form, setField }} />
</>
);
}
function ProxmoxStatsTabView({ sshHost, label, isVisible }: TabProps) {
return (
<ProxmoxStatsTab
hostConfig={sshHost as unknown as SSHHost}
title={label}
isVisible={isVisible}
isTopbarOpen={false}
embedded={true}
/>
);
}
function ProxmoxStatsStandalone({ hostId }: StandaloneViewProps) {
return <ProxmoxStatsApp hostId={hostId} />;
}
export function activate(app: TermixApp): void {
// The dialog lives in the hosts panel; the menu item and host action open
// it through this, created per activation.
@@ -125,4 +151,24 @@ export function activate(app: TermixApp): void {
order: 50,
component: ProxmoxHostSection,
});
app.registerTab("proxmox-stats", ProxmoxStatsTabView, {
icon: HardDrive,
titleKey: "nav.proxmoxStats",
requiresHost: true,
noHostMessageKey: "proxmoxStats.noHostSelected",
standalone: ProxmoxStatsStandalone,
preload: () => import("./stats/ProxmoxStatsTab"),
});
app.registerHostAction({
id: "proxmox-stats",
titleKey: "nav.proxmoxStats",
icon: HardDrive,
kind: "open",
order: 60,
tabType: "proxmox-stats",
copyUrlView: "proxmox-stats",
when: (host) => host.enableProxmoxStats === true,
});
}