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

+5 -2
View File
@@ -1952,7 +1952,8 @@ export interface LifecycleReport {
export type AssetKind = "server" | "storage" | "network" | "power" | "client" | "other";
export type DependencyNodeType = "server" | "integration" | "device";
/** "internet" is the one node that is only ever needed and never judged down (there is just one, id 1). */
export type DependencyNodeType = "server" | "integration" | "device" | "internet";
/** Something that would be affected if another went down (or that it needs): `distance` 1 is directly, 2 through one other, and so on. */
export interface DependencyImpactItem {
@@ -1963,9 +1964,11 @@ export interface DependencyImpactItem {
distance: number;
silenced: boolean;
}
export type DependentImpactItem = DependencyImpactItem & { type: Exclude<DependencyNodeType, "internet"> };
export interface DependencyImpact {
target: { key: string; type: DependencyNodeType; id: number; name: string };
dependents: DependencyImpactItem[];
/** Never the internet, which is only ever needed. */
dependents: DependentImpactItem[];
needs: DependencyImpactItem[];
}
export interface DependencyGraphNode {
+2 -2
View File
@@ -13,7 +13,7 @@ const COL_GAP = 120;
const STATUS_SYMBOL: Record<DependencyGraphNode["status"], string> = { ok: "✓", bad: "✕", warn: "▲", unknown: "·" };
const STATUS_WORD: Record<DependencyGraphNode["status"], string> = { ok: "working", bad: "problem", warn: "check", unknown: "no status" };
const KIND_LABEL: Record<DependencyGraphNode["type"], string> = { server: "Server", integration: "Integration", device: "Network device" };
const KIND_LABEL: Record<DependencyGraphNode["type"], string> = { server: "Server", integration: "Integration", device: "Network device", internet: "Internet" };
interface Placed extends DependencyGraphNode {
x: number;
@@ -151,7 +151,7 @@ export default function DependencyMap() {
<button
key={n.key}
type="button"
className={`map-node map-node-${n.type === "server" ? "server" : n.type === "device" ? "device" : "monitor"} ${state(n.key)}`}
className={`map-node map-node-${n.type === "server" ? "server" : n.type === "device" ? "device" : n.type === "internet" ? "internet" : "monitor"} ${state(n.key)}`}
style={{ left: n.x, top: n.y, width: NODE_W, height: NODE_H, textAlign: "left" }}
aria-pressed={selected === n.key}
aria-label={`${KIND_LABEL[n.type]}: ${n.name}, ${STATUS_WORD[n.status]}. Show what depends on it.`}
+4 -4
View File
@@ -1,6 +1,6 @@
import { useEffect, useState } from "react";
import { Link } from "react-router-dom";
import { api, type DependencyImpactItem } from "../api/client";
import { api, type DependentImpactItem } from "../api/client";
export interface ImpactTarget {
type: string;
@@ -19,10 +19,10 @@ export default function ImpactNote({
}: {
targets: ImpactTarget[];
silence?: { value: boolean; onChange: (on: boolean) => void };
onAdd?: (items: DependencyImpactItem[]) => void;
onAdd?: (items: DependentImpactItem[]) => void;
verb?: string;
}) {
const [items, setItems] = useState<DependencyImpactItem[] | null>(null);
const [items, setItems] = useState<DependentImpactItem[] | null>(null);
const keyOf = targets.map((t) => `${t.type}:${t.id}`).sort().join(",");
useEffect(() => {
@@ -37,7 +37,7 @@ export default function ImpactNote({
.then((all) => {
if (!alive) return;
const selected = new Set(own.map((t) => `${t.type}:${t.id}`));
const seen = new Map<string, DependencyImpactItem>();
const seen = new Map<string, DependentImpactItem>();
for (const impact of all) for (const d of impact?.dependents ?? []) if (!selected.has(d.key) && !seen.has(d.key)) seen.set(d.key, d);
setItems([...seen.values()].sort((a, b) => a.distance - b.distance || a.name.localeCompare(b.name)));
})
+4
View File
@@ -1056,6 +1056,10 @@ a.map-node:focus-visible {
border-left-color: #48bb78;
}
.map-node-internet {
border-left-color: #ed64a6;
}
/* The one chart (components/TimeChart.tsx). */
.time-chart {
position: relative;
+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>
)}