mirror of
https://github.com/Termix-SSH/Termix.git
synced 2026-11-01 08:05:23 +00:00
feat: add ctx.hosts create/update to the SDK, host-metrics drops proxmox
This commit is contained in:
1 parent
f9283ec83f
commit
218c5088e7
20 files changed
+194
-1329
No files matched your search
@@ -1,5 +1,5 @@
|
||||
import type { ComponentType } from "react";
|
||||
import { Activity, HardDrive, Server } from "lucide-react";
|
||||
import { Activity, Server } from "lucide-react";
|
||||
import type {
|
||||
HomepageWidgetContribution,
|
||||
HostEditorSectionProps,
|
||||
@@ -13,9 +13,6 @@ import HostMetricsApp from "./HostMetricsApp";
|
||||
import { HostStatsTab } from "./HostEditorStatsTab";
|
||||
import { metricsChartWidget } from "./MetricsChartWidget";
|
||||
import { MetricsRetentionSetting } from "./MetricsRetentionSetting";
|
||||
import { ProxmoxStatsTab } from "./proxmox-stats/ProxmoxStatsTab";
|
||||
import ProxmoxStatsApp from "./proxmox-stats/ProxmoxStatsApp";
|
||||
import { HostProxmoxStatsTab } from "./proxmox-stats/HostProxmoxStatsTab";
|
||||
|
||||
type SectionSetField = Parameters<typeof HostStatsTab>[0]["setField"];
|
||||
|
||||
@@ -31,26 +28,10 @@ function MetricsTab({ sshHost, label, isVisible }: TabProps) {
|
||||
);
|
||||
}
|
||||
|
||||
function ProxmoxTab({ sshHost, label, isVisible }: TabProps) {
|
||||
return (
|
||||
<ProxmoxStatsTab
|
||||
hostConfig={sshHost as unknown as SSHHost}
|
||||
title={label}
|
||||
isVisible={isVisible}
|
||||
isTopbarOpen={false}
|
||||
embedded={true}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
function MetricsStandalone({ hostId }: StandaloneViewProps) {
|
||||
return <HostMetricsApp hostId={hostId} />;
|
||||
}
|
||||
|
||||
function ProxmoxStandalone({ hostId }: StandaloneViewProps) {
|
||||
return <ProxmoxStatsApp hostId={hostId} />;
|
||||
}
|
||||
|
||||
function MetricsHostSection({
|
||||
form,
|
||||
setField,
|
||||
@@ -65,20 +46,6 @@ function MetricsHostSection({
|
||||
);
|
||||
}
|
||||
|
||||
/** Drawn inside the proxmox plugin's host editor tab, when it runs. */
|
||||
function ProxmoxStatsHostSection({
|
||||
form,
|
||||
setField,
|
||||
}: {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
form: any;
|
||||
setField: (key: string, value: unknown) => void;
|
||||
}) {
|
||||
return (
|
||||
<HostProxmoxStatsTab form={form} setField={setField as SectionSetField} />
|
||||
);
|
||||
}
|
||||
|
||||
export function activate(app: TermixApp): void {
|
||||
app.registerTab("host-metrics", MetricsTab, {
|
||||
icon: Server,
|
||||
@@ -93,15 +60,6 @@ export function activate(app: TermixApp): void {
|
||||
preload: () => import("./HostMetricsTab"),
|
||||
});
|
||||
|
||||
app.registerTab("proxmox-stats", ProxmoxTab, {
|
||||
icon: HardDrive,
|
||||
titleKey: "nav.proxmoxStats",
|
||||
requiresHost: true,
|
||||
noHostMessageKey: "proxmoxStats.noHostSelected",
|
||||
standalone: ProxmoxStandalone,
|
||||
preload: () => import("./proxmox-stats/ProxmoxStatsTab"),
|
||||
});
|
||||
|
||||
app.registerHostAction({
|
||||
id: "host-metrics",
|
||||
titleKey: "nav.hostMetrics",
|
||||
@@ -117,17 +75,6 @@ export function activate(app: TermixApp): void {
|
||||
?.metricsEnabled !== false,
|
||||
});
|
||||
|
||||
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,
|
||||
});
|
||||
|
||||
app.registerHostEditorSection({
|
||||
id: "host-metrics",
|
||||
group: "ssh",
|
||||
@@ -137,15 +84,6 @@ export function activate(app: TermixApp): void {
|
||||
component: MetricsHostSection,
|
||||
});
|
||||
|
||||
app.registerSlotContribution("proxmox.hostEditor", {
|
||||
actionId: "host-metrics.proxmoxStats",
|
||||
titleKey: "nav.proxmoxStats",
|
||||
kind: "component",
|
||||
component: ProxmoxStatsHostSection as unknown as ComponentType<
|
||||
Record<string, unknown>
|
||||
>,
|
||||
});
|
||||
|
||||
app.registerHomepageWidget(
|
||||
metricsChartWidget as unknown as HomepageWidgetContribution,
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user