refactor: unify SSH machines as services

This commit is contained in:
Developer
2026-07-14 20:58:46 +00:00
parent fe90feb1b7
commit 37533dd219
42 changed files with 3103 additions and 4960 deletions
@@ -1,4 +1,4 @@
import { describe, it, expect } from "vitest";
import { describe, expect, it } from "vitest";
import { configuredNavEntries, SERVICE_TYPE_NAV_ENTRIES } from "../navEntries";
describe("navEntries", () => {
@@ -13,37 +13,44 @@ describe("navEntries", () => {
expect(entries[0].path).toBe("/services/jellyfin");
});
it("returns one SSH Tasks entry when ssh_tasks is configured", () => {
const entries = configuredNavEntries(new Set(["ssh_tasks"]));
expect(entries).toHaveLength(1);
expect(entries[0].label).toBe("SSH Tasks");
it("does not expose remote machines as a top-level entry", () => {
expect(configuredNavEntries(new Set(["remote_machine"]))).toEqual([]);
});
it("returns all observability entries", () => {
const entries = configuredNavEntries(
new Set(["alertmanager", "prometheus"]),
);
expect(entries.map((e) => e.label)).toEqual(["Alertmanager", "Prometheus"]);
expect(entries.map((entry) => entry.label)).toEqual([
"Alertmanager",
"Prometheus",
]);
});
it("returns Backups + Authentik when configured", () => {
const entries = configuredNavEntries(new Set(["backups", "authentik"]));
expect(entries.map((e) => e.label)).toEqual(["Backups", "Authentik"]);
expect(entries.map((entry) => entry.label)).toEqual([
"Backups",
"Authentik",
]);
});
it("nextcloud has no nav entries in the static map", () => {
it("keeps non-operational service types out of the static map", () => {
expect(
SERVICE_TYPE_NAV_ENTRIES.filter((e) => e.serviceType === "nextcloud"),
SERVICE_TYPE_NAV_ENTRIES.filter(
(entry) =>
entry.serviceType === "nextcloud" ||
entry.serviceType === "remote_machine",
),
).toEqual([]);
});
it("preserves declaration order across mixed types", () => {
it("preserves declaration order across mixed navigable types", () => {
const entries = configuredNavEntries(
new Set(["authentik", "ssh_tasks", "jellyfin"]),
new Set(["authentik", "remote_machine", "jellyfin"]),
);
expect(entries.map((e) => e.label)).toEqual([
expect(entries.map((entry) => entry.label)).toEqual([
"Jellyfin",
"SSH Tasks",
"Authentik",
]);
});