Merge remote-tracking branch 'origin/main' into claude/latency-contracts

# Conflicts:
#	CHANGELOG.md
This commit is contained in:
Frederic Jung 2026-11-10 09:33:49 +00:00
commit 12ce66b33a
No known key found for this signature in database
36 changed files with 881 additions and 23 deletions

View file

@ -7,7 +7,15 @@ All notable changes to this project are documented here. The project follows
## [Unreleased]
- From customer level 7, low-latency wholesale routes call: 1.6 or 3.2 Tbps between two of your cities with a strict latency limit, paying about three times what a hyperscaler pays per Gbps on the same route. Every day over the limit (after the first 15) you pay back a day's fee as an SLA credit and they lose patience twice as fast as a trading link over its limit, so keep a fast path and a fast backup. They never grow past 3.2 Tbps, so one contract cannot carry a whole level (#137).
- From customer level 2, you can save up to three POP standards (micro POP, medium POP, regional hub), each a router model and a number of routers, and mark which POP is which. One button in a POP's Infra tab brings it up to its standard, and Utilities brings every POP of a kind up at once with the price shown first. A POP is never stepped down to a smaller model, and a busy POP with one router gets its second router before the swap, so the upgrade rolls instead of taking the POP down (#315).
- Utilities can now install the redundancy kit at every POP still missing part of it in one go, at one price shown on the button, from customer level 2. With a NOC intern you can also put the kit in the intern's new-POP template from there (#317).
- A customer asking for a backup generator, a second router or a second site at POPs you already have now shows what is missing and what it costs, with a button that buys exactly that and signs the deal. Nothing is bought unless you press it (#241).
- The NOC intern's "Light more fiber" order can now leave new fiber dark, so a fiber handed over in the night no longer pulls in traffic before you are ready for it. Fiber you light yourself still gets more optics when it runs hot (#316).
- The Transit and Peering tabs of a POP have a search box for a network's name or AS number and a "Connected only" switch, so you can find the one network you need in a long list, on phones too (#199).
- Decommissioning one of several links between the same two cities keeps the link panel open on the next one, so you can hand back a row of waves without reopening it each time (#119).
- A link that a closed border has taken down, like Doha to Dubai or Abu Dhabi while the neighbours have fallen out, now says so in its panel, with the days until it comes back, instead of showing nothing wrong. Leasing a new wave or fiber pair across that border during the spat warns you first that it will stay dark (#329).
- A customer asking for a discount at renewal now shows how much traffic they book and get, the price per Gbps now and asked, and any latency limit or path terms they signed for, each ticked or crossed as your network stands today (#292).
- The two city names at the top of a wave, dark fiber or virtual circuit panel now open that city, for example to upgrade the router there before a bigger link (#196).
## [3.3.0] — 2026-11-09

View file

@ -56,7 +56,9 @@
const screen = (w) => {
if (w.where === 'modal') return btns($('modal'));
if (w.where === 'city') { UI.sel = { type: 'city', id: w.city }; UI.tab = w.tab; renderAll(); return btns($('panel')); }
if (w.where === 'link') { if (!S.links.some((l) => l.id === w.id)) return []; UI.sel = { type: 'link', id: w.id }; renderAll(); return btns($('panel')); }
// The city names in a link panel's header open the city (#196); older pages have plain text there. They only change
// the view, so neither page offers them, and both stay in lockstep.
if (w.where === 'link') { if (!S.links.some((l) => l.id === w.id)) return []; UI.sel = { type: 'link', id: w.id }; renderAll(); const P = $('panel'); for (const h of P.querySelectorAll('.ph h2 [data-act]')) h.removeAttribute('data-act'); return btns(P); }
if (w.where === 'dash') { $('dash').hidden = false; UI.dtab = w.tab; renderDash(); const b = btns($('dash')); return b; }
if (w.where === 'left') {
UI.left = w.tab; UI.leftOpen = true; renderLeft(); let b = btns($('leftBody'));

View file

@ -2742,6 +2742,12 @@
"lifecycle.odd_wireguard":"Sie gehen komplett remote. Alle 40 Leute fahren WireGuard aus ihren Küchen, und die Büroleitung ist nur noch für die Pflanzen.",
"lifecycle.odd_wrong_blue":"Die neue Büroleitung will alle Kabel in derselben Farbe, und deins ist das falsche Blau.",
"lifecycle.referred_by":"Empfohlen von {name}, einem deiner zufriedensten Kunden.",
"lifecycle.ren_diverse":"zwei getrennte Pfade",
"lifecycle.ren_lat":"Latenz bis {max} ms (jetzt {now})",
"lifecycle.ren_no_subsea":"kein Seekabel",
"lifecycle.ren_per_g":"{was} → {price} pro Gbps",
"lifecycle.ren_sites_traffic":{"one":"{n} Standort × {bw} gebucht, {srv} geliefert","other":"{n} Standorte × {bw} gebucht, {srv} geliefert"},
"lifecycle.ren_traffic":"{bw} gebucht, {srv} geliefert",
"lifecycle.renewal_haggle":"Verlängerung am {date}: wird verhandelt",
"lifecycle.renewals":"Verlängerungen",
"lifecycle.renewals_soon":"Verlängerungen",
@ -3165,6 +3171,9 @@
"modal_and_names.the_real_thing_follow_a_packet":"Das Original: Folge einem Paket vom WLAN bis zur Unterseeglasfaser.",
"modals.lay_your_own_subsea_cable":"Eigenes Seekabel verlegen…",
"modals.your_own_subsea_cable_level_n":"Eigenes Seekabel <small>Level {n} oder Tier 1</small>",
"net_filter.clear":"Zurücksetzen",
"net_filter.connected_only":"Nur verbundene",
"net_filter.find_a_network":"Netzwerk oder AS-Nummer suchen",
"networks.a_mobile_network_named_after_the":"Ein Mobilfunknetz, benannt nach dem Klang anstoßender Gläser. Prost auf jeden 5G-Mast.",
"networks.a_spanish_carrier_starring_in_every":"Ein spanischer Carrier mit Hauptrolle in jedem lateinamerikanischen Markt, zumindest bis er den nächsten verkauft.",
"networks.a_tiny_telco_in_a_country":"Eine winzige Telco in einem Land, in dem die Kabel der Welt an Land gehen. Die Preise passen dazu.",
@ -3400,6 +3409,7 @@
"ops.ops":"Ops",
"ops.ops_name":"Ops · {name}",
"ops.p_at":"Ab",
"ops.p_fresh":"Neue Glasfaser anknipsen",
"ops.p_g":"Ab",
"ops.p_how":"Wie",
"ops.p_keep":"Einen in Reserve",
@ -3931,6 +3941,29 @@
"pop_std.none":"Keiner",
"pop_std.not_all_of_the_standard":"Nicht genug Geld oder Level für den ganzen Standard in {city}: Er bekam, was passte.",
"pop_std.standard_for_new_pops":"Standard für neue POPs",
"pop_tiers.apply_cost":"Auf Standard bringen <small>{cost}</small>",
"pop_tiers.bring_up_n":{"one":"{n} POP hochbringen <small>{cost}</small>","other":"{n} POPs hochbringen <small>{cost}</small>"},
"pop_tiers.bulk_done":{"one":"{kind}: {n} POP auf den Standard gebracht.","other":"{kind}: {n} POPs auf den Standard gebracht."},
"pop_tiers.bulk_note":"Jeder POP, den du als eine Art markiert hast, in einem Rutsch auf ihren Standard gebracht. Ändere einen Standard (neues Modell, mehr Router) und drück nochmal.",
"pop_tiers.city_is_kind":"{city} erfüllt den Standard {kind}.",
"pop_tiers.hub":"Regionaler Hub",
"pop_tiers.mark":"Markieren",
"pop_tiers.medium":"Mittlerer POP",
"pop_tiers.meets_it":"Erfüllt",
"pop_tiers.micro":"Mikro-POP",
"pop_tiers.model_locked":"{model} gibt es ab Kundenlevel {lv}.",
"pop_tiers.n_below":{"one":"{n} unter dem Standard","other":"{n} unter dem Standard"},
"pop_tiers.n_pops":{"one":"{n} POP","other":"{n} POPs"},
"pop_tiers.n_stuck":{"one":"{n} geht noch nicht","other":"{n} gehen noch nicht"},
"pop_tiers.no_kind":"Noch keine Art",
"pop_tiers.not_all":"In {city} ging nicht der ganze Standard rein. Schau in den Infra-Tab.",
"pop_tiers.not_set":"noch nicht festgelegt",
"pop_tiers.note":"Speichere die Router eines POPs als Standard und markiere dann andere POPs als diese Art. Auf Standard bringen fügt Router hinzu und tauscht auf das größere Modell, nie einen Schritt zurück. Unter Werkzeuge bringst du alle POPs einer Art auf einmal hoch.",
"pop_tiers.save_here":"Diese Router speichern",
"pop_tiers.saved":"{kind} ist jetzt {desc}.",
"pop_tiers.swapped_today":"Die Router hier wurden heute getauscht. Versuch es morgen wieder.",
"pop_tiers.this_pop_is":"Dieser POP: {kind}",
"pop_tiers.title":"POP-Standards",
"pops_transit_ix.40_off_for_6_months":"40 % Rabatt für 6 Monate",
"pops_transit_ix.40_off_ix_for_6_months":"<b>40 % Rabatt auf {ix} für 6 Monate.</b><br>Dein Account Manager ist erleichtert. Das Kleingedruckte liest du später.",
"pops_transit_ix.after_consulting_with_management_the":"<b>„Nach Rücksprache mit dem Management …“</b><br>Der Preis ist gestiegen. Das Management wurde konsultiert.",
@ -4198,6 +4231,12 @@
"release_notes.read_the_full_notes_on_github":"Alle Hinweise auf GitHub lesen",
"release_notes.series_of_tubes_v_is_out":"Series of Tubes {v} ist da!",
"release_notes.your_game_is_saved_automatically":"Dein Spiel wird automatisch gespeichert.",
"req_fix.bought":"Gekauft: {list} für {cost}.",
"req_fix.buy_and_sign":"Kaufen und unterschreiben <small>{cost}</small>",
"req_fix.buys_list":"Es fehlt: {list}. {cost} + {mo}/Monat.",
"req_fix.generator_in_city":"ein Notstromaggregat in {city}",
"req_fix.second_router_in_city":"ein zweiter Router in {city}",
"req_fix.second_site_in_city":"ein zweiter Standort in {city}",
"requirements.a_spare_fiber_pair_in_your":"ein freies Faserpaar in deinem Graben {a}–{b}",
"requirements.afraid_of_sharks_needs_a_path":"Angst vor Haien: braucht einen Pfad ohne Seekabel",
"requirements.backup_generator_in_every_city_they":"Notstromgenerator in jeder Stadt, in der sie vertreten sind",
@ -4832,9 +4871,20 @@
"utilities.caches_requested":"{n} Cache-Boxen in {city} installiert.",
"utilities.ix_peering":"IX-Peering im ganzen Netz",
"utilities.join_route_servers":"Allen Route Servern beitreten ({n})",
"utilities.kit_all_applied":{"one":"Redundanz-Kit in {n} POP eingebaut.","other":"Redundanz-Kit in {n} POPs eingebaut."},
"utilities.kit_all_apply":{"one":"Kit in {n} POP <small>{cost}</small>","other":"Kit in alle {n} POPs <small>{cost}</small>"},
"utilities.kit_all_done":"Jeder POP hat das komplette Kit.",
"utilities.kit_all_quote":{"one":"{n} POP braucht es · {cost} + {mo}/Monat","other":"{n} POPs brauchen es · {cost} + {mo}/Monat"},
"utilities.kit_applied":"Redundanz in {city} aktualisiert.",
"utilities.kit_balanced":"Hardware installiert und Caches ausgeglichen.",
"utilities.kit_cost":"Einmalig: {cost} · Zusätzliche Kosten pro Monat: {mo}",
"utilities.kit_everywhere":"Redundanz-Kit überall",
"utilities.kit_everywhere_note":"Das Kit in jedem POP, dem noch ein Teil davon fehlt: Notstrom, zweites Gebäude, zweiter Router, Caches auf beide Standorte verteilt. Ein Preis für alle.",
"utilities.kit_new_pops_hire":"Stell einen NOC-Praktikanten ein, dann eröffnest du neue POPs aus einer Vorlage, das Kit schon drin.",
"utilities.kit_new_pops_off":"Neue POPs aus der Vorlage von {name} kommen ohne das Kit.",
"utilities.kit_new_pops_on":"Neue POPs aus der Vorlage von {name} bekommen das Kit gleich mit.",
"utilities.kit_new_pops_start":"Kit in die Vorlage",
"utilities.kit_new_pops_stop":"Kit aus der Vorlage nehmen",
"utilities.peer_counts":"{ready} möglich · {existing} bestehend · {blocked} nicht verfügbar",
"utilities.peering_note":"Fordert an jedem IX, an dem du bist, alle möglichen Peers an. Bestehende Sessions, auch über Route Server, werden übersprungen. Absagen und Traffic-Schwellen gelten weiter. Es werden keine Ports oder bezahlten PNIs gekauft.",
"utilities.peers_requested":"{n} neue IX-Peering-Sessions aufgebaut.",

View file

@ -2740,6 +2740,12 @@
"lifecycle.odd_wireguard":"Se pasan al teletrabajo total. Los 40 empleados usarán WireGuard desde sus cocinas, y la línea de la oficina es solo para las plantas.",
"lifecycle.odd_wrong_blue":"La nueva responsable de oficina quiere todos los cables del mismo color, y el tuyo es del azul equivocado.",
"lifecycle.referred_by":"Recomendado por {name}, uno de tus clientes más contentos.",
"lifecycle.ren_diverse":"dos rutas diversas",
"lifecycle.ren_lat":"latencia de hasta {max} ms (ahora {now})",
"lifecycle.ren_no_subsea":"sin cable submarino",
"lifecycle.ren_per_g":"{was} → {price} por Gbps",
"lifecycle.ren_sites_traffic":{"one":"{n} sede × {bw} contratados, {srv} servidos","other":"{n} sedes × {bw} contratados, {srv} servidos"},
"lifecycle.ren_traffic":"{bw} contratados, {srv} servidos",
"lifecycle.renewal_haggle":"renovación el {date}: negociando",
"lifecycle.renewals":"Renovaciones",
"lifecycle.renewals_soon":"Renovaciones",
@ -3163,6 +3169,9 @@
"modal_and_names.the_real_thing_follow_a_packet":"Lo de verdad: sigue un paquete del Wi-Fi a la fibra submarina.",
"modals.lay_your_own_subsea_cable":"Tender tu propio cable submarino…",
"modals.your_own_subsea_cable_level_n":"Tu propio cable submarino <small>nivel {n} o Tier 1</small>",
"net_filter.clear":"Borrar",
"net_filter.connected_only":"Solo conectadas",
"net_filter.find_a_network":"Buscar una red o número de AS",
"networks.a_mobile_network_named_after_the":"Una red móvil con el nombre del sonido de un brindis. Salud por cada torre 5G.",
"networks.a_spanish_carrier_starring_in_every":"Un operador español protagonista en todos los mercados latinoamericanos, al menos hasta que vende el siguiente.",
"networks.a_tiny_telco_in_a_country":"Una telco diminuta en un país donde llegan a tierra los cables del mundo. Precios a juego.",
@ -3398,6 +3407,7 @@
"ops.ops":"Ops",
"ops.ops_name":"Ops · {name}",
"ops.p_at":"Por encima de",
"ops.p_fresh":"Encender fibra nueva",
"ops.p_g":"Desde",
"ops.p_how":"Cómo",
"ops.p_keep":"Dejar uno de reserva",
@ -3929,6 +3939,29 @@
"pop_std.none":"Ninguno",
"pop_std.not_all_of_the_standard":"No hay dinero o nivel para todo el estándar en {city}: recibió lo que cupo.",
"pop_std.standard_for_new_pops":"Estándar para nuevos POP",
"pop_tiers.apply_cost":"Ponerlo al día <small>{cost}</small>",
"pop_tiers.bring_up_n":{"one":"Poner al día {n} POP <small>{cost}</small>","other":"Poner al día {n} POPs <small>{cost}</small>"},
"pop_tiers.bulk_done":{"one":"{kind}: {n} POP puesto al día.","other":"{kind}: {n} POPs puestos al día."},
"pop_tiers.bulk_note":"Cada POP que marcaste de un tipo, puesto al día con su estándar de una vez. Cambia un estándar (un modelo nuevo, más routers) y vuelve a pulsar.",
"pop_tiers.city_is_kind":"{city} cumple el estándar {kind}.",
"pop_tiers.hub":"Hub regional",
"pop_tiers.mark":"Marcarlo",
"pop_tiers.medium":"POP mediano",
"pop_tiers.meets_it":"Lo cumple",
"pop_tiers.micro":"Micro POP",
"pop_tiers.model_locked":"{model} se desbloquea en el nivel de clientes {lv}.",
"pop_tiers.n_below":{"one":"{n} por debajo del estándar","other":"{n} por debajo del estándar"},
"pop_tiers.n_pops":{"one":"{n} POP","other":"{n} POPs"},
"pop_tiers.n_stuck":{"one":"{n} todavía no puede","other":"{n} todavía no pueden"},
"pop_tiers.no_kind":"Sin tipo aún",
"pop_tiers.not_all":"En {city} no entró todo el estándar. Revisa la pestaña Infra.",
"pop_tiers.not_set":"sin definir",
"pop_tiers.note":"Guarda los routers de un POP como estándar y marca otros POPs de ese tipo. Ponerlo al día añade routers y cambia al modelo más grande, nunca un paso atrás. En Utilidades pones al día todos los POPs de un tipo a la vez.",
"pop_tiers.save_here":"Guardar estos routers",
"pop_tiers.saved":"{kind} ahora es {desc}.",
"pop_tiers.swapped_today":"Los routers de aquí se cambiaron hoy. Prueba mañana.",
"pop_tiers.this_pop_is":"Este POP: {kind}",
"pop_tiers.title":"Estándares de POP",
"pops_transit_ix.40_off_for_6_months":"40 % de descuento durante 6 meses",
"pops_transit_ix.40_off_ix_for_6_months":"<b>40 % de descuento en {ix} durante 6 meses.</b><br>Tu gestor de cuenta está aliviado. Lee la letra pequeña más tarde.",
"pops_transit_ix.after_consulting_with_management_the":"<b>«Tras consultar con la dirección…»</b><br>El precio subió. Se consultó a la dirección.",
@ -4196,6 +4229,12 @@
"release_notes.read_the_full_notes_on_github":"Lee las notas completas en GitHub",
"release_notes.series_of_tubes_v_is_out":"¡Ya salió Series of Tubes {v}!",
"release_notes.your_game_is_saved_automatically":"Tu partida se guarda automáticamente.",
"req_fix.bought":"Comprado: {list} por {cost}.",
"req_fix.buy_and_sign":"Comprar y firmar <small>{cost}</small>",
"req_fix.buys_list":"Falta: {list}. {cost} + {mo}/mes.",
"req_fix.generator_in_city":"un generador de respaldo en {city}",
"req_fix.second_router_in_city":"un segundo router en {city}",
"req_fix.second_site_in_city":"un segundo sitio en {city}",
"requirements.a_spare_fiber_pair_in_your":"un par de fibra libre en tu zanja {a}–{b}",
"requirements.afraid_of_sharks_needs_a_path":"Miedo a los tiburones: necesita una ruta sin cable submarino",
"requirements.backup_generator_in_every_city_they":"Generador de respaldo en cada ciudad que toquen",
@ -4830,9 +4869,20 @@
"utilities.caches_requested":"Se han instalado {n} cachés en {city}.",
"utilities.ix_peering":"Peering IX en toda la red",
"utilities.join_route_servers":"Unirse a todos los route servers ({n})",
"utilities.kit_all_applied":{"one":"Kit de redundancia instalado en {n} POP.","other":"Kit de redundancia instalado en {n} POPs."},
"utilities.kit_all_apply":{"one":"Kit en {n} POP <small>{cost}</small>","other":"Kit en los {n} POPs <small>{cost}</small>"},
"utilities.kit_all_done":"Todos los POPs tienen el kit completo.",
"utilities.kit_all_quote":{"one":"{n} POP lo necesita · {cost} + {mo}/mes","other":"{n} POPs lo necesitan · {cost} + {mo}/mes"},
"utilities.kit_applied":"Redundancia actualizada en {city}.",
"utilities.kit_balanced":"Hardware instalado y cachés equilibradas.",
"utilities.kit_cost":"Pago único: {cost} · Coste mensual adicional: {mo}",
"utilities.kit_everywhere":"Kit de redundancia en todas partes",
"utilities.kit_everywhere_note":"El kit en cada POP al que todavía le falta alguna parte: generador, segundo edificio, segundo router, cachés repartidas entre sitios. Un solo precio para todos.",
"utilities.kit_new_pops_hire":"Contrata a un becario del NOC para abrir POPs nuevos con una plantilla que ya incluye el kit.",
"utilities.kit_new_pops_off":"Los POPs nuevos abiertos con la plantilla de {name} llegan sin el kit.",
"utilities.kit_new_pops_on":"Los POPs nuevos abiertos con la plantilla de {name} también llevan el kit.",
"utilities.kit_new_pops_start":"Meter el kit en la plantilla",
"utilities.kit_new_pops_stop":"Sacarlo de la plantilla",
"utilities.peer_counts":"{ready} elegibles · {existing} existentes · {blocked} no disponibles",
"utilities.peering_note":"Solicita peers elegibles en cada IX al que te hayas unido. Se omiten las sesiones existentes, incluidos los peers del route server. Los rechazos y umbrales de tráfico siguen vigentes. No se compran puertos ni PNI de pago.",
"utilities.peers_requested":"Se han establecido {n} nuevas sesiones de peering IX.",

View file

@ -2740,6 +2740,12 @@
"lifecycle.odd_wireguard":"Ils passent en télétravail complet. Les 40 salariés utiliseront WireGuard depuis leur cuisine, et la ligne du bureau ne sert plus qu'aux plantes.",
"lifecycle.odd_wrong_blue":"La nouvelle responsable des locaux veut tous les câbles de la même couleur, et le vôtre n'est pas le bon bleu.",
"lifecycle.referred_by":"Recommandé par {name}, l'un de vos clients les plus satisfaits.",
"lifecycle.ren_diverse":"deux chemins diversifiés",
"lifecycle.ren_lat":"latence jusqu’à {max} ms (maintenant {now})",
"lifecycle.ren_no_subsea":"pas de câble sous-marin",
"lifecycle.ren_per_g":"{was} → {price} par Gbps",
"lifecycle.ren_sites_traffic":{"one":"{n} site × {bw} réservés, {srv} servis","other":"{n} sites × {bw} réservés, {srv} servis"},
"lifecycle.ren_traffic":"{bw} réservés, {srv} servis",
"lifecycle.renewal_haggle":"renouvellement le {date} : en négociation",
"lifecycle.renewals":"Renouvellements",
"lifecycle.renewals_soon":"Renouvellements",
@ -3163,6 +3169,9 @@
"modal_and_names.the_real_thing_follow_a_packet":"La version réelle : suis un paquet du Wi-Fi à la fibre sous-marine.",
"modals.lay_your_own_subsea_cable":"Pose ton propre câble sous-marin…",
"modals.your_own_subsea_cable_level_n":"Ton propre câble sous-marin <small>niveau {n} ou Tier 1</small>",
"net_filter.clear":"Effacer",
"net_filter.connected_only":"Connectés seulement",
"net_filter.find_a_network":"Chercher un réseau ou un numéro d'AS",
"networks.a_mobile_network_named_after_the":"Un réseau mobile qui porte le nom du bruit d’un toast. Tchin-tchin à chaque antenne 5G.",
"networks.a_spanish_carrier_starring_in_every":"Un opérateur espagnol en vedette sur chaque marché d’Amérique latine, au moins jusqu’à ce qu’il revende le suivant.",
"networks.a_tiny_telco_in_a_country":"Un tout petit opérateur dans un pays où les câbles du monde entier touchent terre. Tarifs à l’avenant.",
@ -3398,6 +3407,7 @@
"ops.ops":"Ops",
"ops.ops_name":"Ops · {name}",
"ops.p_at":"Au-delà de",
"ops.p_fresh":"Allumer la fibre neuve",
"ops.p_g":"À partir de",
"ops.p_how":"Comment",
"ops.p_keep":"En garder un de secours",
@ -3929,6 +3939,29 @@
"pop_std.none":"Aucun",
"pop_std.not_all_of_the_standard":"Pas assez d'argent ou de niveau pour tout le standard à {city} : il a reçu ce qui passait.",
"pop_std.standard_for_new_pops":"Standard des nouveaux POP",
"pop_tiers.apply_cost":"Le mettre à niveau <small>{cost}</small>",
"pop_tiers.bring_up_n":{"one":"Mettre {n} POP à niveau <small>{cost}</small>","other":"Mettre {n} POP à niveau <small>{cost}</small>"},
"pop_tiers.bulk_done":{"one":"{kind} : {n} POP mis à niveau.","other":"{kind} : {n} POP mis à niveau."},
"pop_tiers.bulk_note":"Chaque POP que tu as marqué d'un type, mis à niveau selon son standard d'un seul coup. Change un standard (nouveau modèle, plus de routeurs) et appuie à nouveau.",
"pop_tiers.city_is_kind":"{city} respecte le standard {kind}.",
"pop_tiers.hub":"Hub régional",
"pop_tiers.mark":"Le marquer",
"pop_tiers.medium":"POP moyen",
"pop_tiers.meets_it":"Conforme",
"pop_tiers.micro":"Micro-POP",
"pop_tiers.model_locked":"{model} se débloque au niveau clients {lv}.",
"pop_tiers.n_below":{"one":"{n} sous le standard","other":"{n} sous le standard"},
"pop_tiers.n_pops":{"one":"{n} POP","other":"{n} POP"},
"pop_tiers.n_stuck":{"one":"{n} ne peut pas encore","other":"{n} ne peuvent pas encore"},
"pop_tiers.no_kind":"Pas encore de type",
"pop_tiers.not_all":"Tout le standard n'a pas pu être installé à {city}. Regarde l'onglet Infra.",
"pop_tiers.not_set":"pas encore défini",
"pop_tiers.note":"Enregistre les routeurs d'un POP comme standard, puis marque d'autres POP de ce type. La mise à niveau ajoute des routeurs et passe au plus gros modèle, jamais un pas en arrière. Les Utilitaires mettent à niveau tous les POP d'un type d'un coup.",
"pop_tiers.save_here":"Enregistrer ces routeurs",
"pop_tiers.saved":"{kind} est maintenant {desc}.",
"pop_tiers.swapped_today":"Les routeurs ici ont été changés aujourd'hui. Réessaie demain.",
"pop_tiers.this_pop_is":"Ce POP : {kind}",
"pop_tiers.title":"Standards de POP",
"pops_transit_ix.40_off_for_6_months":"40 % de remise pendant 6 mois",
"pops_transit_ix.40_off_ix_for_6_months":"<b>40 % de remise sur {ix} pendant 6 mois.</b><br>Ton account manager est soulagé. Lis les petites lignes plus tard.",
"pops_transit_ix.after_consulting_with_management_the":"<b>« Après consultation de la direction… »</b><br>Le prix a augmenté. La direction a été consultée.",
@ -4196,6 +4229,12 @@
"release_notes.read_the_full_notes_on_github":"Lire les notes complètes sur GitHub",
"release_notes.series_of_tubes_v_is_out":"Series of Tubes {v} est sorti !",
"release_notes.your_game_is_saved_automatically":"Ta partie est sauvegardée automatiquement.",
"req_fix.bought":"Acheté : {list} pour {cost}.",
"req_fix.buy_and_sign":"Acheter et signer <small>{cost}</small>",
"req_fix.buys_list":"Il manque : {list}. {cost} + {mo}/mois.",
"req_fix.generator_in_city":"un groupe électrogène à {city}",
"req_fix.second_router_in_city":"un second routeur à {city}",
"req_fix.second_site_in_city":"un second site à {city}",
"requirements.a_spare_fiber_pair_in_your":"une paire de fibre libre dans ta tranchée {a}–{b}",
"requirements.afraid_of_sharks_needs_a_path":"A peur des requins : veut un chemin sans câble sous-marin",
"requirements.backup_generator_in_every_city_they":"Groupe électrogène dans chaque ville qu’il touche",
@ -4830,9 +4869,20 @@
"utilities.caches_requested":"{n} caches installés à {city}.",
"utilities.ix_peering":"Peering IX sur tout le réseau",
"utilities.join_route_servers":"Rejoindre tous les route servers ({n})",
"utilities.kit_all_applied":{"one":"Kit de redondance installé dans {n} POP.","other":"Kit de redondance installé dans {n} POP."},
"utilities.kit_all_apply":{"one":"Kit pour {n} POP <small>{cost}</small>","other":"Kit pour les {n} POP <small>{cost}</small>"},
"utilities.kit_all_done":"Chaque POP a le kit complet.",
"utilities.kit_all_quote":{"one":"{n} POP en a besoin · {cost} + {mo}/mois","other":"{n} POP en ont besoin · {cost} + {mo}/mois"},
"utilities.kit_applied":"Redondance mise à jour à {city}.",
"utilities.kit_balanced":"Matériel installé et caches équilibrés.",
"utilities.kit_cost":"Coût initial : {cost} · Coût mensuel supplémentaire : {mo}",
"utilities.kit_everywhere":"Kit de redondance partout",
"utilities.kit_everywhere_note":"Le kit dans chaque POP à qui il en manque une partie : groupe électrogène, second bâtiment, second routeur, caches répartis entre les sites. Un seul prix pour tous.",
"utilities.kit_new_pops_hire":"Embauche un stagiaire NOC pour ouvrir de nouveaux POP depuis un modèle, kit déjà compris.",
"utilities.kit_new_pops_off":"Les nouveaux POP ouverts avec le modèle de {name} arrivent sans le kit.",
"utilities.kit_new_pops_on":"Les nouveaux POP ouverts avec le modèle de {name} reçoivent aussi le kit.",
"utilities.kit_new_pops_start":"Mettre le kit dans le modèle",
"utilities.kit_new_pops_stop":"Le retirer du modèle",
"utilities.peer_counts":"{ready} éligibles · {existing} existants · {blocked} indisponibles",
"utilities.peering_note":"Demande les peers éligibles sur chaque IX rejoint. Les sessions existantes, y compris via le route server, sont ignorées. Les refus et seuils de trafic restent applicables. Aucun port ni PNI payant ne sera acheté.",
"utilities.peers_requested":"{n} nouvelles sessions de peering IX établies.",

View file

@ -2740,6 +2740,12 @@
"lifecycle.odd_wireguard":"Passano al lavoro tutto da remoto. I 40 dipendenti useranno WireGuard dalle loro cucine, e la linea dell'ufficio serve solo alle piante.",
"lifecycle.odd_wrong_blue":"Il nuovo responsabile dell'ufficio vuole tutti i cavi dello stesso colore, e il tuo è del blu sbagliato.",
"lifecycle.referred_by":"Consigliato da {name}, uno dei tuoi clienti più contenti.",
"lifecycle.ren_diverse":"due percorsi diversi",
"lifecycle.ren_lat":"latenza entro {max} ms (ora {now})",
"lifecycle.ren_no_subsea":"niente cavi sottomarini",
"lifecycle.ren_per_g":"{was} → {price} per Gbps",
"lifecycle.ren_sites_traffic":{"one":"{n} sede × {bw} prenotati, {srv} serviti","other":"{n} sedi × {bw} prenotati, {srv} serviti"},
"lifecycle.ren_traffic":"{bw} prenotati, {srv} serviti",
"lifecycle.renewal_haggle":"rinnovo il {date}: si tratta",
"lifecycle.renewals":"Rinnovi",
"lifecycle.renewals_soon":"Rinnovi",
@ -3163,6 +3169,9 @@
"modal_and_names.the_real_thing_follow_a_packet":"La versione vera: segui un pacchetto dal Wi-Fi alla fibra sottomarina.",
"modals.lay_your_own_subsea_cable":"Posa il tuo cavo sottomarino…",
"modals.your_own_subsea_cable_level_n":"Il tuo cavo sottomarino <small>livello {n} o Tier 1</small>",
"net_filter.clear":"Cancella",
"net_filter.connected_only":"Solo collegate",
"net_filter.find_a_network":"Cerca una rete o un numero AS",
"networks.a_mobile_network_named_after_the":"Una rete mobile che porta il nome del suono di un brindisi. Cin cin a ogni antenna 5G.",
"networks.a_spanish_carrier_starring_in_every":"Un carrier spagnolo protagonista in ogni mercato latinoamericano, almeno finché non vende il prossimo.",
"networks.a_tiny_telco_in_a_country":"Una piccola telco in un paese dove approdano i cavi di mezzo mondo. Prezzi in proporzione.",
@ -3398,6 +3407,7 @@
"ops.ops":"Ops",
"ops.ops_name":"Ops · {name}",
"ops.p_at":"Oltre",
"ops.p_fresh":"Accendi la fibra nuova",
"ops.p_g":"Da",
"ops.p_how":"Come",
"ops.p_keep":"Tienine uno di scorta",
@ -3929,6 +3939,29 @@
"pop_std.none":"Nessuno",
"pop_std.not_all_of_the_standard":"Non bastano soldi o livello per tutto lo standard a {city}: ha avuto quello che si poteva.",
"pop_std.standard_for_new_pops":"Standard per i nuovi POP",
"pop_tiers.apply_cost":"Portalo allo standard <small>{cost}</small>",
"pop_tiers.bring_up_n":{"one":"Porta {n} POP allo standard <small>{cost}</small>","other":"Porta {n} POP allo standard <small>{cost}</small>"},
"pop_tiers.bulk_done":{"one":"{kind}: {n} POP portato allo standard.","other":"{kind}: {n} POP portati allo standard."},
"pop_tiers.bulk_note":"Ogni POP che hai segnato di un tipo, portato al suo standard in un colpo solo. Cambia uno standard (un modello nuovo, più router) e premi di nuovo.",
"pop_tiers.city_is_kind":"{city} rispetta lo standard {kind}.",
"pop_tiers.hub":"Hub regionale",
"pop_tiers.mark":"Segnalo",
"pop_tiers.medium":"POP medio",
"pop_tiers.meets_it":"In regola",
"pop_tiers.micro":"Micro POP",
"pop_tiers.model_locked":"{model} si sblocca al livello clienti {lv}.",
"pop_tiers.n_below":{"one":"{n} sotto lo standard","other":"{n} sotto lo standard"},
"pop_tiers.n_pops":{"one":"{n} POP","other":"{n} POP"},
"pop_tiers.n_stuck":{"one":"{n} non può ancora","other":"{n} non possono ancora"},
"pop_tiers.no_kind":"Nessun tipo ancora",
"pop_tiers.not_all":"A {city} non è entrato tutto lo standard. Controlla la scheda Infra.",
"pop_tiers.not_set":"non ancora definito",
"pop_tiers.note":"Salva i router di un POP come standard, poi segna altri POP di quel tipo. Portarlo allo standard aggiunge router e passa al modello più grande, mai un passo indietro. Da Utilità porti allo standard tutti i POP di un tipo in una volta.",
"pop_tiers.save_here":"Salva questi router",
"pop_tiers.saved":"{kind} ora è {desc}.",
"pop_tiers.swapped_today":"I router qui sono stati cambiati oggi. Riprova domani.",
"pop_tiers.this_pop_is":"Questo POP: {kind}",
"pop_tiers.title":"Standard dei POP",
"pops_transit_ix.40_off_for_6_months":"40% di sconto per 6 mesi",
"pops_transit_ix.40_off_ix_for_6_months":"<b>40% di sconto su {ix} per 6 mesi.</b><br>Il tuo account manager tira un sospiro di sollievo. Le clausole in piccolo leggile dopo.",
"pops_transit_ix.after_consulting_with_management_the":"<b>“Dopo un confronto con il management…”</b><br>Il prezzo è salito. Il management è stato consultato.",
@ -4196,6 +4229,12 @@
"release_notes.read_the_full_notes_on_github":"Leggi le note complete su GitHub",
"release_notes.series_of_tubes_v_is_out":"È uscito Series of Tubes {v}!",
"release_notes.your_game_is_saved_automatically":"La tua partita viene salvata automaticamente.",
"req_fix.bought":"Comprato: {list} per {cost}.",
"req_fix.buy_and_sign":"Compra e firma <small>{cost}</small>",
"req_fix.buys_list":"Manca: {list}. {cost} + {mo}/mese.",
"req_fix.generator_in_city":"un generatore di backup a {city}",
"req_fix.second_router_in_city":"un secondo router a {city}",
"req_fix.second_site_in_city":"un secondo sito a {city}",
"requirements.a_spare_fiber_pair_in_your":"una coppia di fibre libera nel tuo scavo {a}–{b}",
"requirements.afraid_of_sharks_needs_a_path":"Ha paura degli squali: vuole un percorso senza cavi sottomarini",
"requirements.backup_generator_in_every_city_they":"Generatore di backup in ogni città che tocca",
@ -4830,9 +4869,20 @@
"utilities.caches_requested":"Installate {n} cache a {city}.",
"utilities.ix_peering":"Peering IX su tutta la rete",
"utilities.join_route_servers":"Unisciti a tutti i route server ({n})",
"utilities.kit_all_applied":{"one":"Kit di ridondanza installato in {n} POP.","other":"Kit di ridondanza installato in {n} POP."},
"utilities.kit_all_apply":{"one":"Kit per {n} POP <small>{cost}</small>","other":"Kit per tutti i {n} POP <small>{cost}</small>"},
"utilities.kit_all_done":"Ogni POP ha il kit completo.",
"utilities.kit_all_quote":{"one":"{n} POP ne ha bisogno · {cost} + {mo}/mese","other":"{n} POP ne hanno bisogno · {cost} + {mo}/mese"},
"utilities.kit_applied":"Ridondanza aggiornata a {city}.",
"utilities.kit_balanced":"Hardware installato e cache bilanciate.",
"utilities.kit_cost":"Una tantum: {cost} · Costo mensile aggiuntivo: {mo}",
"utilities.kit_everywhere":"Kit di ridondanza ovunque",
"utilities.kit_everywhere_note":"Il kit in ogni POP a cui ne manca ancora un pezzo: generatore, secondo edificio, secondo router, cache divise tra i siti. Un solo prezzo per tutti.",
"utilities.kit_new_pops_hire":"Assumi uno stagista del NOC per aprire nuovi POP da un modello con il kit già dentro.",
"utilities.kit_new_pops_off":"I nuovi POP aperti dal modello di {name} arrivano senza kit.",
"utilities.kit_new_pops_on":"I nuovi POP aperti dal modello di {name} ricevono anche il kit.",
"utilities.kit_new_pops_start":"Metti il kit nel modello",
"utilities.kit_new_pops_stop":"Toglilo dal modello",
"utilities.peer_counts":"{ready} idonei · {existing} esistenti · {blocked} non disponibili",
"utilities.peering_note":"Richiedi i peer idonei in ogni IX a cui partecipi. Le sessioni esistenti, inclusi i peer del route server, vengono saltate. Rifiuti e soglie di traffico restano validi. Non vengono acquistate porte o PNI a pagamento.",
"utilities.peers_requested":"Stabilite {n} nuove sessioni di peering IX.",

View file

@ -2740,6 +2740,12 @@
"lifecycle.odd_wireguard":"Vão trabalhar 100% remoto. Os 40 funcionários vão usar WireGuard da cozinha, e a linha do escritório fica só para as plantas.",
"lifecycle.odd_wrong_blue":"A nova gerente do escritório quer todos os cabos da mesma cor, e o seu é do azul errado.",
"lifecycle.referred_by":"Indicado por {name}, um dos seus clientes mais felizes.",
"lifecycle.ren_diverse":"dois caminhos diversos",
"lifecycle.ren_lat":"latência de até {max} ms (agora {now})",
"lifecycle.ren_no_subsea":"sem cabo submarino",
"lifecycle.ren_per_g":"{was} → {price} por Gbps",
"lifecycle.ren_sites_traffic":{"one":"{n} unidade × {bw} contratados, {srv} entregues","other":"{n} unidades × {bw} contratados, {srv} entregues"},
"lifecycle.ren_traffic":"{bw} contratados, {srv} entregues",
"lifecycle.renewal_haggle":"renovação em {date}: negociando",
"lifecycle.renewals":"Renovações",
"lifecycle.renewals_soon":"Renovações",
@ -3163,6 +3169,9 @@
"modal_and_names.the_real_thing_follow_a_packet":"A coisa de verdade: siga um pacote do Wi-Fi até a fibra submarina.",
"modals.lay_your_own_subsea_cable":"Lançar seu próprio cabo submarino…",
"modals.your_own_subsea_cable_level_n":"Seu próprio cabo submarino <small>nível {n} ou Tier 1</small>",
"net_filter.clear":"Limpar",
"net_filter.connected_only":"Só ligadas",
"net_filter.find_a_network":"Procurar uma rede ou número AS",
"networks.a_mobile_network_named_after_the":"Uma rede móvel com nome de brinde. Tim-tim para cada torre 5G.",
"networks.a_spanish_carrier_starring_in_every":"Uma operadora espanhola estrelando em todo mercado latino-americano, pelo menos até vender o próximo.",
"networks.a_tiny_telco_in_a_country":"Uma operadora minúscula num país onde os cabos do mundo chegam à terra. Os preços acompanham.",
@ -3398,6 +3407,7 @@
"ops.ops":"Ops",
"ops.ops_name":"Ops · {name}",
"ops.p_at":"Acima de",
"ops.p_fresh":"Acender fibra nova",
"ops.p_g":"A partir de",
"ops.p_how":"Como",
"ops.p_keep":"Manter um de reserva",
@ -3929,6 +3939,29 @@
"pop_std.none":"Nenhum",
"pop_std.not_all_of_the_standard":"Sem dinheiro ou nível para todo o padrão em {city}: recebeu o que coube.",
"pop_std.standard_for_new_pops":"Padrão para novos POPs",
"pop_tiers.apply_cost":"Pôr no padrão <small>{cost}</small>",
"pop_tiers.bring_up_n":{"one":"Pôr {n} POP no padrão <small>{cost}</small>","other":"Pôr {n} POPs no padrão <small>{cost}</small>"},
"pop_tiers.bulk_done":{"one":"{kind}: {n} POP posto no padrão.","other":"{kind}: {n} POPs postos no padrão."},
"pop_tiers.bulk_note":"Cada POP que marcaste de um tipo, posto no seu padrão de uma só vez. Muda um padrão (um modelo novo, mais routers) e carrega outra vez.",
"pop_tiers.city_is_kind":"{city} cumpre o padrão {kind}.",
"pop_tiers.hub":"Hub regional",
"pop_tiers.mark":"Marcar",
"pop_tiers.medium":"POP médio",
"pop_tiers.meets_it":"Cumpre",
"pop_tiers.micro":"Micro POP",
"pop_tiers.model_locked":"{model} desbloqueia no nível de clientes {lv}.",
"pop_tiers.n_below":{"one":"{n} abaixo do padrão","other":"{n} abaixo do padrão"},
"pop_tiers.n_pops":{"one":"{n} POP","other":"{n} POPs"},
"pop_tiers.n_stuck":{"one":"{n} ainda não pode","other":"{n} ainda não podem"},
"pop_tiers.no_kind":"Ainda sem tipo",
"pop_tiers.not_all":"Nem todo o padrão entrou em {city}. Vê o separador Infra.",
"pop_tiers.not_set":"ainda não definido",
"pop_tiers.note":"Guarda os routers de um POP como padrão e depois marca outros POPs desse tipo. Pôr no padrão adiciona routers e troca para o modelo maior, nunca um passo atrás. Em Utilitários pões todos os POPs de um tipo no padrão de uma vez.",
"pop_tiers.save_here":"Guardar estes routers",
"pop_tiers.saved":"{kind} agora é {desc}.",
"pop_tiers.swapped_today":"Os routers aqui foram trocados hoje. Tenta amanhã.",
"pop_tiers.this_pop_is":"Este POP: {kind}",
"pop_tiers.title":"Padrões de POP",
"pops_transit_ix.40_off_for_6_months":"40% de desconto por 6 meses",
"pops_transit_ix.40_off_ix_for_6_months":"<b>40% de desconto no {ix} por 6 meses.</b><br>Seu account manager respirou aliviado. Leia as letras miúdas depois.",
"pops_transit_ix.after_consulting_with_management_the":"<b>“Depois de consultar a diretoria…”</b><br>O preço subiu. A diretoria foi consultada.",
@ -4196,6 +4229,12 @@
"release_notes.read_the_full_notes_on_github":"Leia as notas completas no GitHub",
"release_notes.series_of_tubes_v_is_out":"Saiu o Series of Tubes {v}!",
"release_notes.your_game_is_saved_automatically":"Seu jogo é salvo automaticamente.",
"req_fix.bought":"Comprado: {list} por {cost}.",
"req_fix.buy_and_sign":"Comprar e assinar <small>{cost}</small>",
"req_fix.buys_list":"Falta: {list}. {cost} + {mo}/mês.",
"req_fix.generator_in_city":"um gerador de backup em {city}",
"req_fix.second_router_in_city":"um segundo router em {city}",
"req_fix.second_site_in_city":"um segundo site em {city}",
"requirements.a_spare_fiber_pair_in_your":"um par de fibra livre na sua vala {a}–{b}",
"requirements.afraid_of_sharks_needs_a_path":"Tem medo de tubarão: quer um caminho sem cabo submarino",
"requirements.backup_generator_in_every_city_they":"Gerador de backup em toda cidade que tocar",
@ -4830,9 +4869,20 @@
"utilities.caches_requested":"Instaladas {n} caches em {city}.",
"utilities.ix_peering":"Peering IX em toda a rede",
"utilities.join_route_servers":"Aderir a todos os route servers ({n})",
"utilities.kit_all_applied":{"one":"Kit de redundância instalado em {n} POP.","other":"Kit de redundância instalado em {n} POPs."},
"utilities.kit_all_apply":{"one":"Kit em {n} POP <small>{cost}</small>","other":"Kit nos {n} POPs <small>{cost}</small>"},
"utilities.kit_all_done":"Todos os POPs têm o kit completo.",
"utilities.kit_all_quote":{"one":"{n} POP precisa · {cost} + {mo}/mês","other":"{n} POPs precisam · {cost} + {mo}/mês"},
"utilities.kit_applied":"Redundância atualizada em {city}.",
"utilities.kit_balanced":"Hardware instalado e caches equilibradas.",
"utilities.kit_cost":"Custo único: {cost} · Custo mensal adicional: {mo}",
"utilities.kit_everywhere":"Kit de redundância em todo lado",
"utilities.kit_everywhere_note":"O kit em cada POP a que ainda falta alguma parte: gerador, segundo prédio, segundo router, caches divididos entre sites. Um só preço para todos.",
"utilities.kit_new_pops_hire":"Contrata um estagiário do NOC para abrir POPs novos a partir de um modelo, já com o kit.",
"utilities.kit_new_pops_off":"POPs novos abertos com o modelo de {name} vêm sem o kit.",
"utilities.kit_new_pops_on":"POPs novos abertos com o modelo de {name} também levam o kit.",
"utilities.kit_new_pops_start":"Pôr o kit no modelo",
"utilities.kit_new_pops_stop":"Tirá-lo do modelo",
"utilities.peer_counts":"{ready} elegíveis · {existing} existentes · {blocked} indisponíveis",
"utilities.peering_note":"Solicita peers elegíveis em todos os IX a que aderiste. As sessões existentes, incluindo peers do route server, são ignoradas. Recusas e limites de tráfego continuam a aplicar-se. Não são compradas portas nem PNI pagos.",
"utilities.peers_requested":"Estabelecidas {n} novas sessões de peering IX.",

View file

@ -38,6 +38,8 @@ const API_DOMAINS={
opsKey:{table:'OPSK',kind:'key'},
opsPopKind:{kind:'enum',values:()=>OPS_POP.slice()},
opsTplKey:{kind:'enum',values:()=>OPS_TPL.slice()},
// The three POP standards (#315).
popTier:{kind:'enum',values:()=>POP_TIERS.slice()},
// The specialist's offers: a seat on a consortium cable, the charter, a vendor demo.
seatPairs:{kind:'enum',values:()=>SEAT_N.slice()},
callAmount:{kind:'enum',values:()=>CALL_AMTS.slice()},

View file

@ -239,6 +239,10 @@ const API_CMD={
/* ---------- customers ---------- */
accept:{args:[['id','entityId']],
doc:'Sign a pending offer. Rejected without a POP in every city it needs, without free channels for a wave sale, or after an event\'s start date. Extra waves for a carrier you already serve grow that contract.'},
acceptFix:{args:[['id','entityId'],['cost','integer',false]],watch:['pops','biz','offers'],
quote:a=>{const q=S?reqFix(S.offers.find(x=>x.id===a.id)):null;return q?{setup:q.cost,monthly:q.mo}:{setup:0};},
pass:a=>({id:a.id,cost:a.cost??((reqFix(S.offers.find(x=>x.id===a.id))||{}).cost)}),
doc:'Buy what an offer asks for at POPs you already have (backup generator, a second router, a second site), then sign it. Pass the quoted setup as cost; the game checks it still matches.'},
decline:{args:[['id','entityId']],
doc:'Throw an offer away.'},
salesHire:{args:[['id','salesPersona']],
@ -402,6 +406,22 @@ const API_CMD={
quote:a=>{const q=S?utilityKit(a.city):null;return q?{setup:q.cost,monthly:q.mo}:{};},
pass:a=>({city:a.city,cost:a.cost??((utilityKit(a.city)||{}).cost)}),
doc:'Install the POP redundancy kit in one go: generator, second building, a second router, and the cache boxes balanced between sites. Pass the quoted setup as cost; the game checks it still matches. Nothing to do reads as no_effect.'},
utilityKitAll:{args:[['cost','integer',false],['city','cityId',false]],watch:['pops','caches'],
quote:a=>{const q=S?utilityKitAll():null;return q?{setup:q.cost,monthly:q.mo}:{setup:0};},
pass:a=>({city:a.city,cost:a.cost??((utilityKitAll()||{}).cost)}),
doc:'Install the redundancy kit at every POP still missing part of it, at one quoted price. From customer level 2. Pass the quoted setup as cost.'},
utilityKitNew:{args:[['city','cityId',false]],watch:['ops'],
doc:'Put the redundancy kit in the intern\'s new-POP template, or take it out (the same switch as in the Ops sheet).'},
ptSave:{args:[['city','cityId'],['k','popTier']],watch:['popTiers'],
doc:'Save a POP\'s routers (model and count) as one of three POP standards: micro, medium or hub. The POP is marked as that kind. From customer level 2.'},
ptApply:{args:[['city','cityId'],['k','popTier'],['cost','integer',false]],watch:['pops.#city','popTiers'],
quote:a=>{const q=S?ptPlan(a.city,a.k):null;return q?{setup:q.cost,monthly:q.mo,blocked:q.why?[q.why]:[]}:{setup:0};},
pass:a=>({city:a.city,k:a.k,cost:a.cost??((S&&ptPlan(a.city,a.k))||{cost:0}).cost}),
doc:'Mark a POP as one kind and bring its routers up to that standard: add routers, swap to the standard\'s model if it is bigger. Never a step down. Pass the quoted setup as cost.'},
ptAll:{args:[['k','popTier'],['cost','integer',false],['city','cityId',false]],watch:['pops','popTiers'],
quote:a=>{const A=S?ptAll(a.k):null;return A?{setup:A.cost}:{setup:0};},
pass:a=>({k:a.k,city:a.city,cost:a.cost??(ptAll(a.k)||{}).cost}),
doc:'Bring every POP marked as one kind up to that standard, at one quoted price. Pass the quoted setup as cost.'},
utilityCaches:{args:[['city','cityId'],['quote','string',false]],watch:['caches'],
quote:a=>{const q=S?utilityCaches(a.city):null;return q?{key:q.key}:{};},
pass:a=>({city:a.city,quote:a.quote??((utilityCaches(a.city)||{}).key)}),
@ -530,6 +550,9 @@ const API_VIEW={
pniFilter:{args:[['f','pniFilter']],doc:'Filter the PNI list: all, via transit, worth it, already PNI.'},
pniGrp:{args:[['g','string'],['o','boolean',false]],doc:'Fold or unfold one group of the PNI list.'},
pniSort:{args:[],doc:'Flip the PNI list sort between A-Z and worth-it-first.'},
netFind:{args:[['q','string']],doc:'Filter a POP\'s transit, exchange, PNI and cache lists by network name or AS number.'},
netOnly:{args:[],doc:'Show only the networks you are connected to in a POP\'s lists, or all of them again.'},
netClear:{args:[],doc:'Clear the network search and the connected-only switch.'},
puzzleMenu:{args:[],doc:'Open the puzzle list.'},
puzzleDoor:{args:[],doc:'From the title screen: open the puzzle list (keeps the typed name).'},
pzFinish:{args:[],doc:'Puzzles only: run the star count and show the results sheet.'},

View file

@ -62,6 +62,7 @@ const API_STATE_DOC={
core:{type:'map',doc:'Your backbone technology: lv bought, the level it runs at, the interop lab.'},
ddosAuto:{type:'map',doc:'The NOC\'s auto-mitigation switches: rtbh and scrub.'},
popStd:{type:'map',doc:'The standard POP: router model and count new POPs start with, or null for none.'},
popTiers:{type:'map',doc:'POP standards by kind: def.micro|medium|hub is {g: router model, rt: routers} or null; at maps a POP city to its kind.'},
demo:{type:'map',doc:'Vendor demo units on order, by "kind:id" → ready day.'},
seatOff:{type:'map',doc:'The pending consortium-cable seat offer: landings, km, name, expiry day.'},
monkey:{type:'map',doc:'The chaos monkey: next visit day, whether it is in your network now, days left, whether anyone noticed.'},

View file

@ -19,7 +19,7 @@ function apiValidate(spec,args){
// maps, and the paths a command declares in watch. R is left out: it is rebuilt after every action.
const API_FP_LEN=['links','transit','pni','caches','biz','offers','nni','loans','loanOffers','inc','scrubs'];
const API_FP_KEYS=['pops','ixp','peers','myIx','done','ach','merged','confReg'];
const API_FP_JSON=['name','pairMet','rs','ixn','ixSite','ixPref','spares','te','cnLic','hw','scrubMode','ppol','ops','core','ddosAuto','popStd','demo','charter','monkey','seatOff','pz','ar','dk','ev'];
const API_FP_JSON=['name','pairMet','rs','ixn','ixSite','ixPref','spares','te','cnLic','hw','scrubMode','ppol','ops','core','ddosAuto','popStd','popTiers','demo','charter','monkey','seatOff','pz','ar','dk','ev'];
function apiFp(watch,args){
if(!S)return null;
const f={cash:S.cash,day:S.day,lvl:S.lvl||1,won:!!S.won,lost:!!S.lost};

View file

@ -0,0 +1,20 @@
/* ---------- Buy what a customer asks for, on signing (#241) ----------
Some requirements are hardware at a POP you already have: a backup generator, a second router, a second building.
An offer that asks for them gets a second button that buys exactly what is missing and signs, with the price on it.
Never silent: the player presses it, and nothing is bought unless the deal can be signed right after. */
const REQ_FIX=['gen','routers','metro'];
// What is missing for this offer, priced as the Infra tab's own buttons price it: [{k, city, cost, mo}], with totals.
function reqFix(o){if(!o||!bHas(o)||pzOn())return null;const items=[],cs=[o.city,o.city2].filter(Boolean);
for(const k of o.reqs||[]){if(!REQ_FIX.includes(k)||!REQS[k]||REQS[k].ok(o))continue;
for(const c of k==='routers'?[o.city]:cs){const p=S.pops[c];if(!p||items.some(x=>x.k===k&&x.city===c))continue;
if(k==='gen'&&!p.gen)items.push({k,city:c,cost:GEN_COST,mo:GEN_MO});
else if(k==='metro'&&!p.site2)items.push({k,city:c,cost:SITE2_COST,mo:SITE2_MO});
else if(k==='routers'&&(p.routers||1)<2){const g=p.rgen||0;items.push({k,city:c,cost:routerCost(g,p.routers||1),mo:routerMo(g)});}}}
if(!items.length)return null;return {items,cost:items.reduce((a,x)=>a+x.cost,0),mo:items.reduce((a,x)=>a+x.mo,0)};}
// Whether accept() would sign this offer now: the same checks, so money is never spent on a deal that then refuses.
const reqFixCanSign=o=>bHas(o)&&!(BIZ_T[o.type].event&&S.day>=o.start);
const REQ_FIX_L={gen:N_('req_fix.generator_in_city'),routers:N_('req_fix.second_router_in_city'),metro:N_('req_fix.second_site_in_city')};
// The button and one line saying what it buys. sm: the button size the list around it uses.
function reqFixHtml(o){const q=reqFix(o);if(!q||!reqFixCanSign(o))return '';
return `<div class="meta">${tr('req_fix.buys_list',{list:q.items.map(x=>tr(REQ_FIX_L[x.k],{city:CITY[x.city].name})).join(', '),cost:fmt$(q.cost),mo:fmt$(q.mo)})}</div>
<div class="btns">${btn(tr('req_fix.buy_and_sign',{cost:fmt$(q.cost)}),'acceptFix',{id:o.id,cost:q.cost},'pink sm',S.cash<q.cost)}</div>`;}

View file

@ -1,6 +1,6 @@
function newGame(name,home){
S={v:1,name,asn:200000+Math.floor(_rand()*15000),home,day:0,cash:START_CASH,
ltv:2,t1v:4,auV:1,calV:1,pieV:1,pie:null,ops:opsNew(),slAuto:slAutoNew(),achP:{},seen:NETS.map(n=>n.id),spares:{},pops:{[home]:{day:0,bb:null,boost:0,down:0,routers:1,gen:false}},links:[],nni:[],transit:[],ixp:{},rs:{},peers:{},pni:[],caches:[],biz:[],offers:[],myIx:{},pairMet:{},
done:{},inc:[],fleet:{},ev:{ddosMore:[]},ddosStarts:[],priceMul:1,nextFail:45,nextEvent:40,usedNames:[],stats:{survived:0,incidents:0,peak:0},vol:0,cnLic:{state:'none'},scrubs:[],scrubMode:'always',ddosAuto:{rtbh:false,scrub:true},capDeal:null,core:{lv:0,run:0},popStd:null,won:false,lost:false,neg:0,loans:[],loanOffers:[],loanStrikes:0,ppol:'open',pdesk:null,pdeskRep:null,hw:{},rules:makeRules('oncall'),charter:'global',cm:cmNew(),chartSet:false,demo:{},seatOff:null,solWon:0,monkey:{next:null,on:0}};
done:{},inc:[],fleet:{},ev:{ddosMore:[]},ddosStarts:[],priceMul:1,nextFail:45,nextEvent:40,usedNames:[],stats:{survived:0,incidents:0,peak:0},vol:0,cnLic:{state:'none'},scrubs:[],scrubMode:'always',ddosAuto:{rtbh:false,scrub:true},capDeal:null,core:{lv:0,run:0},popStd:null,popTiers:ptNew(),won:false,lost:false,neg:0,loans:[],loanOffers:[],loanStrikes:0,ppol:'open',pdesk:null,pdeskRep:null,hw:{},rules:makeRules('oncall'),charter:'global',cm:cmNew(),chartSet:false,demo:{},seatOff:null,solWon:0,monkey:{next:null,on:0}};
}

View file

@ -25,7 +25,10 @@ const OPS=[
{k:'ix',i:'🔀',t:N_('ops.o_ix'),d:N_('ops.o_ix_d'),p:{}},
{k:'pni',i:'🤝',pop:1,cap:50000,t:N_('ops.o_pni'),d:N_('ops.o_pni_d'),p:{g:{d:25,v:[5,10,25,50,100],l:N_('ops.p_g'),f:v=>fmtG(v)},tier:{d:0,v:[0,1,2],l:N_('ops.p_tier'),f:v=>tr('ops.at_least_port',{port:PORT[v].n})},paid:{d:false,v:[false,true],l:N_('ops.p_paid'),f:v=>v?tr('common.on'):tr('common.off')}}},
{k:'repair',i:'🔧',cap:50000,t:N_('ops.o_repair'),d:N_('ops.o_repair_d'),p:{}},
{k:'optics',i:'🌈',cap:250000,t:N_('ops.o_optics'),d:N_('ops.o_optics_d'),p:{at:{d:70,v:[50,60,70,80,90],l:N_('ops.p_at'),f:v=>v+'%'},pick:{d:'cheap',v:['cheap','big'],l:N_('ops.p_pick'),f:v=>tr({cheap:N_('ops.pick_cheap'),big:N_('ops.pick_big')}[v])}}},
{k:'optics',i:'🌈',cap:250000,t:N_('ops.o_optics'),d:N_('ops.o_optics_d'),p:{at:{d:70,v:[50,60,70,80,90],l:N_('ops.p_at'),f:v=>v+'%'},pick:{d:'cheap',v:['cheap','big'],l:N_('ops.p_pick'),f:v=>tr({cheap:N_('ops.pick_cheap'),big:N_('ops.pick_big')}[v])},
// New fiber pulls traffic onto itself the day it is lit (#316): the player may want to light it by hand, when the
// ports behind it are ready. Off: fiber without a channel stays dark; lit fiber still gets more optics when hot.
fresh:{d:true,v:[true,false],l:N_('ops.p_fresh'),f:v=>v?tr('common.on'):tr('common.off')}}},
// Line systems up to a bigger one, and optics swapped for bigger ones, on fiber that is full and runs hot, or every fiber up to
// a chosen line system. A line system swap is a day without that fiber: only where the traffic gets around it.
{k:'optup',i:'🔭',cap:250000,t:N_('ops.o_optup'),d:N_('ops.o_optup_d'),p:{at:{d:80,v:[60,70,80,90],l:N_('ops.p_at'),f:v=>v+'%'},
@ -208,8 +211,8 @@ const OPS_RUN={
const lag=o.lag(),wantLag=o.n()<2&&o.rt>1,ups=wantLag&&lag?null:o.ups(),fit=ups&&(ups.find(u=>u.cap>=N*o.use)||ups.at(-1)),job=wantLag?lag||fit:fit||lag,was=o.sig();
if(!job||!X.can('ports',job.cost)||!X.pay('ports',()=>{job.go();return o.sig()!==was;})){KV.rv=null;KV.pu.clear();break;}
KV.rv=null;KV.pu.clear();X.did('ports',o.at+' '+job.w);yield;}},
*optics(X){const at=opsP('optics','at')/100,big=opsP('optics','pick')==='big',gpd=(o,l)=>optG(o,l)/optCost(o);
for(const l of S.links){if(l.kind!=='df'||l.ready>S.day||l.eqDown>S.day||l.standby||l.cut>S.day)continue;
*optics(X){const at=opsP('optics','at')/100,big=opsP('optics','pick')==='big',fresh=opsP('optics','fresh'),gpd=(o,l)=>optG(o,l)/optCost(o);
for(const l of S.links){if(l.kind!=='df'||l.ready>S.day||l.eqDown>S.day||l.standby||l.cut>S.day||(!fresh&&!(l.ch||[]).length))continue;
let cap=dfCap(l);const load=((R.load&&R.load[l.id])||0)*opsAhead();
// New fiber gets its first channel; lit fiber gets more while it runs hot.
for(let step=0;step<8&&(cap<=0?!(l.ch||[]).length:load>=cap*at);step++){if(chMax(l)-(l.ch||[]).length-soldSlots(l)<=0)break;

View file

@ -0,0 +1,49 @@
/* ---------- POP standards: micro, medium, regional hub (#315) ----------
Real networks build a few kinds of POP, not one: a small edge site, a medium one, a regional hub. The player saves a
POP's routers as one of three standards and marks POPs as that kind; a POP is brought up to its standard with one
button, and every POP of a kind with one more once the standard grows (a new model unlocked, more routers). Which POP
is which stays the player's choice, so growth stays selective. Never a step down: a POP with a bigger model keeps it.
The standard for brand-new POPs (#240, 96-pop-standard.js) is a separate thing. From customer level 2, like the intern. */
const POP_TIERS=['micro','medium','hub'];
const POP_TIER_L={micro:N_('pop_tiers.micro'),medium:N_('pop_tiers.medium'),hub:N_('pop_tiers.hub')};
const ptNew=()=>({def:{micro:null,medium:null,hub:null},at:{}});
const ptOn=()=>!!S&&opsCanHire()&&!pzOn();
const ptO=()=>S.popTiers||(S.popTiers=ptNew());
// Saves are untrusted: known kinds, router models that exist, POPs that still exist.
function ptSanitize(s){const o=s.popTiers&&typeof s.popTiers==='object'&&!Array.isArray(s.popTiers)?s.popTiers:{},n=ptNew(),d=o.def&&typeof o.def==='object'?o.def:{},at=o.at&&typeof o.at==='object'&&!Array.isArray(o.at)?o.at:{};
for(const k of POP_TIERS){const x=d[k];if(x&&typeof x==='object'&&Number.isInteger(x.g)&&RG[x.g])n.def[k]={g:x.g,rt:int(x.rt,1,RMAX,1)};}
for(const c of Object.keys(at))if(isCity(c)&&own(s.pops,c)&&POP_TIERS.includes(at[c]))n.at[c]=at[c];
s.popTiers=n;}
// The clicks that bring a POP up to a standard, in order, priced as each click prices it: a second router first where a
// lone router carries traffic (so the swap is a rolling upgrade, not a maintenance window), the bigger model, the rest of
// the routers. null when the POP already meets it. why: what stops it today.
function ptPlan(c,k){const p=S.pops[c],d=S.popTiers&&S.popTiers.def[k];if(!p||!d)return null;
const g0=p.rgen||0,rt0=p.routers||1,up=d.g!==g0&&RG[d.g].cap>RG[g0].cap,steps=[];let rt=rt0,cost=0;
if(up&&rt===1&&d.rt>=2&&!popIdle(c)){cost+=routerCost(g0,1);steps.push('add');rt=2;}
if(up){cost+=Math.max(0,Math.round(RG[d.g].cost*rt*hwMul('rt')*techMul(RG[d.g].lvl))-tradeIn(g0,rt));steps.push('swap');}
const g=up?d.g:g0;while(rt<d.rt){cost+=routerCost(g,rt);steps.push('add');rt++;}
if(!steps.length)return null;
const mo=n=>(n-1)*ROUTER_MO+cageMo(n),why=up?(!techOk('rg',d.g,RG[d.g].lvl)?tr('pop_tiers.model_locked',{model:esc(RG[d.g].n),lv:RG[d.g].lvl}):modelFits(c,d.g)||(p.rupDay===S.day?tr('pop_tiers.swapped_today'):'')):'';
return {steps,cost,g:d.g,mo:mo(rt)+rt*RG[g].mo-mo(rt0)-rt0*RG[g0].mo,why};}
// Run the plan through the Infra tab's own actions, quietly. True when every click went through.
function ptRun(c,q){let ok=true;opsQuiet(()=>{for(const s of q.steps){const p=S.pops[c],rt=p.routers||1,g=p.rgen||0;
if(s==='add')ACT.addRouter({city:c});else ACT.upRouter({city:c,g:q.g});if((p.routers||1)===rt&&(p.rgen||0)===g){ok=false;break;}}});return ok;}
// The POPs of one kind, the busiest first, with their plans.
function ptAll(k){const at=S.popTiers?S.popTiers.at:{},cs=Object.keys(at).filter(c=>at[c]===k&&S.pops[c]).sort((a,b)=>(R.nodeLoad[b]||0)-(R.nodeLoad[a]||0)||a.localeCompare(b));
const todo=[],stuck=[];for(const c of cs){const q=ptPlan(c,k);if(!q)continue;(q.why?stuck:todo).push({c,q});}
return {cs,todo,stuck,cost:todo.reduce((a,x)=>a+x.q.cost,0)};}
const ptName=k=>tr(POP_TIER_L[k]),ptDesc=d=>d?`${d.rt} × ${esc(RG[d.g].n)}`:tr('pop_tiers.not_set');
// In a POP's router section: the three standards, what this POP is, and one button each.
function popTierHtml(c){if(!ptOn()||!S.pops[c])return '';const T=ptO(),p=S.pops[c],mine=T.at[c];
return `<div class="ptier"><div class="kv"><span>${tr('pop_tiers.title')}</span><b>${mine?tr('pop_tiers.this_pop_is',{kind:ptName(mine)}):tr('pop_tiers.no_kind')}</b></div>
${POP_TIERS.map(k=>{const d=T.def[k],q=d?ptPlan(c,k):null,same=d&&d.g===(p.rgen||0)&&d.rt===(p.routers||1);
const main=!d?'':q?btn(tr('pop_tiers.apply_cost',{cost:fmt$(q.cost)}),'ptApply',{city:c,k,cost:q.cost},mine===k?'pink sm':'sm',!!q.why||S.cash<q.cost):mine!==k?btn(tr('pop_tiers.mark'),'ptApply',{city:c,k,cost:0},'sm'):`<span class="tag st on">✓ ${tr('pop_tiers.meets_it')}</span>`;
return `<div class="row"><div class="grow"><div class="nm">${ptName(k)} <span class="meta">${ptDesc(d)}</span></div>${q&&q.why?`<div class="why">${esc(q.why)}</div>`:''}
<div class="btns">${main}${same?'':btn(tr('pop_tiers.save_here'),'ptSave',{city:c,k},'ghost sm')}</div></div></div>`;}).join('')}
<p class="note">${tr('pop_tiers.note')}</p></div>`;}
// In Utilities: every kind with its POPs, and one button that brings them all up to their standard.
function popTierAllHtml(city){if(!ptOn())return '';const T=ptO();if(!POP_TIERS.some(k=>T.def[k]))return '';
return `<section><h3>${tr('pop_tiers.title')}</h3><p class="lead">${tr('pop_tiers.bulk_note')}</p>
${POP_TIERS.filter(k=>T.def[k]).map(k=>{const A=ptAll(k);return `<div class="row"><div class="grow"><div class="nm">${ptName(k)} <span class="meta">${ptDesc(T.def[k])}</span></div>
<div class="meta">${trn('pop_tiers.n_pops',A.cs.length)}${A.todo.length?' · '+trn('pop_tiers.n_below',A.todo.length):''}${A.stuck.length?' · '+trn('pop_tiers.n_stuck',A.stuck.length):''}</div>
${A.todo.length?`<div class="btns">${btn(trn('pop_tiers.bring_up_n',A.todo.length,{cost:fmt$(A.cost)}),'ptAll',{k,cost:A.cost,city},'pink sm',S.cash<A.cost)}</div>`:''}</div></div>`;}).join('')}</section>`;}

View file

@ -40,6 +40,12 @@ function utilityKit(city){const p=S&&S.pops[city];if(!p)return null;
const gen=!p.gen,site=!p.site2,router=(p.routers||1)<2,g=p.rgen||0;
return {gen,site,router,moves:utilityCacheMoves(city),cost:(gen?GEN_COST:0)+(site?SITE2_COST:0)+(router?routerCost(g,1):0),
mo:(gen?GEN_MO:0)+(site?SITE2_MO:0)+(router?routerMo(g):0)};}
// The kit at every POP that lacks part of it (#317): one quote, one button. From customer level 2, like the intern: early
// on, every generator is a choice about money.
const utilityKitAllOn=()=>!!S&&opsCanHire()&&!pzOn();
function utilityKitAll(){if(!utilityKitAllOn())return null;const cities=[];let cost=0,mo=0,moves=0;
for(const c of Object.keys(S.pops)){const q=utilityKit(c);if(!q||(!q.cost&&!q.moves.length))continue;cities.push(c);cost+=q.cost;mo+=q.mo;moves+=q.moves.length;}
return {cities,cost,mo,moves};}
function utilityPeers(){if(!S)return [];return Object.keys(S.ixp).filter(isIx).map(ix=>{
const sessions=ixSessions(ix),requests=[],blocked=[];let existing=0;
for(const id of ixMembers(ix)){

View file

@ -64,6 +64,8 @@ function sanitize(s){
// The backbone's technology: a save from before it with Auto-TE bought keeps the old rules on RSVP-TE (legacy).
// The standard POP build (#240): a router model and how many.
{const d=s.popStd;s.popStd=d&&typeof d==='object'&&Number.isInteger(d.g)&&RG[d.g]?{g:d.g,rt:int(d.rt,1,RMAX,1)}:null;}
// POP standards by kind (#315): micro, medium, regional hub, and which POP is which.
ptSanitize(s);
{const c=s.core&&typeof s.core==='object'?s.core:null,lv=c?int(c.lv,0,4,0):(s.te?2:0);s.core={lv,run:c?int(c.run,0,lv,lv):lv};if(c?c.legacy===true:!!s.te)s.core.legacy=true;if(c&&c.lab===true)s.core.lab=true;if(c&&c.since!==undefined)s.core.since=num(c.since,0);}
s.capDeal=s.capDeal&&typeof s.capDeal==='object'&&own(CAP_ROUTES,s.capDeal.c)?{at:num(s.capDeal.at,0),c:s.capDeal.c}:null;
s.inc=s.inc.filter(i=>i&&typeof i.type==='string').map(i=>(i.type==='maxpfx'&&(i.type='ixloop'),i.id=sid(i.id),i.until=num(i.until,s.day),i.cost=num(i.cost,0),i.msg=String(i.msg||'').slice(0,400),i.fix=i.fix==null?undefined:String(i.fix).slice(0,60),i));

View file

@ -114,11 +114,21 @@ function mktPrice(from){const m=mkt();for(let i=from;i<S.offers.length;i++){cons
const clMid=b=>Math.round((b.rate+b.hag.rate)/2);
const clBill=(b,rate)=>BIZ_T[b.type].fiber?rate:b.bw*rate;
const clHags=()=>S?S.biz.reduce((a,b)=>a+(b.hag?1:0),0):0;
/* What is at stake in a renewal (#292): how much traffic they book and get, the price per Gbps now and asked, and the
path terms they signed for (latency, diverse, no subsea), each ticked as it stands today. Two short lines for a phone. */
function clRenInfo(b){const T=BIZ_T[b.type],tick=v=>`<b style="color:${v?'var(--eye)':'var(--bad)'}">${v?'✓':'✗'}</b> `,top=[],rq=[];
if(!T.fiber){const sf=bizSf(b),srv=`<b${sf<0.95?' style="color:var(--bad)"':''}>${fmtG(b.bw*sf)}</b>`;
top.push(b.sites?trn('lifecycle.ren_sites_traffic',b.sites.length,{bw:fmtG(b.bw),srv}):tr('lifecycle.ren_traffic',{bw:fmtG(b.bw),srv}));
top.push(tr('lifecycle.ren_per_g',{was:fmt$(b.rate),price:fmt$(b.hag.rate)}));}
for(const k of b.reqs||[]){const Q=REQS[k];if(!Q)continue;const ok=Q.ok(b);
if(k==='lat'){const v=R.l2lat[b.id]!==undefined?R.l2lat[b.id]:bestLat(b.city,b.city2);rq.push(tick(ok)+tr('lifecycle.ren_lat',{max:b.latMax,now:isFinite(v)?tr('common.ms_ms_one_way',{ms:v.toFixed(1)}):tr('common.no_path')}));}
else rq.push(tick(ok)+(k==='diverse'?tr('lifecycle.ren_diverse'):k==='sharks'?tr('lifecycle.ren_no_subsea'):esc(typeof Q.l==='function'?Q.l(b):Q.l)));}
return (top.length?`<div class="meta">${top.join(' · ')}</div>`:'')+(rq.length?`<div class="meta">${rq.join(' · ')}</div>`:'');}
// The renewals waiting for an answer, at the top of Deals.
function clDealsHtml(){const hs=S.biz.filter(b=>b.hag).sort((a,b)=>a.hag.until-b.hag.until);if(!hs.length)return '';
return `<h3 class="sub4">${tr('lifecycle.renewals')}</h3><p class="meta" style="margin:0 0 6px">${tr('lifecycle.unanswered_matches')}</p>`+hs.map(b=>{const now=BIZ_T[b.type].fiber?b.hag.rate:b.bw*b.hag.rate,was=bizMo(b);
return `<div class="row"><div class="grow"><div class="nm">${esc(b.name)}</div><div class="meta">${esc(BIZ_T[b.type].l)} · ${esc(clWhere(b))} · ${tr('ui.n_d_left',{n:b.hag.until-S.day})}</div>
<div class="meta">${tr('lifecycle.wants_price',{was:fmt$(was),price:fmt$(now),p:pct(1-now/Math.max(1,was))})}</div>${slRenRow(b)}
<div class="meta">${tr('lifecycle.wants_price',{was:fmt$(was),price:fmt$(now),p:pct(1-now/Math.max(1,was))})}</div>${clRenInfo(b)}${slRenRow(b)}
<div class="btns">${btn(tr('lifecycle.match'),'renewMatch',{id:b.id},'green sm')}${btn(tr('lifecycle.meet_halfway',{price:fmt$(clBill(b,clMid(b)))}),'renewMeet',{id:b.id},'sm')}${btn(tr('lifecycle.let_them_go'),'renewLet',{id:b.id},'ghost sm')}</div></div></div>`;}).join('');}
// The contract line on a customer row.
const clTermTxt=b=>clOn(b)&&b.te?(b.hag?tr('lifecycle.renewal_haggle',{date:dateStr(b.te)}):tr('lifecycle.contract_until',{date:dateStr(b.te)})):'';

View file

@ -0,0 +1,6 @@
// Find a network at a POP (#199): view state only.
Object.assign(ACT,{
netFind:({q})=>{UI.netQ=String(q??'').slice(0,40);listReset('pni');renderPanel();},
netOnly:()=>{UI.netOnly=!UI.netOnly;listReset('pni');renderPanel();},
netClear:()=>{UI.netQ='';UI.netOnly=false;listReset('pni');renderPanel();},
});

View file

@ -0,0 +1,10 @@
Object.assign(ACT,{
// Buy what the offer asks for, then sign (#241). cost: the price the button showed; a changed quote buys nothing.
acceptFix:({id,cost})=>{const o=S.offers.find(x=>x.id===id),q=reqFix(o);if(!o||!q||!reqFixCanSign(o))return;
if(q.cost!==+cost){toast(tr('utilities.quote_changed'),'bad');sfx('err');after();return;}
if(S.cash<q.cost){toast(tr('interface.not_enough_cash_wait_for_revenue'),'bad');sfx('err');return;}
// The Infra tab's own buttons, quietly, then the ordinary signing with its toast and redraw.
opsQuiet(()=>{for(const x of q.items){if(x.k==='gen')ACT.addGen({city:x.city});else if(x.k==='metro')ACT.addSite({city:x.city});else ACT.addRouter({city:x.city});}});
toast(esc(tr('req_fix.bought',{list:q.items.map(x=>tr(REQ_FIX_L[x.k],{city:CITY[x.city].name})).join(', '),cost:fmt$(q.cost)})),'good');
ACT.accept({id});},
});

View file

@ -4,7 +4,10 @@ Object.assign(ACT,{
decomToggle:({city})=>{if(!S.pops[city])return;UI.decom=UI.decom||new Set();if(UI.decom.has(city))UI.decom.delete(city);else UI.decom.add(city);decomModal();},
decomGo:()=>{const sel=[...(UI.decom||[])].filter(c=>S.pops[c]);if(!sel.length||sel.length>=Object.keys(S.pops).length)return;closeModal();UI.decom=null;UI.sel=null;decommission(sel);sfx('alert');after();},
rmLink:({id})=>{if(UI.confirm!==id){UI.confirm=id;renderPanel();return;}{const l=S.links.find(x=>x.id===id),back=cabBack(l);if(back>0){S.cash+=back;toast(tr('links.name_is_called_off_the_cable',{name:esc(l.cname||tr('common.your_cable')),price:fmt$(back)}),'good');}
const n=chBack(l?[l]:[]);if(n)toast(trn('links.n_optic_back_on_the_spares_shelf',n),'good');}S.links=S.links.filter(l=>l.id!==id);prunePairMet();UI.sel=null;UI.confirm=null;after();},
const n=chBack(l?[l]:[]);if(n)toast(trn('links.n_optic_back_on_the_spares_shelf',n),'good');}const l0=S.links.find(x=>x.id===id),sib=l0?pairLinks(l0.a,l0.b).filter(x=>x!==l0&&x.kind!=='vxc'):[];S.links=S.links.filter(l=>l.id!==id);prunePairMet();
// One of several parallel links (#119): the panel moves on to the next one between the same cities, so a row of them
// can be handed back without opening the panel again each time.
UI.sel=sib.length?{type:'link',id:sib[0].id}:null;UI.confirm=null;after();},
// The chaos monkey takes a banana and goes home early (no bonus).
mkBanana:()=>{if(!mkOn())return;if(!spend(mkBananaCost()))return;S.stats.bananas=(S.stats.bananas||0)+1;mkLeave('banana');track('monkey_banana');after();},
fixInc:({id})=>{const i=S.inc.find(x=>x.id===id);if(!i||!(i.cost>0))return;

View file

@ -0,0 +1,16 @@
// POP standards (#315): save one, bring a POP up to one, bring every POP of a kind up to it.
Object.assign(ACT,{
ptSave:({city,k})=>{const p=S.pops[city];if(!ptOn()||!p||!POP_TIERS.includes(k))return;const T=ptO();T.def[k]={g:p.rgen||0,rt:p.routers||1};T.at[city]=k;
toast(esc(tr('pop_tiers.saved',{kind:ptName(k),desc:`${T.def[k].rt} × ${RG[T.def[k].g].n}`})),'good');sfx('click');after();},
// cost: the price on the button; a plan that changed under it buys nothing. A POP that already meets it is only marked.
ptApply:({city,k,cost})=>{if(!ptOn()||!S.pops[city]||!POP_TIERS.includes(k)||!ptO().def[k])return;const q=ptPlan(city,k);
if((q?q.cost:0)!==+cost){toast(tr('utilities.quote_changed'),'bad');sfx('err');after();return;}
if(q&&q.why){toast(esc(q.why),'bad');sfx('err');return;}if(q&&S.cash<q.cost){toast(tr('interface.not_enough_cash_wait_for_revenue'),'bad');sfx('err');return;}
S.popTiers.at[city]=k;const ok=!q||ptRun(city,q);
toast(esc(ok?tr('pop_tiers.city_is_kind',{city:CITY[city].name,kind:ptName(k)}):tr('pop_tiers.not_all',{city:CITY[city].name})),ok?'good':'bad');sfx(q?'build':'click');after();},
ptAll:({k,cost,city})=>{if(!ptOn()||!POP_TIERS.includes(k))return;const A=ptAll(k);if(!A.todo.length)return;
if(A.cost!==+cost){utilitiesModal(city,tr('utilities.quote_changed'));return;}
if(S.cash<A.cost){toast(tr('interface.not_enough_cash_wait_for_revenue'),'bad');sfx('err');return;}
let n=0;for(const {c,q} of A.todo)if(ptRun(c,q))n++;
sfx('build');after();utilitiesModal(city,trn('pop_tiers.bulk_done',n,{kind:ptName(k)}));},
});

View file

@ -10,6 +10,14 @@ Object.assign(ACT,{
if(q.gen)p.gen=true;if(q.site){p.site2=true;p.site2Day=S.day;}if(q.router)p.routers=2;
const moves=new Map(q.moves.map(m=>[m.id,m.site]));for(const c of S.caches)if(moves.has(c.id))c.site=moves.get(c.id);
after();const msg=tr('utilities.kit_applied',{city:CITY[city].name});if(modal)utilitiesModal(city,msg);else toast(esc(msg),'good');},
// Every POP's kit in one go (#317), all or nothing on the quoted price, one redraw at the end.
utilityKitAll:({cost,city})=>{const q=utilityKitAll();if(!q||!q.cities.length)return;
if(q.cost!==+cost){utilitiesModal(city,tr('utilities.quote_changed'));return;}
if(S.cash<q.cost){toast(tr('interface.not_enough_cash_wait_for_revenue'),'bad');sfx('err');return;}
let n=0;opsQuiet(()=>{for(const c of q.cities){const k=utilityKit(c);if(!k||S.cash<k.cost)continue;const c0=S.cash;ACT.utilityKit({city:c,cost:k.cost});if(S.cash<c0||!k.cost)n++;}});
sfx('build');after();utilitiesModal(city,trn('utilities.kit_all_applied',n));},
// The intern's new-POP template with or without the kit, from the Utilities sheet: the same switch as in Ops.
utilityKitNew:({city})=>{if(!opsHired())return;S.ops.tpl.kit=!S.ops.tpl.kit;sfx('click');after();utilitiesModal(city);},
utilityCaches:({city,quote,modal})=>{const q=utilityCaches(city);if(!q||!q.add.length)return;
if(q.key!==quote){if(modal)utilitiesModal(city,tr('utilities.quote_changed'));else{renderPanel();toast(tr('utilities.quote_changed'));}return;}
if(!portGate(city,q.ports))return;

View file

@ -46,7 +46,7 @@ function renderLeft(){checkLayer();
{const lv=S.lvl||1,nx=LEVELS[lv];h+=`<div class="inc" style="background:#FFF6CF"><div class="nm">${tr('hud_and_panels.customer_level_lv_name',{lv,name:LEVELS[lv-1].n})}</div><div class="meta">${nx?tr('hud_and_panels.next_req_unlocks_what',{req:nx.req,what:lc1(nx.unlock)}):tr('common.every_customer_type_is_unlocked_go')}</div></div>`;}
if(!S.offers.length)h+=`<p class="empty">${tr('hud_and_panels.no_open_offers_right_now_businesses')}</p>`;
for(const o of S.offers.slice().sort((a,b)=>a.exp-b.exp)){const has=bHas(o);
h+=`<div class="row"><div class="grow"><div class="nm">${esc(o.name)}</div><div class="meta">${esc(BIZ_T[o.type].l)} · ${CITY[o.city].name}${o.city2?' ⇄ '+CITY[o.city2].name:''} · <b>${bTerms(o)}</b> · ${tr('ui.n_d_left',{n:o.exp-S.day})}${(o.reqs||[]).length?` · ${trn('hud_and_panels.n_special_requirement',o.reqs.length)}`:''}</div>${o.refN?`<div class="meta">${tr('lifecycle.referred_by',{name:esc(o.refN)})}</div>`:''}${spotWhy(o)}${bRisk(o)}${reqList(o)}
h+=`<div class="row"><div class="grow"><div class="nm">${esc(o.name)}</div><div class="meta">${esc(BIZ_T[o.type].l)} · ${CITY[o.city].name}${o.city2?' ⇄ '+CITY[o.city2].name:''} · <b>${bTerms(o)}</b> · ${tr('ui.n_d_left',{n:o.exp-S.day})}${(o.reqs||[]).length?` · ${trn('hud_and_panels.n_special_requirement',o.reqs.length)}`:''}</div>${o.refN?`<div class="meta">${tr('lifecycle.referred_by',{name:esc(o.refN)})}</div>`:''}${spotWhy(o)}${bRisk(o)}${reqList(o)}${reqFixHtml(o)}
<div class="btns">${has?btn(tr('common.accept'),'accept',{id:o.id},'green sm'):btn(tr('common.go_there'),'focusCity',{city:bCities(o).find(c=>!S.pops[c])},'ghost sm')}${btn(tr('common.decline'),'decline',{id:o.id},'ghost sm')}</div>${has?'':`<div class="why">${tr('hud_and_panels.needs_a_pop_in_cities',{cities:bCities(o).filter(x=>!S.pops[x]).map(x=>CITY[x].name).join(', ')})}</div>`}</div></div>`;}
}else if(UI.left==='noc'){
h+=`<div class="btns" style="margin-bottom:8px">${btn(tr('hud_and_panels.open_noc_dashboard'),'dash',{},'pink')}${pieNocBtn()}${btn(`⚙️ ${tr('routing.routing_and_ddos')}${S.te&&!coreTE()?'<span class="cnt red dot" aria-hidden="true"></span>':''}`,'routingOpen',{},'')}</div>`;

View file

@ -40,10 +40,10 @@ function cityPanel(c){
for(const b of bz)h+=`<div class="row"><div class="grow"><div class="nm">${esc(b.name)}</div><div class="meta">${esc(BIZ_T[b.type].l)}${b.city2?` ${CITY[b.city].name} ⇄ ${CITY[b.city2].name}`:''} · ${bTerms(b)}${clTermTxt(b)?' · '+clTermTxt(b):''}${BIZ_T[b.type].l2?` · ${b.sites?tr('city_panel.carrying_g_per_site',{g:fmtG(R.l2[b.id]||0)}):tr('city_panel.carrying_g',{g:fmtG(R.l2[b.id]||0)})}`:''}${BIZ_T[b.type].fiber&&!fiberOk(b)?' · <b style="color:var(--bad)">'+tr('city_panel.fiber_is_down')+'</b>':''}${BIZ_T[b.type].event&&eventLive(b)?` · <b>${tr('city_panel.serving_v',{v:pct(sfOf(R,b.city))})}</b>`:''}${b.type==='scrub'&&!hasScrub()?' · <b style="color:var(--bad)">'+tr('common.needs_a_scrubbing_center')+'</b>':''}${S.day-(b.since||0)<15?` · <b>${tr('common.provisioning_n_d_grace',{n:15-(S.day-(b.since||0))})}</b>`:''}</div>${bRisk(b)}${reqList(b)}${BIZ_T[b.type].l2?routeCtl(b):''}${pathCtl(b)}<div class="bar ${b.mood<30?'bad':b.mood<65?'warn':''}"><i style="width:${b.mood}%"></i></div><div class="meta">${tr('common.happiness_p',{p:Math.round(b.mood)})}</div></div>${btn(UI.confirm===b.id?tr('common.really_drop'):tr('common.drop'),'dropBiz',{id:b.id},'ghost sm')}</div>`;
h+=`</section>`+offersHere(c);
}else if(UI.tab==='up'){
h+=portNote(c)+latNote(c);
h+=netFilterHtml()+portNote(c)+latNote(c);
h+=`<section><h3>${tr('common.ip_transit')}</h3><p class="lead">${tr('city_panel.pay_a_bigger_network_per_gbps')}</p>`;
const prov=NETS.filter(n=>sellsAt(n,c)).sort((a,b)=>a.price-b.price);
if(!prov.length)h+=`<p class="empty">${tr('city_panel.nobody_sells_transit_here_haul_your')}</p>`;
const prov0=NETS.filter(n=>sellsAt(n,c)).sort((a,b)=>a.price-b.price),prov=prov0.filter(n=>netKeep(n,S.transit.some(x=>x.city===c&&x.net===n.id)));
if(!prov0.length)h+=`<p class="empty">${tr('city_panel.nobody_sells_transit_here_haul_your')}</p>`;else if(!prov.length)h+=netNone();
for(const n of prov){const t=S.transit.find(x=>x.city===c&&x.net===n.id);const pr=transitPerG(n,c,premOnlyAt(n,c)||!!(t&&premOn(t)))*S.priceMul;
h+=`<div class="row">${logo(n)}<div class="grow"><div class="nm">${esc(n.name)} <span class="tag ${n.type}">${TYPE_L[n.type]}</span></div><div class="meta">${tr('city_panel.price_per_gbps_month_billed_on',{price:pr.toFixed(2)})}</div>${premOnlyAt(n,c)&&!t?`<div class="meta">${tr('city_panel.only_the_cn_too_premium_crossing')}</div>`:''}`;
if(t){const u=R.useT[t.id]||0,cap=lagCap(PORT[t.tier].g,t.n),tdown=t.down>S.day;
@ -53,12 +53,12 @@ function cityPanel(c){
h+=`</div></div>`;}
h+=`</section>`;
}else if(UI.tab==='peer'){
h+=portNote(c);
h+=netFilterHtml()+portNote(c);
h+=ixSection(c);
h+=`<section><h3>${tr('city_panel.private_interconnects_pni')}</h3><p class="lead">${tr('city_panel.a_dedicated_cross_connect_to_one',{dc:esc(siteName(c,'a'))})}</p>`;
h+=pniListHtml(c);
h+=`</section><section><h3>${tr('common.embedded_caches')}</h3><p class="lead">${tr('city_panel.cdns_put_free_cache_servers_inside')}</p>`;
for(const n of NETS.filter(n=>n.cache)){const have=S.caches.filter(x=>x.city===c&&x.net===n.id),dem=R.demTo[n.id]||0,ok=dem>=n.cache.min;
for(const n of NETS.filter(n=>n.cache&&netKeep(n,S.caches.some(x=>x.city===c&&x.net===n.id)))){const have=S.caches.filter(x=>x.city===c&&x.net===n.id),dem=R.demTo[n.id]||0,ok=dem>=n.cache.min;
h+=`<div class="row">${logo(n)}<div class="grow"><div class="nm">${esc(n.cache.name)}</div><div class="meta">${tr('common.from_net',{net:esc(n.name)})} · ${have.length?`${trn('common.n_box',have.length)} · ${tr('city_panel.serving_v',{v:fmtG(have.reduce((a,x)=>a+(R.useCache[x.id]||0),0))})}`:tr('city_panel.100g_per_box')}</div>${!ok?`<div class="why">${tr('city_panel.needs_min_gbps_of_traffic_to',{min:n.cache.min,net:esc(n.name),now:dem.toFixed(1)})}</div>`:''}</div>
${have.length?btn(tr('common.remove'),'rmCache',{id:(have.find(x=>x.site==='b')||have[0]).id},'ghost sm'):''}${btn(have.length?tr('common.box'):tr('common.request'),'cache',{city:c,net:n.id},'sm',!ok)}</div>${S.pops[c].site2&&have.length?(()=>{const nb=have.filter(x=>x.site==='b').length,na=have.length-nb;return `<div class="seg site"><span class="meta">${tr('city_panel.boxes_a_in_a_b_in',{a:na,b:nb})}</span>${na?btn(tr('city_panel.move_one_to_b'),'cacheSite',{city:c,net:n.id,s:'b'},'ghost sm'):''}${nb?btn(tr('city_panel.move_one_to_a'),'cacheSite',{city:c,net:n.id,s:'a'},'ghost sm'):''}</div>`;})():''}`;}
h+=`</section>`;
@ -75,7 +75,7 @@ function cityPanel(c){
${nl>=nc*0.95?`<p class="why">${tr('city_panel.maxed_out_traffic_here_is_being')}</p>`:''}
<div class="btns">${N?(!techOk('rg',Ni,N.lvl)?demoBtn('rg',Ni,N.lvl,tr('city_panel.model_level_lv',{model:esc(N.n),lv:N.lvl}),'pink'):btn(tr('city_panel.upgrade_to_model_cost_mo_mo',{model:esc(N.n),cost:fmt$(swapCost(c,Ni)),mo:fmt$(N.mo*rt)}),'upRouter',{city:c,g:Ni},'pink',S.cash<swapCost(c,Ni)||p.rupDay===S.day)):''}${btn(UI.models?tr('city_panel.hide_other_models'):tr('common.other_models'),'models',{},'ghost sm')}${rt<RMAX?btn(tr('city_panel.add_router_cost_mo_mo',{cost:fmt$(routerCost(g,rt)),mo:fmt$(routerMo(g)+(rt>=RCAGE?CAGE_MO:0))}),'addRouter',{city:c},'',S.cash<routerCost(g,rt)):''}${rt>1?btn(tr('common.remove_one'),'rmRouter',{city:c},'ghost sm'):''}</div>
${rt>=RCAGE&&rt<RMAX?`<p class="note">${tr('city_panel.the_standard_cage_holds_n_routers',{n:RCAGE,mo:fmt$(CAGE_MO)})}</p>`:''}${rt>=RMAX?`<p class="note">${tr('city_panel.this_pop_has_the_most_routers',{n:RMAX})}</p>`:''}${rt>RCAGE?`<div class="kv"><span>${tr('city_panel.cage_extension')}</span><b>${fmt$(cageMo(rt))}/mo</b></div>`:''}
${popStdHtml(c)}
${popStdHtml(c)}${popTierHtml(c)}
${UI.models?routerModels(c):''}
${N||UI.models?`<p class="note">${(p.rgen||0)>0?tr('city_panel.prices_include_p_back_for_the',{p:fmt$(tradeIn(p.rgen||0,rt))})+' ':''}${p.rupDay===S.day?tr('city_panel.new_routers_went_in_today_the')+' ':''}${rt>1?tr('city_panel.rolling_upgrade_one_router_at_a'):tr('city_panel.with_one_router_the_upgrade_needs')}</p>`:''}
<p class="note">${rt>=2?tr('city_panel.a_crash_here_only_costs_one'):tr('city_panel.one_router_is_a_single_point')}</p></section>

View file

@ -0,0 +1,14 @@
/* ---------- Find a network at a POP (#199) ----------
The Transit and Peering tabs list every network that sells or peers there: dozens in a big city. One search box and a
"connected only" switch filter all of them (transit, exchange members, PNIs, caches). View state only, never saved;
it stays while you hop between POPs, and a Clear button says it is on. */
const netQ=()=>(UI.netQ||'').trim().toLowerCase();
const netFiltered=()=>!!netQ()||!!UI.netOnly;
// on: connected to that network in this list (a transit port, a session, a PNI, a cache box). A number finds an AS.
function netKeep(n,on){const q=netQ();if(q&&!n.name.toLowerCase().includes(q)&&!(n.asn&&String(n.asn).startsWith(q)))return false;return !UI.netOnly||!!on;}
function netFilterHtml(){return `<div class="netf"><input type="search" id="netQ" class="t" value="${esc(UI.netQ||'')}" maxlength="40" autocomplete="off" placeholder="${esc(tr('net_filter.find_a_network'))}" aria-label="${esc(tr('net_filter.find_a_network'))}">
<div class="btns">${btn(tr('net_filter.connected_only'),'netOnly',{},UI.netOnly?'green sm':'ghost sm')}${netFiltered()?btn(tr('net_filter.clear'),'netClear',{},'ghost sm'):''}</div></div>`;}
const netNone=()=>`<p class="empty">${tr('pni_list.nothing_matches')}</p>`;
// Typing redraws the panel. The morph swaps an input whose value changed, so the new box gets the focus and the caret back.
document.addEventListener('input',e=>{if(e.target.id!=='netQ'||!S)return;const at=e.target.selectionStart;ACT.netFind({q:e.target.value});
const n=$('netQ');if(n&&n!==e.target){n.focus();try{n.setSelectionRange(at,at);}catch(err){}}});

View file

@ -15,7 +15,8 @@ function pniRow(c,n,pn,v,chk){let h=`<div class="row prow">${logo(n)}<div class=
else{h+=chk.ok?`<div class="btns">${pniG1(n.id)?btn(tr('city_panel.port_cost_mo_mo',{port:'1G',cost:fmt$(PNI_G1_COST),mo:fmt$(Math.round(PORT[0].pni/2))}),'pni',{city:c,net:n.id,tier:-1},'sm',S.cash<PNI_G1_COST||!portOk(c,0)):''}${PORT.map((P2,i)=>portShown(i)&&i>=pniMin(n.id)?btn(tr('city_panel.port_cost_mo_mo',{port:P2.n,cost:fmt$(1500+P2.setup/2),mo:fmt$(P2.pni)}),'pni',{city:c,net:n.id,tier:i},'sm',S.cash<1500+P2.setup/2||!portOk(c,i)):'').join('')}</div><div class="meta">${pniEta(n.id)}${pniMin(n.id)?' · '+tr('city_panel.no_10g_net_starts_at_100g',{net:esc(n.name)}):pniG1(n.id)?' · '+tr('city_panel.sells_pnis_down_to_1g'):''}</div>${chk.fee?`<div class="meta">${tr('city_panel.paid_peering_price_mo_on_top',{price:fmt$(chk.fee)})}</div>`:''}`:`<div class="why">${esc(chk.why)}</div>`;}
return h+`</div></div>`;}
function pniListHtml(c){const f=UI.pniF||'all',az=UI.pniSort==='az',open=UI.pniOpen||{};
const rows=NETS.filter(n=>n.pops.includes(c)).map(n=>{const pn=S.pni.find(x=>x.city===c&&x.net===n.id)||null;const chk=pn?null:peerOk(n.id,'pni',c),v=pn?null:pniVal(n.id,c);return {n,pn,v,chk,s:pniStat(n.id,c).k,go:!!pn||(chk.ok&&v.g>=1)};});
// The search (#199) first: a network it hides needs no value worked out.
const rows=NETS.filter(n=>n.pops.includes(c)).map(n=>[n,S.pni.find(x=>x.city===c&&x.net===n.id)||null]).filter(([n,pn])=>netKeep(n,pn)).map(([n,pn])=>{const chk=pn?null:peerOk(n.id,'pni',c),v=pn?null:pniVal(n.id,c);return {n,pn,v,chk,s:pniStat(n.id,c).k,go:!!pn||(chk.ok&&v.g>=1)};});
const keep=r=>f==='all'||(f==='t'&&(r.s==='t'||r.s==='none'))||(f==='worth'&&r.v&&r.v.worth)||(f==='pni'&&(r.s==='here'||r.s==='else'));
const val=r=>r.v?r.v.val:-Infinity;
rows.sort((a,b)=>az?a.n.name.localeCompare(b.n.name):(b.v&&b.v.worth)-(a.v&&a.v.worth)||val(b)-val(a)||a.n.name.localeCompare(b.n.name));
@ -23,7 +24,7 @@ function pniListHtml(c){const f=UI.pniF||'all',az=UI.pniSort==='az',open=UI.pniO
const shown=rows.filter(keep);if(!shown.length)return h+`<p class="empty">${tr('pni_list.nothing_matches')}</p>`;
let left=listN('pni'),tot=0;
for(const g of PNI_GRP){const gr=shown.filter(r=>pniGrpOf(r.n)===g);if(!gr.length)continue;
const w=gr.filter(r=>r.v&&r.v.worth).length,act=w||gr.some(r=>r.go),isOpen=f!=='all'||(open[g]??act);
const w=gr.filter(r=>r.v&&r.v.worth).length,act=w||gr.some(r=>r.go),isOpen=f!=='all'||netFiltered()||(open[g]??act);
h+=`<div class="pgrp">${btn(`${isOpen?'▾':'▸'} ${esc(pniGrpL(g))} <small>${trn('pni_list.n_networks_w_worth_it',gr.length,{w})}</small>`,'pniGrp',{g,o:isOpen?0:1},'ghost sm')}</div>`;
if(!isOpen)continue;tot+=gr.length;
for(const r of gr){if(left--<=0)break;h+=pniRow(c,r.n,r.pn,r.v,r.chk);}}

View file

@ -26,5 +26,13 @@ function utilitiesModal(city,message){if(!S)return;const cities=Object.keys(S.po
${ppol()!=='open'?`<p class="why">${tr('link_panels.off_while_your_peering_policy_is',{pol:tr(PPOL_N[ppol()])})}</p>${btn(tr('common.peering_policy'),'leftTab',{t:'nets'},'ghost sm')}`:''}
${rows.map(r=>`<details><summary>${esc(ixName(r.ix))} · ${tr('utilities.peer_counts',{ready:r.requests.length,existing:r.existing,blocked:r.blocked.length})}</summary>
${r.blocked.map(b=>`<p class="meta"><b>${esc(NET[b.id].name)}</b>: ${esc(b.why)}</p>`).join('')}</details>`).join('')}</section>
${utilityKitAllHtml(city)}${popTierAllHtml(city)}
${cities.length?`<section><label for="utilityCity">${tr('common.your_pop')}</label><div class="btns"><select id="utilityCity" style="max-width:100%">${cities.map(c=>`<option value="${c}"${c===city?' selected':''}>${esc(CITY[c].name)}</option>`).join('')}</select>${btn(tr('utilities.view_pop'),'utilityPick',{},'sm')}</div></section>${utilityKitHtml(city,true)}`:''}`);
}
// The kit everywhere (#317), and where new POPs get it: the intern's template, which the intern clicks through.
function utilityKitAllHtml(city){const q=utilityKitAll();if(!q)return '';const tpl=opsHired()&&S.ops.tpl.kit;
return `<section><h3>${tr('utilities.kit_everywhere')}</h3><p class="lead">${tr('utilities.kit_everywhere_note')}</p>
${q.cities.length?`<p class="meta">${trn('utilities.kit_all_quote',q.cities.length,{cost:fmt$(q.cost),mo:fmt$(q.mo)})}${q.moves?' · '+tr('utilities.cache_moves',{n:q.moves}):''}</p>
<div class="btns">${btn(trn('utilities.kit_all_apply',q.cities.length,{cost:fmt$(q.cost)}),'utilityKitAll',{cost:q.cost,city},'pink',S.cash<q.cost)}</div>`:`<p class="meta">${tr('utilities.kit_all_done')}</p>`}
<p class="note">${opsHired()?(tpl?tr('utilities.kit_new_pops_on',{name:opsName()}):tr('utilities.kit_new_pops_off',{name:opsName()})):tr('utilities.kit_new_pops_hire')}</p>
${opsHired()?`<div class="btns">${btn(tpl?tr('utilities.kit_new_pops_stop'):tr('utilities.kit_new_pops_start'),'utilityKitNew',{city},tpl?'ghost sm':'sm')}</div>`:''}</section>`;}

View file

@ -16,16 +16,19 @@ function ixBlock(c,multi){const city=ixCity(c),C=CITY[city],ix=ixName(c),X=XIXM[
else h+=`<div class="btns">${PORT.map((P2,i)=>i>S.ixp[c]&&portShown(i)?btn(tr('common.upgrade_port_price',{port:P2.n,price:portMo(ixPortMo(c,i)*((S.ixn||{})[c]||1))}),'buyIx',{city:c,tier:i},'sm',(!!S.pops[city]&&!portOk(city,i))||(!S.pops[city]&&i>1)):'').join('')}${S.pops[city]&&((S.ixn||{})[c]||1)<LAG_MAX?btn(tr('common.lag_member_price',{price:portMo(ixPortMo(c,S.ixp[c]))}),'lagIx',{city:c,d:1},'sm',S.cash<ixPortMo(c,S.ixp[c])):''}${((S.ixn||{})[c]||1)>1?btn(tr('common.member'),'lagIx',{city:c,d:-1},'ghost sm'):''}${S.ixp[c]>0?btn(tr('link_panels.downgrade_port_price',{port:PORT[S.ixp[c]-1].n,price:portMo(ixPortMo(c,S.ixp[c]-1)*((S.ixn||{})[c]||1))}),'downIx',{city:c},'ghost sm'):''}${btn(S.rs[c]?tr('link_panels.leave_route_server'):tr('link_panels.join_route_server'),'rs',{city:c},S.rs[c]?'ghost sm':'pink sm')}${S.rs[c]&&ppol()!=='open'?`<span class="meta">${tr('link_panels.off_while_your_peering_policy_is',{pol:tr(PPOL_N[ppol()])})}</span>`:''}${btn(UI.confirm==='ix'+c?tr('common.really_leave'):tr('common.leave_ix'),'cancelIx',{city:c},'ghost sm')}</div>`;
h+=`<div style="margin-top:8px">`;
{const elig=mine?[]:ixMembers(c).filter(id=>!set.has(id)&&peerOk(id,'ix',c).ok);if(elig.length>1)h+=`<div class="btns">${btn(tr('link_panels.request_all_n_willing_peers',{n:elig.length}),'peerAll',{city:c},'pink sm')}</div>`;}
for(const id of ixMembers(c).sort((a,b)=>NSH[b]-NSH[a])){const n=NET[id],on=set.has(id),viaRs=on&&!S.peers[id+'@'+c]&&!mine,chk=peerOk(id,'ix',c);
{const ms=ixMembers(c),shown=ms.filter(id=>netKeep(NET[id],set.has(id)));if(ms.length&&!shown.length)h+=netNone();}
for(const id of ixMembers(c).filter(id=>netKeep(NET[id],set.has(id))).sort((a,b)=>NSH[b]-NSH[a])){const n=NET[id],on=set.has(id),viaRs=on&&!S.peers[id+'@'+c]&&!mine,chk=peerOk(id,'ix',c);
h+=`<div class="row">${logo(n)}<div class="grow"><div class="nm">${esc(n.name)}</div><div class="meta"><span class="tag ${n.type}">${TYPE_L[n.type]}</span> <span class="tag ${n.pol}">${n.pol}</span> · ${(NSH[id]*100).toFixed(NSH[id]<0.01?1:0)}%${n.tail?' <span class="tag st">'+tr('common.tiny')+'</span>':''}</div>${!on&&!chk.ok?`<div class="why">${esc(chk.why)}</div>`:''}</div>
${on?(viaRs||mine?`<span class="tag st on">${mine?tr('common.member_fef5'):tr('common.via_rs')}</span>`:btn(tr('common.peered_ce2f'),'unpeer',{city:c,net:id},'green sm',false,tr('link_panels.click_to_tear_down'))):btn(tr('common.request'),'peer',{city:c,net:id},'sm',!chk.ok)}</div>`;}
h+=`</div>`;}
h+=`</section>`;return h;
}
function borderSection(l){const w=borderShut(l);return w?`<section><h3 style="color:var(--bad)">${tr('link_panels.border_closed')}</h3><p class="lead">${w==='gulf'?tr('link_panels.a_diplomatic_spat_has_closed_the')+' '+tr('link_panels.back_in_n_days',{n:S.ev.gulf-S.day}):tr('link_panels.russia_has_unplugged_itself_from_the')}</p></section>`:'';}
// Both ends of a link in its panel header open that city (#196), say to upgrade the router there for a bigger wave.
const lkEnds=l=>[l.a,l.b].map(c=>cityOn(c)?btn(esc(CITY[c].name),'popGo',{city:c},'clink'):esc(CITY[c].name)).join(' ⇄ ');
function vxcPanel(l){
const load=R.load[l.id]||0,cap=VXC[l.vt].g,u=load/cap,down=linkDown(l),f=FAB[l.prov];
let h=`<div class="ph"><div><div class="eyebrow">${tr('link_panels.virtual_circuit_name_km_km',{name:esc(f.name),km:l.km.toLocaleString()})}</div><h2>${CITY[l.a].name} ⇄ ${CITY[l.b].name}</h2></div><button class="x" data-act="closePanel" aria-label="${tr('common.close')}">×</button></div><div class="scroll">`;
let h=`<div class="ph"><div><div class="eyebrow">${tr('link_panels.virtual_circuit_name_km_km',{name:esc(f.name),km:l.km.toLocaleString()})}</div><h2>${lkEnds(l)}</h2></div><button class="x" data-act="closePanel" aria-label="${tr('common.close')}">×</button></div><div class="scroll">`;
h+=borderSection(l);if(down&&!borderShut(l))h+=`<section><h3 style="color:var(--bad)">${tr('common.fabric_outage')}</h3><p class="lead">${tr('link_panels.name_is_down_nothing_you_can',{name:esc(f.name)})}</p></section>`;
h+=`<section><h3>${tr('common.capacity')}</h3><div class="kv"><span>${tr('link_panels.name_circuit',{name:VXC[l.vt].n})}</span><b>${fmtG(load)} / ${fmtG(cap)}</b></div><div class="bar ${barCls(u)}"><i style="width:${Math.min(100,u*100)}%"></i></div>
<div class="kv"><span>${tr('common.monthly')}</span><b>${tr('common.price_mo',{price:fmt$(l.mo)})}</b></div>${!S.pops[l.b]?`<p class="note">${tr('link_panels.remote_peering_leg_into_ix',{ix:esc(CITY[l.b].ix)})}</p>`:''}
@ -114,7 +117,7 @@ function layPanel(l){const d=S.day,st=layStart(l),q=layQuote(l),km=Math.round(la
return h;}
function dfPanel(l){
const load=R.load[l.id]||0,cap=dfCap(l),u=cap?load/cap:0,bld=l.ready>S.day,A=CITY[l.a].name,B=CITY[l.b].name,inc=S.inc.find(i=>i.ref===l.id||i.ref===(l.trench||l.id)),amps=ampCount(l.km),sysD=DF_SYS[l.sys];
let h=`<div class="ph"><div><div class="eyebrow">${tr('link_panels.dark_fiber_kind_km_km',{kind:l.own?tr('link_panels.your_own_build'):tr('common.leased_iru'),km:l.km.toLocaleString()})}</div><h2>${A} ⇄ ${B}</h2></div><button class="x" data-act="closePanel" aria-label="${tr('common.close')}">×</button></div><div class="scroll">`;
let h=`<div class="ph"><div><div class="eyebrow">${tr('link_panels.dark_fiber_kind_km_km',{kind:l.own?tr('link_panels.your_own_build'):tr('common.leased_iru'),km:l.km.toLocaleString()})}</div><h2>${lkEnds(l)}</h2></div><button class="x" data-act="closePanel" aria-label="${tr('common.close')}">×</button></div><div class="scroll">`;
if(bld){const tot=Math.max(1,l.ready-l.day),done=clamp((S.day-l.day)/tot,0,1);
h+=`<section><h3>${l.own?tr('common.under_construction'):tr('common.being_spliced')}</h3><div class="kv"><span>${l.own?tr('link_panels.permits_trenching_splicing'):tr('common.iru_handover')}</span><b>${tr('common.n_days_left',{n:l.ready-S.day})}</b></div><div class="bar me"><i style="width:${done*100}%"></i></div>${l.own&&l.sub?layPanel(l):l.own?`<div class="btns">${btn(tr('link_panels.hire_extra_crews_price_30_days',{price:fmt$(crewCost(l))}),'crews',{id:l.id},'sm',!crewSteps(l)||S.cash<crewCost(l))}${btn(trn('link_panels.all_crews_done_in_n_days_price',Math.max(1,crewFloor(l)-S.day),{price:fmt$(crewSteps(l)*crewCost(l))}),'crews',{id:l.id,all:1},'sm',!crewSteps(l)||S.cash<crewSteps(l)*crewCost(l))}</div>${!crewSteps(l)&&l.ready>S.day+1?`<p class="note">${tr('link_panels.crews_can_halve_a_build_at_most')}</p>`:''}`:''}<p class="note">${tr('link_panels.you_can_pre_install_optics_now')}</p></section>`;}
else if(inc&&linkDown(l))h+=`<section><h3 style="color:var(--bad)">${tr('common.dark_6bf5')}</h3><p class="lead">${esc(inc.msg)}</p>${shipNote(inc)}${inc.cost?btn(`${esc(inc.fix||tr('common.rush_repair'))} ${fmt$(inc.cost)}`,'fixInc',{id:inc.id},'red',S.cash<inc.cost):''}</section>`;
@ -142,14 +145,14 @@ function dfPanel(l){
}
function offersHere(c){
const os=S.offers.filter(o=>bCities(o).includes(c));if(!os.length)return '';
return `<section><h3>${tr('common.offers_here')}</h3>${os.map(o=>`<div class="row${o.id===UI.offerAt?' on':''}"><div class="grow"><div class="nm">${esc(o.name)}</div><div class="meta">${esc(BIZ_T[o.type].l)}${o.city2?` ${CITY[o.city].name} ⇄ ${CITY[o.city2].name}`:''} · ${bTerms(o)} · ${tr('ui.n_d_left',{n:o.exp-S.day})}</div>${spotWhy(o)}${R.reach<0.99&&!BIZ_T[o.type].l2?`<div class="why">${tr('link_panels.they_need_the_full_internet_your',{pct:pct(R.reach)})}</div>`:''}${o.type==='scrub'&&!hasScrub()?`<div class="why">${tr('link_panels.needs_your_own_scrubbing_center')}</div>`:''}${bRisk(o)}${reqList(o)}${bHas(o)?'':`<div class="why">${tr('link_panels.needs_a_pop_in_cities_too',{cities:bCities(o).filter(x=>!S.pops[x]).map(x=>CITY[x].name).join(', ')})}</div>`}</div>${bHas(o)?btn(tr('common.accept'),'accept',{id:o.id},'green sm'):''}${btn(tr('common.no'),'decline',{id:o.id},'ghost sm')}</div>`).join('')}</section>`;
return `<section><h3>${tr('common.offers_here')}</h3>${os.map(o=>`<div class="row${o.id===UI.offerAt?' on':''}"><div class="grow"><div class="nm">${esc(o.name)}</div><div class="meta">${esc(BIZ_T[o.type].l)}${o.city2?` ${CITY[o.city].name} ⇄ ${CITY[o.city2].name}`:''} · ${bTerms(o)} · ${tr('ui.n_d_left',{n:o.exp-S.day})}</div>${spotWhy(o)}${R.reach<0.99&&!BIZ_T[o.type].l2?`<div class="why">${tr('link_panels.they_need_the_full_internet_your',{pct:pct(R.reach)})}</div>`:''}${o.type==='scrub'&&!hasScrub()?`<div class="why">${tr('link_panels.needs_your_own_scrubbing_center')}</div>`:''}${bRisk(o)}${reqList(o)}${reqFixHtml(o)}${bHas(o)?'':`<div class="why">${tr('link_panels.needs_a_pop_in_cities_too',{cities:bCities(o).filter(x=>!S.pops[x]).map(x=>CITY[x].name).join(', ')})}</div>`}</div>${bHas(o)?btn(tr('common.accept'),'accept',{id:o.id},'green sm'):''}${btn(tr('common.no'),'decline',{id:o.id},'ghost sm')}</div>`).join('')}</section>`;
}
function linkPanel(id){
const l=S.links.find(x=>x.id===id);if(!l){UI.sel=null;return '';}
if(l.kind==='vxc')return vxcPanel(l);
if(l.kind==='df')return dfPanel(l);
const load=R.load[l.id]||0,cap=LT[l.tier].g,u=load/cap,cut=l.cut>S.day,trk=l.trench||l.id,inc=S.inc.find(i=>(LINKCUT_TR.includes(i.type)&&i.ref===trk)||((i.type==='fatwave'||i.type==='label'||i.type==='mtu')&&i.ref===l.id)),sib=pairLinks(l.a,l.b).filter(x=>x!==l&&x.kind!=='vxc'),mates=sib.filter(x=>(x.trench||x.id)===trk);
let h=`<div class="ph"><div><div class="eyebrow">${l.cable?esc(CAB[l.cable].name):l.sub?tr('common.subsea_cable'):tr('common.terrestrial_fiber')} · ${l.km.toLocaleString()} km</div><h2>${CITY[l.a].name} ⇄ ${CITY[l.b].name}</h2></div><button class="x" data-act="closePanel" aria-label="${tr('common.close')}">×</button></div><div class="scroll">`;
let h=`<div class="ph"><div><div class="eyebrow">${l.cable?esc(CAB[l.cable].name):l.sub?tr('common.subsea_cable'):tr('common.terrestrial_fiber')} · ${l.km.toLocaleString()} km</div><h2>${lkEnds(l)}</h2></div><button class="x" data-act="closePanel" aria-label="${tr('common.close')}">×</button></div><div class="scroll">`;
if(cut)h+=`<section><h3 style="color:var(--bad)">${tr('common.cut_2e50')}</h3><p class="lead">${inc?esc(inc.msg):''} ${inc&&shipSea(inc)?'':tr('link_panels.back_in_n_days',{n:l.cut-S.day})}</p>${shipNote(inc)}${inc&&inc.cost?btn(`${esc(inc.fix||tr('common.rush_repair'))} ${fmt$(inc.cost)}`,'fixInc',{id:inc.id},'red',S.cash<inc.cost):''}</section>`;
h+=borderSection(l);
h+=`<section><h3>${tr('common.capacity')}</h3><div class="kv"><span>${tr('link_panels.name_wave',{name:LT[l.tier].n})}</span><b>${fmtG(load)} / ${fmtG(cap)}</b></div><div class="bar ${barCls(u)}"><i style="width:${Math.min(100,u*100)}%"></i></div>

View file

@ -2741,6 +2741,12 @@
"lifecycle.odd_wireguard":"They are going fully remote. All 40 staff will run WireGuard from their kitchens, and the office line is just for the plants.",
"lifecycle.odd_wrong_blue":"The new office manager wants every cable the same colour, and yours is the wrong blue.",
"lifecycle.referred_by":"Referred by {name}, one of your happiest customers.",
"lifecycle.ren_diverse":"two diverse paths",
"lifecycle.ren_lat":"latency within {max} ms (now {now})",
"lifecycle.ren_no_subsea":"no subsea cable",
"lifecycle.ren_per_g":"{was} → {price} per Gbps",
"lifecycle.ren_sites_traffic":{"one":"{n} site × {bw} booked, {srv} served","other":"{n} sites × {bw} booked, {srv} served"},
"lifecycle.ren_traffic":"{bw} booked, {srv} served",
"lifecycle.renewal_haggle":"renewal on {date}: haggling",
"lifecycle.renewals":"Renewals",
"lifecycle.renewals_soon":"Renewals",
@ -3164,6 +3170,9 @@
"modal_and_names.the_real_thing_follow_a_packet":"The real thing: follow a packet from Wi-Fi to undersea fiber.",
"modals.lay_your_own_subsea_cable":"Lay your own subsea cable…",
"modals.your_own_subsea_cable_level_n":"Your own subsea cable <small>level {n} or Tier 1</small>",
"net_filter.clear":"Clear",
"net_filter.connected_only":"Connected only",
"net_filter.find_a_network":"Find a network or AS number",
"networks.a_mobile_network_named_after_the":"A mobile network named after the sound of a toast. Cheers to every 5G tower.",
"networks.a_spanish_carrier_starring_in_every":"A Spanish carrier starring in every Latin American market, at least until it sells the next one.",
"networks.a_tiny_telco_in_a_country":"A tiny telco in a country where the world’s cables come ashore. Prices to match.",
@ -3399,6 +3408,7 @@
"ops.ops":"Ops",
"ops.ops_name":"Ops · {name}",
"ops.p_at":"Above",
"ops.p_fresh":"Light new fiber",
"ops.p_g":"From",
"ops.p_how":"How",
"ops.p_keep":"Keep one spare",
@ -3930,6 +3940,29 @@
"pop_std.none":"None",
"pop_std.not_all_of_the_standard":"Not enough cash or level for the whole standard in {city}: it got what fit.",
"pop_std.standard_for_new_pops":"Standard for new POPs",
"pop_tiers.apply_cost":"Bring it up <small>{cost}</small>",
"pop_tiers.bring_up_n":{"one":"Bring {n} POP up <small>{cost}</small>","other":"Bring {n} POPs up <small>{cost}</small>"},
"pop_tiers.bulk_done":{"one":"{kind}: {n} POP brought up to the standard.","other":"{kind}: {n} POPs brought up to the standard."},
"pop_tiers.bulk_note":"Every POP you marked as a kind, brought up to its standard in one go. Change a standard (a new model, more routers) and press again.",
"pop_tiers.city_is_kind":"{city} meets the {kind} standard.",
"pop_tiers.hub":"Regional hub",
"pop_tiers.mark":"Mark it",
"pop_tiers.medium":"Medium POP",
"pop_tiers.meets_it":"Meets it",
"pop_tiers.micro":"Micro POP",
"pop_tiers.model_locked":"{model} unlocks at customer level {lv}.",
"pop_tiers.n_below":{"one":"{n} below the standard","other":"{n} below the standard"},
"pop_tiers.n_pops":{"one":"{n} POP","other":"{n} POPs"},
"pop_tiers.n_stuck":{"one":"{n} can't take it yet","other":"{n} can't take it yet"},
"pop_tiers.no_kind":"No kind yet",
"pop_tiers.not_all":"Not all of the standard went in at {city}. Check the Infra tab.",
"pop_tiers.not_set":"not set yet",
"pop_tiers.note":"Save a POP's routers as a standard, then mark other POPs as that kind. Bringing a POP up adds routers and swaps to the bigger model, never a step down. Utilities brings every POP of a kind up at once.",
"pop_tiers.save_here":"Save these routers",
"pop_tiers.saved":"{kind} is now {desc}.",
"pop_tiers.swapped_today":"The routers here were swapped today. Try again tomorrow.",
"pop_tiers.this_pop_is":"This POP: {kind}",
"pop_tiers.title":"POP standards",
"pops_transit_ix.40_off_for_6_months":"40% off for 6 months",
"pops_transit_ix.40_off_ix_for_6_months":"<b>40% off {ix} for 6 months.</b><br>Your account manager is relieved. Read the small print later.",
"pops_transit_ix.after_consulting_with_management_the":"<b>\"After consulting with management…\"</b><br>The price went up. Management was consulted.",
@ -4197,6 +4230,12 @@
"release_notes.read_the_full_notes_on_github":"Read the full notes on GitHub",
"release_notes.series_of_tubes_v_is_out":"Series of Tubes {v} is out!",
"release_notes.your_game_is_saved_automatically":"Your game is saved automatically.",
"req_fix.bought":"Bought {list} for {cost}.",
"req_fix.buy_and_sign":"Buy it and sign <small>{cost}</small>",
"req_fix.buys_list":"Missing: {list}. {cost} + {mo}/mo.",
"req_fix.generator_in_city":"a backup generator in {city}",
"req_fix.second_router_in_city":"a second router in {city}",
"req_fix.second_site_in_city":"a second site in {city}",
"requirements.a_spare_fiber_pair_in_your":"a spare fiber pair in your {a}–{b} trench",
"requirements.afraid_of_sharks_needs_a_path":"Afraid of sharks: needs a path with no subsea cable",
"requirements.backup_generator_in_every_city_they":"Backup generator in every city they touch",
@ -4831,9 +4870,20 @@
"utilities.caches_requested":"Installed {n} cache boxes in {city}.",
"utilities.ix_peering":"Network-wide IX peering",
"utilities.join_route_servers":"Join all route servers ({n})",
"utilities.kit_all_applied":{"one":"Redundancy kit installed at {n} POP.","other":"Redundancy kit installed at {n} POPs."},
"utilities.kit_all_apply":{"one":"Kit {n} POP <small>{cost}</small>","other":"Kit all {n} POPs <small>{cost}</small>"},
"utilities.kit_all_done":"Every POP has the full kit.",
"utilities.kit_all_quote":{"one":"{n} POP needs it · {cost} + {mo}/mo","other":"{n} POPs need it · {cost} + {mo}/mo"},
"utilities.kit_applied":"Redundancy updated in {city}.",
"utilities.kit_balanced":"Hardware installed and caches balanced.",
"utilities.kit_cost":"One-off: {cost} · Additional monthly cost: {mo}",
"utilities.kit_everywhere":"Redundancy kit everywhere",
"utilities.kit_everywhere_note":"The kit at every POP still missing part of it: generator, second building, second router, caches balanced between sites. One price for all of them.",
"utilities.kit_new_pops_hire":"Hire a NOC intern to open new POPs from a template with the kit already in.",
"utilities.kit_new_pops_off":"New POPs opened from {name}'s template come without the kit.",
"utilities.kit_new_pops_on":"New POPs opened from {name}'s template get the kit too.",
"utilities.kit_new_pops_start":"Put the kit in the template",
"utilities.kit_new_pops_stop":"Leave it out of the template",
"utilities.peer_counts":"{ready} eligible · {existing} existing · {blocked} unavailable",
"utilities.peering_note":"Request eligible peers at every IX you have joined. Existing sessions, including route-server peers, are skipped. Refusals and traffic thresholds still apply. No ports or paid PNIs are purchased.",
"utilities.peers_requested":"Established {n} new IX peering sessions.",

View file

@ -49,6 +49,8 @@ section h3{font-size:17px;margin-bottom:6px;display:flex;align-items:center;gap:
.b.green{background:var(--ok);color:#fff}
.b.sm{font-size:12px;padding:2px 8px 1px;border-radius:9px;box-shadow:0 2px 0 var(--ink)}
.b.big{font-size:18px;padding:7px 18px 5px}
/* A city name in a heading that opens the city (link panels, #196): reads as the heading, underlined like a link. */
.b.clink,.b.clink:active{font:inherit;color:inherit;background:none;border:0;box-shadow:none;transform:none;padding:2px 0;border-radius:0;white-space:normal;text-align:left;text-decoration:underline;text-decoration-thickness:2px;text-underline-offset:4px;text-decoration-color:var(--me)}
.b small{font-family:var(--body);font-weight:800;font-size:10.5px;opacity:.85;margin-left:3px}
.logo{width:30px;height:30px;border-radius:50%;background:var(--c);border:2.5px solid var(--ink);display:grid;place-items:center;color:#fff;font-family:var(--display);font-weight:800;font-size:11px;flex:none;letter-spacing:-.02em}

View file

@ -0,0 +1,5 @@
/* Find a network at a POP (#199) and the POP standards rows (#315). */
.netf{display:flex;flex-direction:column;gap:6px;margin:0 0 10px}
.netf input.t{font-size:16px;padding:6px 10px;min-height:44px}
.netf .btns{margin:0}
.ptier .row .btns{margin-top:4px}

226
tests/bulk-actions.test.js Normal file
View file

@ -0,0 +1,226 @@
// Late-game busywork: one policy or one button instead of many clicks, never a decision taken away.
// #316 the intern can leave new fiber dark, #119 the link panel stays open on a sibling, #317 the kit at every POP,
// #241 buy what a customer needs on signing, #315 POP standards by kind, #199 find a network at a POP.
const test = require('node:test');
const assert = require('node:assert/strict');
const { load } = require('./harness');
const { lit } = require('../scripts/lib/js-literal');
function setup(t, extra = '') {
const h = load();
t.after(() => h.dom.window.close());
h.ev("ACT.start({});S.cash=1e8;for(const g of GOALS)S.done[g.id]=0;S.nextFail=S.nextEvent=1e9;UI.speed=0;compute();" + extra);
return h;
}
const doc = h => h.dom.window.document;
const text = (h, sel) => [...doc(h).querySelectorAll(sel)].map(e => e.textContent).join('\n');
const reload = ev => ev("save();S=migrate(JSON.parse(slotRaw(UI.slot)));compute()");
/* ---------- #316: new fiber stays dark when the player says so ---------- */
const FIBER = "S.lvl=4;S.rules=makeRules('freeze');ACT.launchBB({city:'fra'});S.pops.fra.rgen=2;ACT.buildPop({city:'ams'});S.pops.ams.rgen=2;compute();" +
"ACT.opsHire({id:'kevin'});S.ops.floor=0;closeModal();" +
"S.links.push({id:'f',a:'fra',b:'ams',kind:'df',sys:'roadm',ch:[],km:450,sub:false,ready:0,cut:0,mo:1,trench:'f'});compute();S.ops.on.optics=true;";
const ch = ev => JSON.parse(ev("JSON.stringify(S.links.find(l=>l.id==='f').ch)"));
test('#316 by default the intern still lights new fiber, also in a save from before the switch', t => {
const { ev, errors } = setup(t, FIBER);
assert.equal(ev("opsP('optics','fresh')"), true);
ev("S.ops.p.optics={}");
reload(ev);
assert.equal(ev("opsP('optics','fresh')"), true, 'an old save has no setting: the old behaviour');
ev('opsDay(S.day)');
assert.ok(ch(ev).length > 0);
assert.deepEqual(errors, []);
});
test('#316 told not to, the intern leaves new fiber dark but still grows hot lit fiber', t => {
const { ev, errors } = setup(t, FIBER);
ev("ACT.opsOpen();ACT.opsParam({k:'optics',p:'fresh',v:1})");
assert.equal(ev("opsP('optics','fresh')"), false);
ev('opsDay(S.day)');
assert.deepEqual(ch(ev), [], 'dark fiber stays dark');
ev("S.links.find(l=>l.id==='f').ch=['zr8'];compute();R.load.f=dfCap(S.links.find(l=>l.id==='f'))*0.95;opsDay(S.day)");
assert.ok(ch(ev).length > 1, 'a lit, hot fiber still gets more optics');
reload(ev);
assert.equal(ev("opsP('optics','fresh')"), false, 'the switch survives a reload');
ev("S.ops.p.optics.fresh='maybe';S=migrate(JSON.parse(JSON.stringify(S)))");
assert.equal(ev("opsP('optics','fresh')"), true, 'a bad value is repaired to the default');
assert.deepEqual(errors, []);
});
test('#316 the switch is in the Ops sheet', t => {
const h = setup(t, FIBER);
h.ev('ACT.opsOpen()');
assert.match(h.ev("document.getElementById('modalCard').textContent"), /Light new fiber/);
assert.deepEqual(h.errors, []);
});
/* ---------- #119: decommissioning one of several waves keeps the panel open ---------- */
test('#119 the link panel moves on to the next parallel link, and closes after the last', t => {
const h = setup(t, "ACT.buildPop({city:'ams'});" +
"for(const id of ['w1','w2','w3'])S.links.push({id,a:'fra',b:'ams',kind:'wave',tier:0,km:450,sub:false,cut:0,mo:1000});compute();UI.sel={type:'link',id:'w1'};renderAll()");
const { ev, errors } = h;
ev("ACT.rmLink({id:'w1'});ACT.rmLink({id:'w1'})");
assert.equal(ev("S.links.some(l=>l.id==='w1')"), false);
assert.equal(ev('JSON.stringify(UI.sel)'), JSON.stringify({ type: 'link', id: 'w2' }));
assert.equal(ev("document.getElementById('panel').hidden"), false, 'the panel is still open');
ev("ACT.rmLink({id:'w2'});ACT.rmLink({id:'w2'})");
assert.equal(ev('UI.sel.id'), 'w3');
ev("ACT.rmLink({id:'w3'});ACT.rmLink({id:'w3'})");
assert.equal(ev('UI.sel'), null, 'the last link closes it');
assert.deepEqual(errors, []);
});
/* ---------- #317: the redundancy kit at every POP ---------- */
const POPS = "for(const c of ['ams','lon','par'])ACT.buildPop({city:c});compute();";
test('#317 one button kits every POP, at the sum of the per-POP quotes', t => {
const { ev, errors } = setup(t, POPS + 'S.lvl=2;');
const q = JSON.parse(ev('JSON.stringify(utilityKitAll())'));
assert.equal(q.cities.length, 4);
assert.equal(q.cost, ev("Object.keys(S.pops).reduce((a,c)=>a+utilityKit(c).cost,0)"));
ev("ACT.utilities({})");
assert.match(ev("document.getElementById('modalCard').textContent"), /Kit all 4 POPs/);
const cash = ev('S.cash');
ev(`ACT.utilityKitAll({cost:${q.cost + 1}})`);
assert.equal(ev('S.cash'), cash, 'a stale quote buys nothing');
assert.match(ev("document.getElementById('modalCard').textContent"), /quote changed/);
ev(`ACT.utilityKitAll({cost:${q.cost}})`);
assert.equal(ev('S.cash'), cash - q.cost);
assert.equal(ev("Object.values(S.pops).every(p=>p.gen&&p.site2&&p.routers>=2)"), true);
assert.match(ev("document.getElementById('modalCard').textContent"), /Every POP has the full kit/);
assert.deepEqual(errors, []);
});
test('#317 needs level 2, never spends what is not there, and can put the kit in the intern\'s template', t => {
const { ev, errors } = setup(t, POPS);
ev('S.lvl=1;ACT.utilities({})');
assert.equal(ev('utilityKitAll()'), null);
assert.doesNotMatch(ev("document.getElementById('modalCard').textContent"), /Redundancy kit everywhere/);
ev('S.lvl=2;window.q=utilityKitAll().cost;S.cash=q-1;ACT.utilityKitAll({cost:q})');
assert.equal(ev('S.cash'), ev('q-1'));
assert.equal(ev("Object.values(S.pops).some(p=>p.gen)"), false);
ev("S.cash=1e8;ACT.opsHire({id:'annie'});closeModal();S.ops.tpl.kit=false;ACT.utilities({})");
assert.match(ev("document.getElementById('modalCard').textContent"), /come without the kit/);
ev('ACT.utilityKitNew({})');
assert.equal(ev('S.ops.tpl.kit'), true);
assert.match(ev("document.getElementById('modalCard').textContent"), /get the kit too/);
assert.deepEqual(errors, []);
});
/* ---------- #241: buy what the customer asks for, on signing ---------- */
const OFFER = (reqs, extra = {}) => `ACT.buildPop({city:'ams'});S.offers.push(${lit({ id: 'o1', city: 'fra', city2: 'ams', name: 'Needy Corp', type: 'l2vpn', bw: 1, rate: 900, reqs, exp: 30, ...extra })});compute();`;
test('#241 the offer shows what is missing with its price, and one button buys it and signs', t => {
const h = setup(t, OFFER(['gen', 'routers']));
const { ev, errors } = h;
const q = JSON.parse(ev("JSON.stringify(reqFix(S.offers[0]))"));
assert.deepEqual(q.items.map(x => x.k + '@' + x.city), ['gen@fra', 'gen@ams', 'routers@fra']);
assert.equal(q.cost, ev("2*GEN_COST+routerCost(0,1)"));
ev("UI.left='deals';UI.leftOpen=true;window.innerWidth=390;renderAll()");
const card = text(h, '#left');
assert.match(card, /Missing: a backup generator in Frankfurt, a backup generator in Amsterdam, a second router in Frankfurt/);
assert.match(card, /Buy it and sign/);
assert.ok(doc(h).querySelector('[data-act="acceptFix"]'), 'the button is there on a phone');
const cash = ev('S.cash');
ev(`ACT.acceptFix({id:'o1',cost:${q.cost}})`);
assert.equal(ev('S.cash'), cash - q.cost);
assert.equal(ev("S.pops.fra.gen&&S.pops.ams.gen&&S.pops.fra.routers===2"), true);
assert.equal(ev("S.biz.some(b=>b.id==='o1')&&!S.offers.length"), true, 'signed');
assert.equal(ev("reqOk(S.biz.find(b=>b.id==='o1'))"), true, 'and every requirement is met');
assert.deepEqual(errors, []);
});
test('#241 never silent: a stale price, too little cash or a deal that cannot be signed buys nothing', t => {
const { ev, errors } = setup(t, OFFER(['metro']));
const cost = ev("reqFix(S.offers[0]).cost");
assert.equal(cost, ev('2*SITE2_COST'));
ev(`ACT.acceptFix({id:'o1',cost:${cost - 1}})`);
assert.equal(ev("!!S.pops.fra.site2||S.biz.length>0"), false);
ev(`S.cash=${cost - 1};ACT.acceptFix({id:'o1',cost:${cost}})`);
assert.equal(ev("!!S.pops.fra.site2||S.biz.length>0"), false);
ev(`S.cash=1e8;S.offers[0].city2='lon';ACT.acceptFix({id:'o1',cost:${cost}})`);
assert.equal(ev("!!S.pops.fra.site2||S.biz.length>0"), false, 'no POP in London: nothing is bought');
assert.equal(ev("reqFixHtml(S.offers[0])"), '');
ev("S.offers[0].city2='ams';S.offers[0].reqs=['nocog']");
assert.equal(ev("reqFix(S.offers[0])"), null, 'only hardware at a POP is offered');
assert.deepEqual(errors, []);
});
/* ---------- #315: POP standards by kind ---------- */
test('#315 save a standard, bring a POP up to it, then every POP of that kind at once', t => {
const h = setup(t, POPS + "S.lvl=4;S.pops.fra.routers=2;S.pops.fra.rgen=1;compute();");
const { ev, errors } = h;
ev("UI.sel={type:'city',id:'fra'};UI.tab='links';window.innerWidth=390;renderAll()");
assert.match(text(h, '#panel'), /POP standards/);
assert.match(text(h, '#panel'), /Regional hub/);
ev("ACT.ptSave({city:'fra',k:'medium'})");
assert.equal(ev("JSON.stringify(S.popTiers.def.medium)"), JSON.stringify({ g: 1, rt: 2 }));
assert.equal(ev('S.popTiers.at.fra'), 'medium');
const q = JSON.parse(ev("JSON.stringify(ptPlan('ams','medium'))"));
assert.deepEqual(q.steps, ['swap', 'add'], 'an empty POP swaps first, then adds');
const cash = ev('S.cash');
ev(`ACT.ptApply({city:'ams',k:'medium',cost:${q.cost}})`);
assert.equal(ev('S.cash'), cash - q.cost, 'charged exactly the quote');
assert.equal(ev("S.pops.ams.routers===2&&S.pops.ams.rgen===1&&S.popTiers.at.ams==='medium'"), true);
// The standard grows: one button brings both medium POPs up.
ev("S.pops.fra.routers=3;S.pops.fra.rgen=2;S.pops.fra.rupDay=-1;ACT.ptSave({city:'fra',k:'medium'});S.pops.fra.routers=2;S.pops.fra.rgen=1;S.pops.ams.rupDay=-1;compute()");
const A = JSON.parse(ev("JSON.stringify({n:ptAll('medium').todo.length,cost:ptAll('medium').cost})"));
assert.equal(A.n, 2);
ev('ACT.utilities({})');
assert.match(ev("document.getElementById('modalCard').textContent"), /Bring 2 POPs up/);
ev(`ACT.ptAll({k:'medium',cost:${A.cost}})`);
assert.equal(ev("['fra','ams'].every(c=>S.pops[c].routers===3&&S.pops[c].rgen===2)"), true);
assert.equal(ev("ptAll('medium').todo.length"), 0);
assert.deepEqual(errors, []);
});
test('#315 a busy lone router gets its partner before the swap, and never a step down', t => {
const { ev, errors } = setup(t, POPS + "S.lvl=4;ACT.launchBB({city:'ams'});S.popTiers.def.hub={g:2,rt:2};S.popTiers.def.micro={g:0,rt:1};compute();");
assert.deepEqual(JSON.parse(ev("JSON.stringify(ptPlan('ams','hub').steps)")), ['add', 'swap']);
ev("ACT.ptApply({city:'ams',k:'hub',cost:ptPlan('ams','hub').cost})");
assert.equal(ev("S.pops.ams.routers===2&&S.pops.ams.rgen===2"), true);
assert.equal(ev("S.inc.some(i=>i.type==='maint'&&i.ref==='ams')"), false, 'a rolling upgrade, no maintenance window');
assert.equal(ev("ptPlan('ams','micro')"), null, 'a smaller standard asks for nothing');
ev("ACT.ptApply({city:'ams',k:'micro',cost:0})");
assert.equal(ev("S.pops.ams.rgen===2&&S.pops.ams.routers===2&&S.popTiers.at.ams==='micro'"), true, 'only marked');
assert.deepEqual(errors, []);
});
test('#315 level 1 has no standards, and saves old and broken load', t => {
const h = setup(t, POPS);
const { ev, errors } = h;
ev("UI.sel={type:'city',id:'fra'};UI.tab='links';renderAll()");
assert.doesNotMatch(text(h, '#panel'), /POP standards/);
ev("ACT.ptSave({city:'fra',k:'micro'})");
assert.equal(ev('S.popTiers.def.micro'), null);
ev('delete S.popTiers;S=migrate(JSON.parse(JSON.stringify(S)))');
assert.equal(ev('JSON.stringify(S.popTiers)'), JSON.stringify({ def: { micro: null, medium: null, hub: null }, at: {} }));
ev("S.popTiers={def:{micro:{g:999,rt:2},hub:{g:1,rt:99},bogus:{g:1,rt:1}},at:{fra:'hub',ams:'nope',xyz:'micro',ber:'hub'}};S=migrate(JSON.parse(JSON.stringify(S)))");
assert.equal(ev('JSON.stringify(S.popTiers)'), JSON.stringify({ def: { micro: null, medium: null, hub: { g: 1, rt: ev('RMAX') } }, at: { fra: 'hub' } }));
assert.deepEqual(errors, []);
});
/* ---------- #199: find a network at a POP ---------- */
test('#199 search and connected-only filter the transit, exchange and PNI lists, on a phone', t => {
const h = setup(t, "S.lvl=4;ACT.buyTransit({city:'fra',net:'cog',tier:0});compute();window.innerWidth=390;UI.sel={type:'city',id:'fra'};UI.tab='up';renderAll()");
const { ev, errors } = h;
const rows = () => [...doc(h).querySelectorAll('#panel .row .nm')].map(e => e.textContent.trim());
const all = rows().length;
assert.ok(doc(h).getElementById('netQ'), 'the search box is there');
ev("ACT.netOnly()");
assert.equal(rows().length, 1);
assert.match(rows()[0], /Cogentle/);
ev("ACT.netClear()");
assert.equal(rows().length, all);
// Typing into the box filters as you go, and the box keeps focus and text.
ev("const i=document.getElementById('netQ');i.focus();i.value='goggle';i.dispatchEvent(new window.Event('input',{bubbles:true}))");
assert.equal(ev("document.activeElement.id"), 'netQ');
assert.equal(ev("UI.netQ"), 'goggle');
ev("UI.tab='peer';renderAll()");
const peer = rows();
assert.ok(peer.length > 0 && peer.every(r => /Goggle/.test(r)), peer.join(' | '));
ev("ACT.netFind({q:'zzzz'})");
assert.match(text(h, '#panel'), /No network here matches this filter/);
ev("ACT.netFind({q:String(NET.ggl.asn)})");
assert.match(text(h, '#panel'), /Goggle/, 'an AS number finds the network');
assert.deepEqual(errors, []);
});

View file

@ -0,0 +1,58 @@
// #196: the two city names at the top of a link panel (wave, dark fiber, virtual circuit) open that city's panel.
const test = require('node:test');
const assert = require('node:assert/strict');
const { load } = require('./harness');
const start = "ACT.start({});S.cash=1e9;S.lvl=13;S.nextFail=S.nextEvent=1e9;for(const g of GOALS)S.done[g.id]=0;";
const ends = ev => JSON.parse(ev("JSON.stringify([...document.querySelectorAll('#panel .ph h2 button[data-act=\"popGo\"]')].map(b=>[b.textContent,JSON.parse(b.dataset.args).city]))"));
const click = (ev, i) => ev(`document.querySelectorAll('#panel .ph h2 button[data-act="popGo"]')[${i}].click()`);
function setup(ev) {
ev(start + "ACT.launchBB({city:'fra'});ACT.buildPop({city:'ams'});compute()");
ev("S.links.push({id:'w1',a:'fra',b:'ams',kind:'wave',tier:0,km:360,sub:false,mo:1,cut:0,day:0})");
ev("S.links.push({id:'df1',a:'fra',b:'ams',kind:'df',own:false,sys:'lite',ch:[],km:360,sub:false,mo:1,ready:0,cut:0,day:0})");
ev("S.links.push({id:'vx1',a:'fra',b:'ams',kind:'vxc',prov:Object.keys(FAB)[0],vt:0,km:360,sub:false,mo:1,cut:0,day:0});compute()");
}
for (const [id, kind] of [['w1', 'wave'], ['df1', 'dark fiber'], ['vx1', 'virtual circuit']]) {
test(`#196 a ${kind} panel links both of its cities, and a click opens the city`, () => {
const { ev, errors } = load();
setup(ev);
ev(`selectLink('${id}')`);
assert.deepEqual(ends(ev), [['Frankfurt', 'fra'], ['Amsterdam', 'ams']]);
assert.match(ev("document.querySelector('#panel .ph h2').textContent"), /Frankfurt ⇄ Amsterdam/);
click(ev, 1);
assert.equal(ev("UI.sel.type+':'+UI.sel.id"), 'city:ams', 'the far end is selected');
assert.equal(ev("cam.x"), ev("CITY.ams.x"), 'and the map moves to it');
assert.match(ev("document.querySelector('#panel .ph h2').textContent"), /Amsterdam/);
ev(`selectLink('${id}')`);
click(ev, 0);
assert.equal(ev("UI.sel.id"), 'fra');
assert.deepEqual(errors, []);
});
}
test('#196 on a 390 px phone the city links sit in the bottom sheet header and still open the city', () => {
const { ev, errors } = load();
setup(ev);
ev("window.innerWidth=390;renderAll();selectLink('w1')");
assert.equal(ev("isPhone()"), true);
assert.equal(ends(ev).length, 2);
// The link styling: reads as heading text that wraps, not a button that pushes the header wider.
assert.match(ev("document.querySelector('#panel .ph h2 button').className"), /\bclink\b/);
click(ev, 0);
assert.equal(ev("UI.sel.type+':'+UI.sel.id"), 'city:fra');
assert.deepEqual(errors, []);
});
test('#196 a city the map does not show stays plain text', () => {
const { ev, errors } = load();
setup(ev);
ev("selectLink('w1')");
// cityOn() is false for an off-map city without a POP or IX port: no button to a panel that would not open.
ev("CITY.ams.off=true;delete S.pops.ams;renderPanel()");
assert.deepEqual(ends(ev), [['Frankfurt', 'fra']]);
assert.match(ev("document.querySelector('#panel .ph h2').textContent"), /Frankfurt ⇄ Amsterdam/);
ev("delete CITY.ams.off");
assert.deepEqual(errors, []);
});

View file

@ -226,7 +226,7 @@ test('a dry run prices every command that has a price, and changes nothing', ()
setChCount: { id: df, o: 'zr4', n: 2 }, repayLoan: { id: 'none' }, buildScrub: { city: 'ams', tier: 1 }, scrubUp: { city: 'fra', tier: 1 },
fixInc: { id: 'none' }, confGo: { key: T('catalog', { name: 'conferences' })[0].key }, confSponsor: { key: T('catalog', { name: 'conferences' })[0].key },
opsHire: { id: ev('Object.keys(INTERNS)[0]') }, opsNewPop: { city: 'nyc' }, pniAll: { net: 'cog', tier: 1 }, seatBuy: { n: 2 }, layShip: { id: df }, seaRush: { id: df },
utilityKit: { city: 'fra' }, utilityCaches: { city: 'fra' }, teDeploy: { script: 'spill at 85%' }, upLinkX: {},
utilityKit: { city: 'fra' }, utilityCaches: { city: 'fra' }, acceptFix: { id: 'none' }, ptApply: { city: 'fra', k: 'medium' }, ptAll: { k: 'medium' }, teDeploy: { script: 'spill at 85%' }, upLinkX: {},
pieRd: { k: 'reuse' }, pieAnt: { id: 'none' },
};
const missing = quoted.filter((n) => !sample[n] && T('schema', { section: 'commands' })[n].args.some((a) => a.required));

View file

@ -0,0 +1,72 @@
// #292: a renewal haggle in Deals shows what is at stake: traffic booked and served, the price per Gbps now and asked,
// and the path terms the customer signed for, each ticked as it stands today. It fits on a phone.
const test = require('node:test');
const assert = require('node:assert/strict');
const { load } = require('./harness');
const start = "ACT.start({});S.cash=1e9;S.lvl=6;S.nextFail=S.nextEvent=1e9;for(const g of GOALS)S.done[g.id]=0;";
// Frankfurt, Paris and Amsterdam in a triangle, so Frankfurt-Amsterdam has a direct path and one round through Paris.
function net(ev) {
ev(start + "ACT.launchBB({city:'fra'});ACT.buildPop({city:'par'});ACT.buildPop({city:'ams'});for(const c in S.pops){S.pops[c].rgen=3;S.pops[c].routers=2}");
for (const [a, b] of [['fra', 'par'], ['par', 'ams'], ['fra', 'ams']]) ev(`UI.via=null;openLinkModal('${a}','${b}');ACT.buildLink({tier:1});closeModal()`);
}
const deals = ev => { ev("UI.left='deals';renderLeft()"); return ev("document.getElementById('left').innerHTML"); };
const row = (ev, name) => ev(`(()=>{const r=[...document.querySelectorAll('#left .row')].find(r=>r.querySelector('.nm')&&r.querySelector('.nm').textContent==='${name}');return r?r.textContent:''})()`);
test('#292 an IP customer\'s renewal shows booked and served traffic and the price per Gbps', () => {
const { ev, errors } = load();
net(ev);
ev("S.biz.push({id:'h1',city:'ams',city2:null,name:'Haggle Hosting',type:'dia',bw:5,rate:600,reqs:[],mood:90,since:S.day-800,te:S.day+20,mk:1,hag:{rate:540,until:S.day+20}});compute()");
deals(ev);
const t = row(ev, 'Haggle Hosting');
assert.match(t, /5\.0 Gbps booked, [\d.]+ Gbps served/);
assert.ok(t.includes(ev("fmt$(600)") + ' → ' + ev("fmt$(540)") + ' per Gbps'), t);
assert.match(t, /Pays .* wants .* to renew/, 'the monthly bills are still there');
assert.deepEqual(errors, []);
});
test('#292 a circuit\'s renewal shows its latency limit and path terms, ticked as they stand today', () => {
const { ev, errors } = load();
net(ev);
ev("S.biz.push({id:'c1',city:'fra',city2:'ams',name:'Tulip Bank',type:'l2vpn',bw:10,rate:300,reqs:['lat','diverse','sharks'],latMax:50,route:'fast',mood:90,since:S.day-800,te:S.day+20,mk:1,hag:{rate:250,until:S.day+20}});compute()");
deals(ev);
let t = row(ev, 'Tulip Bank');
assert.match(t, /10\.0 Gbps booked, 10\.0 Gbps served/);
assert.match(t, /✓ latency within 50 ms \(now [\d.]+ ms one-way\)/);
assert.match(t, /✓ two diverse paths/, 'direct and round through Paris');
assert.match(t, /✓ no subsea cable/);
// A tight budget the network cannot meet is crossed out, with what it gets today.
ev("S.biz.find(b=>b.id==='c1').latMax=0.5;compute()");
deals(ev);
t = row(ev, 'Tulip Bank');
assert.match(t, /✗ latency within 0\.5 ms/);
assert.doesNotMatch(t, /undefined|NaN/);
assert.deepEqual(errors, []);
});
test('#292 SD-WAN shows its sites, fiber deals show no Gbps, and served traffic below what is booked is red', () => {
const { ev, errors } = load();
net(ev);
ev("S.biz.push({id:'s1',city:'fra',city2:null,sites:['fra','par','ams'],name:'Kebab Kingdom',type:'sdwan',bw:2,rate:400,reqs:[],mood:90,since:S.day-800,te:S.day+20,mk:1,hag:{rate:360,until:S.day+20}});compute()");
deals(ev);
assert.match(row(ev, 'Kebab Kingdom'), /3 sites × 2\.0 Gbps booked/);
assert.doesNotMatch(row(ev, 'Kebab Kingdom'), /✓|✗/, 'no path terms when they asked for none');
assert.equal(ev("clRenInfo({...S.biz.find(b=>b.id==='s1'),type:'dfpair'})"), '', 'a fiber pair is not sold by the Gbps');
ev("R.l2['s1']=0.5");
assert.match(ev("clRenInfo(S.biz.find(b=>b.id==='s1'))"), /color:var\(--bad\)">0\.5 Gbps/);
assert.deepEqual(errors, []);
});
test('#292 the renewal row fits a 390 px phone', () => {
const { ev, errors } = load();
net(ev);
ev("S.biz.push({id:'c1',city:'fra',city2:'ams',name:'Tulip Bank',type:'l2vpn',bw:10,rate:300,reqs:['lat','diverse'],latMax:50,route:'fast',mood:90,since:S.day-800,te:S.day+20,mk:1,hag:{rate:250,until:S.day+20}});compute()");
ev("window.innerWidth=390;renderAll()");
deals(ev);
assert.match(row(ev, 'Tulip Bank'), /booked, .* served/);
// Every new line is a wrapping meta line, never one wide nowrap element.
const info = ev("clRenInfo(S.biz.find(b=>b.id==='c1'))");
assert.match(info, /^<div class="meta">/);
assert.doesNotMatch(info, /nowrap|width:\s*\d{3,}px/);
assert.deepEqual(errors, []);
});