chore: lock the plugin boundary and remove 2.9.0 leftovers

This commit is contained in:
LukeGus committed 2026-09-25 07:24:46 -05:00
1 parent 6489b62ece
commit 2961297989
399 files changed
+3964 -5627

No files matched your search

@@ -0,0 +1,42 @@
import { useEffect, useState } from "react";
import { Network } from "lucide-react";
import { useTranslation } from "@termix/plugin-sdk/frontend";
import { getTunnelStatuses } from "./api";
/** The dashboard's "active tunnels" counter; a click opens the tunnels tab. */
export function ActiveTunnelsCounter({ onOpen }: { onOpen: () => void }) {
const { t } = useTranslation();
const [count, setCount] = useState(0);
useEffect(() => {
let cancelled = false;
getTunnelStatuses()
.then((statuses) => {
if (cancelled) return;
setCount(
Object.values(statuses ?? {}).filter(
(status) =>
(status as { status?: string })?.status?.toUpperCase() ===
"CONNECTED",
).length,
);
})
.catch(() => {});
return () => {
cancelled = true;
};
}, []);
return (
<button
onClick={onOpen}
className="flex items-center gap-2.5 px-4 py-2.5 hover:bg-muted transition-colors cursor-pointer text-left"
>
<Network className="size-3.5 text-muted-foreground shrink-0" />
<span className="text-base font-bold">{count}</span>
<span className="text-[10px] text-muted-foreground uppercase tracking-widest font-semibold">
{t("tunnels.activeTunnels")}
</span>
</button>
);
}
+13 -6
View File
@@ -13,7 +13,8 @@ import {
TunnelWidget,
TunnelWidgetEditForm,
} from "./views";
import { getTunnelStatuses, setTunnelsApi } from "./api";
import { setTunnelsApi } from "./api";
import { ActiveTunnelsCounter } from "./ActiveTunnelsCounter";
import { hostTunnelSettings } from "./host-tunnels";
// Matches the homepage canvas grid.
@@ -96,14 +97,20 @@ export function activate(app: TermixApp): void {
editFormComponent: TunnelWidgetEditForm,
} as HomepageWidgetContribution);
// The dashboard's active tunnel counter reads and opens these, and gets
// undefined back while the plugin is off.
app.registerAction("tunnels.statuses", (() => getTunnelStatuses()) as never, {
permission: "use",
});
// The dashboard's active tunnel counter.
app.registerAction(
"tunnels.open",
(() => app.tabs.openSingletonTab("tunnel")) as never,
{ permission: "use" },
);
app.registerSlotContribution("dashboard.counters", {
actionId: "tunnels.open",
titleKey: "tunnels.activeTunnels",
kind: "component",
component: (() => (
<ActiveTunnelsCounter
onOpen={() => void app.tabs.openSingletonTab("tunnel")}
/>
)) as never,
});
}