mirror of
https://github.com/Termix-SSH/Termix.git
synced 2026-10-29 06:35:24 +00:00
feat: wire remote-desktop plugin into core and rename i18n keys
Repoints core consumers (dispatcher, collab, session-sharing, tab utils) at the plugin, adds isTabTypeAvailable gating for rdp/vnc/ telnet, widens hostCapability to accept an array, and renames the guacamole i18n namespace to remoteDesktop.
This commit is contained in:
1 parent
c6bcfdb80d
commit
76b2e5739a
41 files changed
+361
-686
No files matched your search
@@ -29,12 +29,12 @@ describe("ConnectionScreen", () => {
|
||||
render(
|
||||
<ConnectionScreen
|
||||
status="disconnected"
|
||||
message="guacamole.hostNotFound"
|
||||
message="remoteDesktop.hostNotFound"
|
||||
/>,
|
||||
),
|
||||
).not.toThrow();
|
||||
|
||||
expect(screen.getByText("guacamole.hostNotFound")).toBeTruthy();
|
||||
expect(screen.getByText("remoteDesktop.hostNotFound")).toBeTruthy();
|
||||
expect(screen.getByRole("status").getAttribute("data-status")).toBe(
|
||||
"disconnected",
|
||||
);
|
||||
|
||||
@@ -38,9 +38,12 @@ vi.mock("@xterm/addon-fit", () => ({
|
||||
},
|
||||
}));
|
||||
|
||||
vi.mock("@/features/guacamole/GuacamoleDisplay.tsx", () => ({
|
||||
GuacamoleDisplay: () => <div data-testid="guacamole-display" />,
|
||||
}));
|
||||
vi.mock(
|
||||
"../../../../../plugins/remote-desktop/frontend/GuacamoleDisplay.tsx",
|
||||
() => ({
|
||||
GuacamoleDisplay: () => <div data-testid="guacamole-display" />,
|
||||
}),
|
||||
);
|
||||
|
||||
import SharedSessionView from "../../../features/session-sharing/SharedSessionView";
|
||||
|
||||
|
||||
@@ -67,6 +67,38 @@ function aiPlugin(overrides: Partial<PluginSummary> = {}): PluginSummary {
|
||||
});
|
||||
}
|
||||
|
||||
function remoteDesktopPlugin(
|
||||
overrides: Partial<PluginSummary> = {},
|
||||
): PluginSummary {
|
||||
return plugin({
|
||||
id: "remote-desktop",
|
||||
name: "Remote Desktop",
|
||||
contributes: {
|
||||
tabs: [
|
||||
{
|
||||
id: "rdp",
|
||||
titleKey: "hosts.tabRdp",
|
||||
icon: "Monitor",
|
||||
openFrom: ["host-context-menu", "palette"],
|
||||
},
|
||||
{
|
||||
id: "vnc",
|
||||
titleKey: "hosts.tabVnc",
|
||||
icon: "MousePointerClick",
|
||||
openFrom: ["host-context-menu", "palette"],
|
||||
},
|
||||
{
|
||||
id: "telnet",
|
||||
titleKey: "hosts.tabTelnet",
|
||||
icon: "Terminal",
|
||||
openFrom: ["host-context-menu", "palette"],
|
||||
},
|
||||
],
|
||||
},
|
||||
...overrides,
|
||||
});
|
||||
}
|
||||
|
||||
describe("plugin state applied to the shell", () => {
|
||||
afterEach(() => {
|
||||
resetPluginState();
|
||||
@@ -181,6 +213,39 @@ describe("plugin state applied to the shell", () => {
|
||||
expect(isTabTypeAvailable("terminal")).toBe(true);
|
||||
});
|
||||
|
||||
it("allows rdp/vnc/telnet tabs while remote-desktop is enabled", () => {
|
||||
applyPluginState([remoteDesktopPlugin({ enabled: true })]);
|
||||
expect(isTabTypeAvailable("rdp")).toBe(true);
|
||||
expect(isTabTypeAvailable("vnc")).toBe(true);
|
||||
expect(isTabTypeAvailable("telnet")).toBe(true);
|
||||
});
|
||||
|
||||
it("blocks rdp/vnc/telnet tabs when remote-desktop is disabled", () => {
|
||||
applyPluginState([remoteDesktopPlugin({ enabled: false })]);
|
||||
expect(isTabTypeAvailable("rdp")).toBe(false);
|
||||
expect(isTabTypeAvailable("vnc")).toBe(false);
|
||||
expect(isTabTypeAvailable("telnet")).toBe(false);
|
||||
});
|
||||
|
||||
it("allows rdp/vnc/telnet tabs again when remote-desktop is re-enabled", () => {
|
||||
applyPluginState([remoteDesktopPlugin({ enabled: false })]);
|
||||
expect(isTabTypeAvailable("rdp")).toBe(false);
|
||||
|
||||
applyPluginState([remoteDesktopPlugin({ enabled: true })]);
|
||||
expect(isTabTypeAvailable("rdp")).toBe(true);
|
||||
expect(isTabTypeAvailable("vnc")).toBe(true);
|
||||
expect(isTabTypeAvailable("telnet")).toBe(true);
|
||||
});
|
||||
|
||||
it("disabling remote-desktop does not affect the terminal, and vice versa", () => {
|
||||
applyPluginState([
|
||||
remoteDesktopPlugin({ enabled: false }),
|
||||
plugin({ enabled: true }),
|
||||
]);
|
||||
expect(isTabTypeAvailable("rdp")).toBe(false);
|
||||
expect(isTabTypeAvailable("terminal")).toBe(true);
|
||||
});
|
||||
|
||||
it("reports enablement, defaulting to true before the first load", () => {
|
||||
expect(isPluginEnabled("ssh-terminal")).toBe(true);
|
||||
|
||||
|
||||
Reference in new issue
Block a user