mirror of
https://github.com/Termix-SSH/Termix.git
synced 2026-10-29 14:45:24 +00:00
fix: proxmox guest sync, startup snippet sync, drop dead cloudflare ssh transport
This commit is contained in:
1 parent
44062e30d1
commit
ffa872ebd3
19 files changed
+270
-292
No files matched your search
@@ -278,7 +278,7 @@ export function ConnectionDefaultsSettings() {
|
||||
<option value="">{inheritLabel}</option>
|
||||
{CURSOR_STYLES.map((style) => (
|
||||
<option key={style.value} value={style.value}>
|
||||
{style.label}
|
||||
{t(style.labelKey)}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
|
||||
@@ -270,7 +270,7 @@ export function HostTerminalSettings({
|
||||
>
|
||||
{CURSOR_STYLES.map((s) => (
|
||||
<option key={s.value} value={s.value}>
|
||||
{s.label}
|
||||
{t(s.labelKey)}
|
||||
</option>
|
||||
))}
|
||||
</Select2>
|
||||
@@ -322,7 +322,7 @@ export function HostTerminalSettings({
|
||||
>
|
||||
{BELL_STYLES.map((b) => (
|
||||
<option key={b.value} value={b.value}>
|
||||
{b.label}
|
||||
{t(b.labelKey)}
|
||||
</option>
|
||||
))}
|
||||
</Select2>
|
||||
@@ -341,8 +341,12 @@ export function HostTerminalSettings({
|
||||
}
|
||||
className="flex h-9 w-full border border-border bg-background px-3 py-1 text-xs outline-none focus:ring-1 focus:ring-ring"
|
||||
>
|
||||
<option value="normal">Normal (DEL)</option>
|
||||
<option value="control-h">Control-H (BS)</option>
|
||||
<option value="normal">
|
||||
{t("hosts.backspaceModeNormal")}
|
||||
</option>
|
||||
<option value="control-h">
|
||||
{t("hosts.backspaceModeControlH")}
|
||||
</option>
|
||||
</Select2>
|
||||
</div>
|
||||
</div>
|
||||
@@ -850,7 +854,7 @@ export function HostTerminalSettings({
|
||||
>
|
||||
{FAST_SCROLL_MODIFIERS.map((m) => (
|
||||
<option key={m.value} value={m.value}>
|
||||
{m.label}
|
||||
{t(m.labelKey)}
|
||||
</option>
|
||||
))}
|
||||
</Select2>
|
||||
|
||||
@@ -299,7 +299,7 @@ export function KeybindingsDialog({
|
||||
: formatCombo(def.combo)}
|
||||
</span>
|
||||
<span className="text-xs text-muted-foreground truncate">
|
||||
{def.description}
|
||||
{t(def.descriptionKey)}
|
||||
</span>
|
||||
</div>
|
||||
<div className="flex items-center gap-1 shrink-0">
|
||||
|
||||
@@ -1,109 +0,0 @@
|
||||
import { describe, it, expect } from "vitest";
|
||||
import { registerHostProtocol } from "@/sidebar/host-protocols";
|
||||
import type { Host } from "@/types/ui-types";
|
||||
import {
|
||||
buildStatusTooltip,
|
||||
statusCheckEnabled,
|
||||
} from "@/sidebar/tree/HostItem/HostItem";
|
||||
|
||||
// Minimal host factory – only the fields buildStatusTooltip reads.
|
||||
function makeHost(overrides: Partial<Host> = {}): Host {
|
||||
return {
|
||||
id: 1,
|
||||
name: "test-host",
|
||||
ip: "127.0.0.1",
|
||||
username: "user",
|
||||
enableSsh: true,
|
||||
enableRdp: false,
|
||||
enableVnc: false,
|
||||
enableTelnet: false,
|
||||
statusCheckEnabled: true,
|
||||
...overrides,
|
||||
} as unknown as Host;
|
||||
}
|
||||
|
||||
// Translator that returns human-readable labels, not key paths.
|
||||
// This is what the review asked for: assert the rendered labels,
|
||||
// not the key paths the translator falls back to when a resource is missing.
|
||||
const t = (key: string): string =>
|
||||
({
|
||||
"hosts.status.available": "Available",
|
||||
"hosts.status.reachable": "Reachable, not authenticated",
|
||||
"hosts.status.offline": "Offline",
|
||||
"hosts.status.monitoringDisabled": "Monitoring disabled",
|
||||
})[key] ?? key;
|
||||
|
||||
describe("buildStatusTooltip", () => {
|
||||
it("returns the translated 'Available' label for online status", () => {
|
||||
const host = makeHost();
|
||||
const tooltip = buildStatusTooltip(host, "online", t);
|
||||
expect(tooltip).toContain("Available");
|
||||
expect(tooltip).not.toContain("hosts.status.");
|
||||
});
|
||||
|
||||
it("returns the translated 'Reachable, not authenticated' label for reachable status", () => {
|
||||
const host = makeHost();
|
||||
const tooltip = buildStatusTooltip(host, "reachable", t);
|
||||
expect(tooltip).toContain("Reachable, not authenticated");
|
||||
expect(tooltip).not.toContain("hosts.status.");
|
||||
});
|
||||
|
||||
it("returns the translated 'Offline' label for offline status", () => {
|
||||
const host = makeHost();
|
||||
const tooltip = buildStatusTooltip(host, "offline", t);
|
||||
expect(tooltip).toContain("Offline");
|
||||
expect(tooltip).not.toContain("hosts.status.");
|
||||
});
|
||||
|
||||
it("returns 'Monitoring disabled' when status check is disabled", () => {
|
||||
const host = makeHost({ statusCheckEnabled: false });
|
||||
const tooltip = buildStatusTooltip(host, "online", t);
|
||||
expect(tooltip).toBe("Monitoring disabled");
|
||||
});
|
||||
|
||||
it("includes protocol names in the tooltip when protocols are enabled", () => {
|
||||
const dispose = registerHostProtocol({
|
||||
id: "demo-desktop",
|
||||
pluginId: "demo",
|
||||
settingKey: "enableDemo",
|
||||
defaultPort: 3389,
|
||||
titleKey: "Demo Desktop",
|
||||
icon: () => null,
|
||||
});
|
||||
const host = makeHost({
|
||||
enableSsh: true,
|
||||
pluginSettings: { demo: { enableDemo: true } },
|
||||
});
|
||||
const tooltip = buildStatusTooltip(host, "online", t);
|
||||
dispose();
|
||||
expect(tooltip).toContain("SSH");
|
||||
expect(tooltip).toContain("Demo Desktop");
|
||||
expect(tooltip).toContain("Available");
|
||||
});
|
||||
|
||||
it("returns just the status label when no protocols are enabled", () => {
|
||||
const host = makeHost({ enableSsh: false });
|
||||
const tooltip = buildStatusTooltip(host, "online", t);
|
||||
expect(tooltip).toBe("Available");
|
||||
});
|
||||
|
||||
it("does not render key paths when a translator is supplied", () => {
|
||||
const host = makeHost();
|
||||
const tooltip = buildStatusTooltip(host, "online", t);
|
||||
// The tooltip must never show the raw key path – that means the
|
||||
// translation resource is missing, which is the bug #1265 fixed.
|
||||
expect(tooltip).not.toMatch(/hosts\.status\./);
|
||||
});
|
||||
});
|
||||
|
||||
describe("statusCheckEnabled", () => {
|
||||
it("returns true when statusCheckEnabled is not set (default)", () => {
|
||||
const host = makeHost({ statusCheckEnabled: undefined });
|
||||
expect(statusCheckEnabled(host)).toBe(true);
|
||||
});
|
||||
|
||||
it("returns false when statusCheckEnabled is explicitly false", () => {
|
||||
const host = makeHost({ statusCheckEnabled: false });
|
||||
expect(statusCheckEnabled(host)).toBe(false);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user