Internet as a dependency: a node that can be needed, never judged down

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
bobbanandClaude Sonnet 5.5 committed 2026-10-30 23:14:24 +01:00
1 parent fca2dc0338
commit 7e625e7f42
11 files changed
+173 -22

No files matched your search

+10 -6
View File
@@ -8,9 +8,10 @@ import { readableError } from "../utils/errors";
import { toast } from "../utils/toast";
import { EmptyRow } from "../components/EmptyState";
const TYPE_LABELS = { server: "Server", integration: "Integration", device: "Network device" } as const;
const TYPE_LABELS = { server: "Server", integration: "Integration", device: "Network device", internet: "Internet" } as const;
const GROUP_LABELS = { server: "Servers", integration: "Integrations", device: "Network devices", internet: "Internet" } as const;
const linkTo = (type: string, id: number) => (type === "server" ? `/servers/${id}` : type === "device" ? "/network/devices" : "/integrations");
const linkTo = (type: string, id: number) => (type === "server" ? `/servers/${id}` : type === "device" ? "/network/devices" : type === "internet" ? "/map?view=dependencies" : "/integrations");
/** The options of a node picker, grouped by what they are. */
function NodeSelect({ id, label, nodes, value, onChange }: { id: string; label: string; nodes: DependencyNode[]; value: string; onChange: (key: string) => void }) {
@@ -21,10 +22,10 @@ function NodeSelect({ id, label, nodes, value, onChange }: { id: string; label:
</label>
<select id={id} className="form-select" value={value} onChange={(e) => onChange(e.target.value)}>
<option value="">— choose —</option>
{(["server", "integration", "device"] as const).map((type) => {
{(["server", "integration", "device", "internet"] as const).map((type) => {
const group = nodes.filter((n) => n.type === type);
return group.length === 0 ? null : (
<optgroup key={type} label={`${TYPE_LABELS[type]}s`}>
<optgroup key={type} label={GROUP_LABELS[type]}>
{group.map((n) => (
<option key={n.key} value={n.key}>
{n.name}
@@ -96,7 +97,7 @@ export default function DependencyEditor({ user }: { user: CurrentUser }) {
const parse = (key: string) => {
const [type, id] = key.split(":");
return { type: type as "server" | "integration" | "device", id: Number(id) };
return { type: type as DependencyNode["type"], id: Number(id) };
};
async function add(e: React.FormEvent) {
@@ -207,7 +208,7 @@ export default function DependencyEditor({ user }: { user: CurrentUser }) {
</div>
<div className="card-body row g-3 align-items-end">
<div className="col-md-5">
<NodeSelect id="dep-from" label="This…" nodes={data?.nodes ?? []} value={from} onChange={setFrom} />
<NodeSelect id="dep-from" label="This…" nodes={(data?.nodes ?? []).filter((n) => n.type !== "internet")} value={from} onChange={setFrom} />
</div>
<div className="col-md-5">
<NodeSelect id="dep-to" label="…needs this" nodes={(data?.nodes ?? []).filter((n) => n.key !== from)} value={to} onChange={setTo} />
@@ -218,6 +219,9 @@ export default function DependencyEditor({ user }: { user: CurrentUser }) {
</button>
</div>
</div>
<div className="card-footer text-secondary small">
<strong>Internet</strong> can be picked as what something needs — a cloud service, a VPS, the router. Nothing here watches the internet, so it never counts as down and holds no alert back; it is there so the map shows what relies on it, and so &ldquo;what depends on Internet?&rdquo; has an answer.
</div>
</form>
)}