mirror of
https://github.com/Termix-SSH/Termix.git
synced 2026-10-29 14:45:24 +00:00
feat: type the plugin host record, move plugin strings out of core and add lint checks
This commit is contained in:
1 parent
bba06f7ff6
commit
b8bbcd2196
626 files changed
+23884
-4590
No files matched your search
@@ -158,8 +158,6 @@ export function ProxmoxDiscoverDialog({
|
||||
jumpHosts: discoveredJumpHosts ?? undefined,
|
||||
...importAuth,
|
||||
enableSsh: g.connectionType !== "rdp",
|
||||
enableRdp: g.connectionType === "rdp",
|
||||
enableDocker: g.enableDocker,
|
||||
connectionType: g.connectionType,
|
||||
tags: [
|
||||
"proxmox",
|
||||
@@ -168,8 +166,13 @@ export function ProxmoxDiscoverDialog({
|
||||
g.type === "lxc" ? `ct-${g.vmid}` : `vm-${g.vmid}`,
|
||||
...(g.enableDocker ? ["docker"] : []),
|
||||
],
|
||||
// This plugin's host settings travel with the import like an export's.
|
||||
// Host settings travel with the import like an export's, keyed by
|
||||
// the plugin that keeps them.
|
||||
pluginSettings: {
|
||||
...(g.connectionType === "rdp"
|
||||
? { "remote-desktop": { enableRdp: true, rdpPort: 3389 } }
|
||||
: {}),
|
||||
...(g.enableDocker ? { docker: { enableDocker: true } } : {}),
|
||||
proxmox: {
|
||||
proxmoxConfig: {
|
||||
source: {
|
||||
|
||||
@@ -92,6 +92,13 @@ function ProxmoxStatsStandalone({ hostId }: StandaloneViewProps) {
|
||||
return <ProxmoxStatsApp hostId={hostId} />;
|
||||
}
|
||||
|
||||
/** This plugin's host settings, as they arrive on the host record. */
|
||||
export function proxmoxSettings(
|
||||
host: Pick<PluginHostRecord, "pluginSettings">,
|
||||
): Record<string, unknown> {
|
||||
return host.pluginSettings?.proxmox ?? {};
|
||||
}
|
||||
|
||||
export function activate(app: TermixApp): void {
|
||||
setProxmoxApp(app);
|
||||
app.onDispose(() => setProxmoxApp(null));
|
||||
@@ -136,7 +143,7 @@ export function activate(app: TermixApp): void {
|
||||
return (
|
||||
<DropdownMenuItem
|
||||
onClick={() => openDiscover({})}
|
||||
disabled={!hosts.some((host) => host.enableProxmox)}
|
||||
disabled={!hosts.some((host) => proxmoxSettings(host).enableProxmox)}
|
||||
>
|
||||
<Server className="size-3.5 mr-2" />
|
||||
{t("hosts.proxmoxImportTitle")}
|
||||
@@ -166,9 +173,9 @@ export function activate(app: TermixApp): void {
|
||||
icon: Boxes,
|
||||
kind: "open",
|
||||
order: 90,
|
||||
when: (host) => !!host.enableProxmox,
|
||||
when: (host) => !!proxmoxSettings(host).enableProxmox,
|
||||
run: (host) => {
|
||||
const config = host.proxmoxConfig as
|
||||
const config = proxmoxSettings(host).proxmoxConfig as
|
||||
| { defaultCredentialId?: number | null; defaultAuthType?: string }
|
||||
| undefined;
|
||||
openDiscover({
|
||||
@@ -205,6 +212,6 @@ export function activate(app: TermixApp): void {
|
||||
order: 60,
|
||||
tabType: "proxmox-stats",
|
||||
copyUrlView: "proxmox-stats",
|
||||
when: (host) => host.enableProxmoxStats === true,
|
||||
when: (host) => proxmoxSettings(host).enableProxmoxStats === true,
|
||||
});
|
||||
}
|
||||
Reference in new issue
Block a user