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:
@@ -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,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user