Name ports after the Docker containers that publish them
The health pass keeps the host ports Dockhand says running containers
publish (new table server_container_ports, migration 0080), matched to a
server by its Docker host's name. They name the port on the server's Ports
card and the network Ports table, ahead of a port preset and behind a
label somebody wrote, and in the new-port alert ("8096/tcp jellyfin
(container)"). Never written onto port notes, so a container's port is
still a new port; an unreadable host keeps its names, a day-old name is
dropped. Dockhand is now read on the health pass even with container
alerts off.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
75f060049f
commit
9ca83994fb
18 files changed
+9026
-29
No files matched your search
@@ -398,6 +398,13 @@ export interface AgentPortRow {
|
||||
lastSeenAt: string | null;
|
||||
/** What a port preset calls this port (22 → SSH); null when no preset has it. */
|
||||
service: string | null;
|
||||
/** The Docker container that publishes it, as Dockhand says; null when none does. */
|
||||
container: PortContainer | null;
|
||||
}
|
||||
|
||||
export interface PortContainer {
|
||||
container: string;
|
||||
image: string;
|
||||
}
|
||||
|
||||
export interface AgentPortsResponse {
|
||||
@@ -2603,6 +2610,8 @@ export interface PortEntry {
|
||||
isNew: boolean;
|
||||
/** What a port preset calls this port (3389 → RDP); null when no preset has it. */
|
||||
service: string | null;
|
||||
/** The Docker container that publishes it, as Dockhand says; null when none does. */
|
||||
container: PortContainer | null;
|
||||
}
|
||||
|
||||
export interface PresetPort {
|
||||
|
||||
@@ -8,6 +8,7 @@ import { readableError } from "../utils/errors";
|
||||
import Pagination from "./Pagination";
|
||||
import SortableTh from "./SortableTh";
|
||||
import { confirmDialog } from "../utils/dialogs";
|
||||
import { portName } from "../utils/portName";
|
||||
import { ErrorNotice } from "./Notice";
|
||||
|
||||
const PRESETS: { key: string; label: string; from: number; to: number }[] = [
|
||||
@@ -106,7 +107,7 @@ export default function ServerPorts({
|
||||
const q = filter.trim().toLowerCase();
|
||||
const rows = q
|
||||
? data.ports.filter((p) =>
|
||||
[String(p.port), p.protocol, p.label, p.service, p.comment, p.agent?.process].some((v) => v?.toLowerCase().includes(q)),
|
||||
[String(p.port), p.protocol, p.label, p.container?.container, p.service, p.comment, p.agent?.process].some((v) => v?.toLowerCase().includes(q)),
|
||||
)
|
||||
: data.ports;
|
||||
return sortItems(rows, sortKey, sortDir);
|
||||
@@ -221,7 +222,7 @@ export default function ServerPorts({
|
||||
downloadCsv(
|
||||
"ports.csv",
|
||||
["Port", "Protocol", "Status", "Service", "Process", "Comment"],
|
||||
visible.map((p) => [p.port, p.protocol, p.state, p.label ?? p.service ?? "", p.agent?.process ?? "", p.comment ?? ""]),
|
||||
visible.map((p) => [p.port, p.protocol, p.state, p.label ?? portName(p)?.text ?? "", p.agent?.process ?? "", p.comment ?? ""]),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -491,7 +492,7 @@ export default function ServerPorts({
|
||||
<StatusBadges entry={p} />
|
||||
</td>
|
||||
<td>
|
||||
{p.label ?? (p.service ? <span className="text-secondary" title="Named by a port preset (Network → Ports → Presets)">{p.service}</span> : <span className="text-secondary">—</span>)}
|
||||
{p.label ?? (portName(p) ? <span className="text-secondary" title={portName(p)!.title}>{portName(p)!.text}</span> : <span className="text-secondary">—</span>)}
|
||||
{p.agent?.process && <div className="text-secondary small">{p.agent.process}</div>}
|
||||
</td>
|
||||
<td className="text-secondary">{p.comment ?? "—"}</td>
|
||||
|
||||
@@ -19,6 +19,7 @@ import { formatAgo } from "../utils/duration";
|
||||
import { ErrorNotice } from "../components/Notice";
|
||||
import PortPresets from "../components/PortPresets";
|
||||
import ViewTabs from "../components/ViewTabs";
|
||||
import { portName } from "../utils/portName";
|
||||
import { EmptyRow, LoadingRow } from "../components/EmptyState";
|
||||
|
||||
const emptyForm: PortForwardInput = {
|
||||
@@ -100,7 +101,7 @@ export default function Ports({ user }: { user: CurrentUser }) {
|
||||
p.serverHostname ?? "",
|
||||
p.protocol,
|
||||
p.port,
|
||||
p.service ?? "",
|
||||
portName(p)?.text ?? "",
|
||||
p.addresses.join(", "),
|
||||
p.process ?? "",
|
||||
p.localOnly ? "yes" : "no",
|
||||
@@ -241,7 +242,7 @@ export default function Ports({ user }: { user: CurrentUser }) {
|
||||
</td>
|
||||
<td className="text-uppercase text-secondary">{p.protocol}</td>
|
||||
<td>{p.port}</td>
|
||||
<td className="text-secondary" title={p.service ? "Named by a port preset" : undefined}>{p.service ?? "—"}</td>
|
||||
<td className="text-secondary" title={portName(p)?.title}>{portName(p)?.text ?? "—"}</td>
|
||||
<td className="text-secondary">
|
||||
{p.addresses.join(", ")}
|
||||
{p.localOnly && <span className="badge bg-secondary-lt text-secondary ms-2">local only</span>}
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
// What to call a port when nobody has labelled it: the Docker container that publishes it (as Dockhand says), else what a port preset calls it. A label somebody wrote is shown before either.
|
||||
import type { PortContainer } from "../api/client";
|
||||
|
||||
export interface PortName {
|
||||
text: string;
|
||||
/** Where the name comes from, for the hover text. */
|
||||
title: string;
|
||||
}
|
||||
|
||||
export function portName(p: { container: PortContainer | null; service: string | null }): PortName | null {
|
||||
if (p.container) return { text: p.container.container, title: `Published by the container ${p.container.container}${p.container.image ? ` (${p.container.image})` : ""}, as Dockhand reports it` };
|
||||
if (p.service) return { text: p.service, title: "Named by a port preset (Network → Ports → Presets)" };
|
||||
return null;
|
||||
}
|
||||
Reference in new issue
Block a user