feat(editor): F4.5a the device sheet for PCs, notebooks, switches and modems

Measured first: the new oracle SheetRun types 77 texts into FILIUS' own
settings panels and records what was marked red, what the device took and
what the field showed afterwards. Java's two judgements disagree (red text
taken, black text refused, any int as a modem port, a refused text dropped
without a word); here one rule decides both (packages/doc fields.ts), a
refused text stays marked in the field, and only what Java's model accepts
reaches the document.

- doc: settings.ts (name, label policy, addresses, IP forwarding, DHCP
  stopping the own DHCP server, LAN/WLAN with the wireless connection,
  switch SSID dropping its wireless hosts, retention time, cloud, modem
  port as its pair), sheet.ts (what the sheet shows)
- fls: modemPair/modemPort in one place
- editor: DeviceSheet beside the surface or below it on a phone, opened
  with the selection; every change one undo step
- not adopted from Java: the name overwritten by the MAC address, the
  access point search depending on unrelated devices

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-03 11:22:28 +00:00
co-authored by Claude Opus 5.5
parent 806df6baca
commit 9b7ec2fc72
25 changed files with 2667 additions and 73 deletions
+1 -10
View File
@@ -118,7 +118,7 @@ import {
} from '@mdg-filius/core';
import { writeFlsArchive } from './archive.js';
import { EMAIL_CLIENT_FILE, EMAIL_SERVER_FILE, type JavaAddressEntry, type JavaContact, type JavaEmail } from './javaEmail.js';
import { PROGRAM_OF_CLASS } from './importProject.js';
import { modemPort, PROGRAM_OF_CLASS } from './importProject.js';
import type { FlsApplicationClass, FlsDhcpServer, FlsFileTree, FlsFirewall, FlsOwnApplication } from './systemSoftware.js';
import type { FlsDocumentationItem, FlsInterface, FlsLink, FlsNodeClass } from './topology.js';
import { writeTopologyXml, type ApplicationToWrite, type NodeToWrite, type SystemToWrite, type TopologyToWrite } from './topologyWriter.js';
@@ -245,15 +245,6 @@ function firstOfEachPair(nodes: readonly TopologyNode[], project: ProjectToExpor
return serving;
}
const JAVA_MODEM_PAIR = /^java-modem-port-([0-9]{1,5})$/;
const DEFAULT_MODEM_PORT = 12_345;
function modemPort(pairIdentifier: string | undefined): number {
const match = JAVA_MODEM_PAIR.exec(pairIdentifier ?? '');
const port = match === null ? DEFAULT_MODEM_PORT : Number(match[1]);
return port >= 1 && port <= 65_535 ? port : DEFAULT_MODEM_PORT;
}
type Warn = (message: string) => void;
function exportSystem(node: TopologyNode, project: ProjectToExport, servingModems: ReadonlySet<Id>, warn: Warn): SystemToWrite {
+19 -4
View File
@@ -274,6 +274,21 @@ export function openProjectArchive(archive: Uint8Array, newId: () => Id): Import
return importProject(readTopology(decodeJavaBeans(contents.configurationXml)), newId, contents.supplementalEntries);
}
const JAVA_MODEM_PAIR = /^java-modem-port-([0-9]{1,5})$/;
export const DEFAULT_MODEM_PORT = 12_345;
/** The pair of Java's modems on a port: two modems on one port belong together. */
export function modemPair(port: number): string {
return `java-modem-port-${port}`;
}
/** The port a modem pair's identifier names, 12345 when it names none. */
export function modemPort(pairIdentifier: string | undefined): number {
const match = JAVA_MODEM_PAIR.exec(pairIdentifier ?? '');
const port = match === null ? DEFAULT_MODEM_PORT : Number(match[1]);
return port >= 1 && port <= 65_535 ? port : DEFAULT_MODEM_PORT;
}
function hostLabelPolicy(node: FlsNode): HostLabelPolicy {
if (node.useIpAsName && node.useMacAsName) return 'ipAndMAC';
if (node.useIpAsName) return 'ipAddress';
@@ -568,17 +583,17 @@ function registerServiceConfigurations(
}
if (node.kind === 'remoteLink') {
const modem = source.system.modem;
let port = modem?.port ?? 12_345;
let port = modem?.port ?? DEFAULT_MODEM_PORT;
if (port < 1 || port > 65_535) {
warnings.push(`${where}: modem port ${port} is invalid, used 12345`);
port = 12_345;
warnings.push(`${where}: modem port ${port} is invalid, used ${DEFAULT_MODEM_PORT}`);
port = DEFAULT_MODEM_PORT;
}
if (modem !== undefined && modem.mode !== 1 && modem.mode !== 2) {
warnings.push(`${where}: modem mode ${modem.mode} unknown, treated as client`);
}
// Java pairs a server and a client modem over TCP on this port.
system.remoteLinkConfigurations.set(node.id, {
pairIdentifier: `java-modem-port-${port}`,
pairIdentifier: modemPair(port),
latencyMilliseconds: DEFAULT_REMOTE_LINK_LATENCY_MILLISECONDS,
isEnabled: true,
});