Merge #131: Custom routing metric for links (MurphysHub)
This commit is contained in:
commit
a6829b3d66
17 changed files with 212 additions and 16 deletions
|
|
@ -10,6 +10,7 @@ All notable changes to this project are documented here. The project follows
|
|||
- Series of Tubes now speaks German. The game follows your browser's language the first time, and you can switch to German under Settings or on the title screen. Networking terms like Peering and Transit stay in English, the way network engineers say them.
|
||||
- Glowball Sakura Lager joins the map: a Tier 2 carrier in the big hubs of the US, Europe and Asia-Pacific that sells transit, takes PNIs and peers openly wherever it is. It is not a Tier 1, so it buys its own transit from three of them, while 13 smaller networks in its regions buy theirs from it, and one PNI with it reaches about 3% of all traffic. Far from home, in Asia and New Zealand, it charges more than the locals, and it sells no transit in Australia.
|
||||
- Check a selected link’s redundancy against current demand: see disconnected endpoints, additional service loss and full fallback links without changing the live network.
|
||||
- Links can now use a custom routing metric, set either as a multiplier or as an exact cost. Pick Custom under Routing metric to fine-tune where your traffic goes; it explains how a link's cost is worked out and what each preset comes to on that link.
|
||||
|
||||
## [1.36.0] — 2026-10-28
|
||||
|
||||
|
|
|
|||
|
|
@ -870,10 +870,12 @@
|
|||
"common.controller_off":"Controller aus",
|
||||
"common.cooling_failure":"Kühlungsausfall",
|
||||
"common.copy":"Kopieren",
|
||||
"common.cost":"Kosten",
|
||||
"common.costs":"Kosten",
|
||||
"common.courtesy_route":"Gefälligkeits-Route",
|
||||
"common.crashes_more":"stürzt öfter ab",
|
||||
"common.credit_rating":"Bonität",
|
||||
"common.custom":"Eigene",
|
||||
"common.customer":"Kunde",
|
||||
"common.customer_care":"Kundenpflege",
|
||||
"common.customer_levels":"Kundenlevel",
|
||||
|
|
@ -1069,6 +1071,7 @@
|
|||
"common.more_scenarios":"Weitere Szenarien",
|
||||
"common.ms_ms_one_way":"{ms} ms pro Richtung",
|
||||
"common.mtu_mismatch":"MTU-Mismatch",
|
||||
"common.multiplier":"Faktor",
|
||||
"common.mystery_link":"Mysteriöser Link",
|
||||
"common.n_box":{"one":"{n} Box","other":"{n} Boxen"},
|
||||
"common.n_days_left":"noch {n} Tage",
|
||||
|
|
@ -1226,6 +1229,7 @@
|
|||
"common.serious_backbone":"Ernstzunehmender Backbone",
|
||||
"common.serve_as_much_traffic_as_you":"Liefere in einem Jahr so viel Traffic aus, wie du kannst.",
|
||||
"common.service_affected":"Betroffener Dienst",
|
||||
"common.set":"Setzen",
|
||||
"common.settings":"Einstellungen",
|
||||
"common.share":"Teilen",
|
||||
"common.share_2cd9":"Teilen…",
|
||||
|
|
@ -2101,6 +2105,7 @@
|
|||
"link_modal.you_already_have_n_link_here":{"one":"Du hast hier schon {n} Link ({list}). Parallele Links bringen Kapazität. Wie soll dieser geroutet werden?","other":"Du hast hier schon {n} Links ({list}). Parallele Links bringen Kapazität. Wie soll dieser geroutet werden?"},
|
||||
"link_panels.a_bigger_fabric_carries_more_traffic":"Eine größere Fabric trägt mehr Traffic und hat Platz für mehr Mitglieder. Dein Router hier muss trotzdem mithalten.",
|
||||
"link_panels.a_link_on_standby_carries_traffic":"Ein Link im Standby trägt nur Traffic, wenn die anderen Links zwischen diesen Städten voll oder down sind.",
|
||||
"link_panels.a_link_s_cost_is_its":"Die Kosten eines Links sind seine Länge in km plus 60, mal ein Faktor. Traffic nimmt den Pfad mit den niedrigsten Gesamtkosten.",
|
||||
"link_panels.a_regen_site_turns_the_light":"Ein Regen-Standort verwandelt das Licht auf halber Strecke zurück in Bits und schickt es frisch weiter, also müssen Optiken nur bis zum nächsten Standort reichen. Jeder braucht eine Regen-Karte für jeden beleuchteten Kanal. {price}/Monat pro Standort für die Hütte.",
|
||||
"link_panels.abandon_the_fiber":"Glasfaser aufgeben",
|
||||
"link_panels.add_parallel_link":"Parallelen Link hinzufügen",
|
||||
|
|
@ -2117,6 +2122,8 @@
|
|||
"link_panels.collecting_data_check_back_in_a":"Daten werden gesammelt. Schau in ein paar Tagen wieder rein.",
|
||||
"link_panels.congested_upgrade_it_or_add_a":"Überlastet. Rüste ihn auf oder füg einen parallelen Pfad hinzu.",
|
||||
"link_panels.connected_but_tight":"Verbunden, aber knapp.",
|
||||
"link_panels.cost_on_this_link_w_allowed":"Kosten auf diesem Link: {w}. Erlaubt: {lo} bis {hi}.",
|
||||
"link_panels.cost_the_exact_number_whatever_the":"Kosten: genau diese Zahl, egal wie lang der Link ist.",
|
||||
"link_panels.dark_fiber_kind_km_km":"Dark Fiber · {kind} · {km} km",
|
||||
"link_panels.de_kicks_personalised_pricing_p_of":"Personalisierte DE-KICKS-Preise: {p} % von dem, was ein normaler IX verlangen würde (Aktion, noch {n} Tage).",
|
||||
"link_panels.de_kicks_personalised_pricing_p_of_3d4f":"Personalisierte DE-KICKS-Preise: {p} % von dem, was ein normaler IX verlangen würde.",
|
||||
|
|
@ -2140,6 +2147,7 @@
|
|||
"link_panels.lost_on_the_way":"Unterwegs verloren",
|
||||
"link_panels.mainland_china_plays_by_its_own":"Festlandchina spielt nach eigenen Regeln. {list} und andere ausländische Dienste sind hier gesperrt, also erreichen Nutzer meist chinesische Netze. Traffic über die Grenze verliert etwa {pct} durch Filter und Überlastung, außer er läuft über eine Premium-Route: CN-Too-Transit oder eine grenzüberschreitende Premium-Verbindung (beides nur in Hongkong zu haben) oder ein PNI mit einem chinesischen Netz. Der Umsatz pro Nutzer ist hier niedriger.",
|
||||
"link_panels.members_paying_you":"Mitglieder, die dich bezahlen",
|
||||
"link_panels.multiplier_scales_the_distance_cost":"Faktor: skaliert die Kosten der Strecke, ein längerer Link kostet also weiter mehr.",
|
||||
"link_panels.n_amp_huts":"{n} Verstärkerhütten",
|
||||
"link_panels.n_amplifiers":"{n} Verstärker",
|
||||
"link_panels.n_exchanges_compete_in_city_members":"{n} Exchanges konkurrieren in {city}. Die Mitglieder überschneiden sich, aber nicht komplett, und die Herausforderer unterbieten den Platzhirsch. Kleine Netze sitzen oft nur an einem davon.",
|
||||
|
|
@ -2185,6 +2193,7 @@
|
|||
"link_panels.port_port_price_on_request":"{port}-Port <small>Preis auf Anfrage ☎</small>",
|
||||
"link_panels.ports_at_p_of_the_usual":"Ports zu {p} % des üblichen Preises.",
|
||||
"link_panels.ports_up_to_port_are_free":"Ports bis {port} sind kostenlos.",
|
||||
"link_panels.presets_on_this_link_list":"Voreinstellungen auf diesem Link: {list}.",
|
||||
"link_panels.price_n_days":"{price} · {n} Tage",
|
||||
"link_panels.put_this_link_on_standby":"Diesen Link in Standby versetzen",
|
||||
"link_panels.ready_for_a_pni_in_city":"Bereit für einen PNI in {city}",
|
||||
|
|
@ -2231,7 +2240,7 @@
|
|||
"link_panels.your_joint_venture_holds_an":"Dein Joint Venture hat eine Betriebslizenz.",
|
||||
"link_panels.your_own_build":"dein eigener Bau",
|
||||
"link_panels.your_own_fabric_name":"Deine eigene Fabric · {name}",
|
||||
"link_panels.your_routers_pick_the_lowest_cost":"Deine Router wählen den Pfad mit den niedrigsten Kosten. Erhöhe die Metrik, um Traffic auf andere Pfade zu drücken. „Nur Backup“ hält ihn untätig, außer nichts anderes funktioniert. Gilt für jeden Link zwischen diesen beiden Städten.",
|
||||
"link_panels.your_routers_pick_the_lowest_cost_0160":"Deine Router wählen den Pfad mit den niedrigsten Kosten. Erhöhe die Metrik, um Traffic auf andere Pfade zu drücken. „Nur Backup“ hält ihn untätig, außer nichts anderes funktioniert. Mit „Eigene“ setzt du deinen eigenen Faktor oder deine eigenen Kosten. Gilt für jeden Link zwischen diesen beiden Städten.",
|
||||
"link_panels.your_traffic_crossing_the_border":"Dein Traffic über die Grenze",
|
||||
"link_panels.your_wave_was_sold_before_the":"Deine Wave wurde verkauft, bevor der Kabelbesitzer es neu ausgelegt hat, also läuft sie weiter.",
|
||||
"links.a_fab_fabric_unlocks_at_customer":"<b>Eine {fab}-Fabric wird ab Kundenlevel {lv} freigeschaltet.</b>",
|
||||
|
|
|
|||
|
|
@ -868,10 +868,12 @@
|
|||
"common.controller_off":"controlador apagado",
|
||||
"common.cooling_failure":"Fallo de refrigeración",
|
||||
"common.copy":"Copiar",
|
||||
"common.cost":"Coste",
|
||||
"common.costs":"Costes",
|
||||
"common.courtesy_route":"Ruta de cortesía",
|
||||
"common.crashes_more":"se cae más",
|
||||
"common.credit_rating":"Calificación crediticia",
|
||||
"common.custom":"Propia",
|
||||
"common.customer":"Cliente",
|
||||
"common.customer_care":"Atención al cliente",
|
||||
"common.customer_levels":"Niveles de cliente",
|
||||
|
|
@ -1067,6 +1069,7 @@
|
|||
"common.more_scenarios":"Más escenarios",
|
||||
"common.ms_ms_one_way":"{ms} ms en un sentido",
|
||||
"common.mtu_mismatch":"Desajuste de MTU",
|
||||
"common.multiplier":"Multiplicador",
|
||||
"common.mystery_link":"Enlace misterioso",
|
||||
"common.n_box":{"one":"{n} caja","other":"{n} cajas"},
|
||||
"common.n_days_left":"Quedan {n} días",
|
||||
|
|
@ -1224,6 +1227,7 @@
|
|||
"common.serious_backbone":"Backbone serio",
|
||||
"common.serve_as_much_traffic_as_you":"Sirve todo el tráfico que puedas en un año.",
|
||||
"common.service_affected":"Servicio afectado",
|
||||
"common.set":"Aplicar",
|
||||
"common.settings":"Ajustes",
|
||||
"common.share":"Compartir",
|
||||
"common.share_2cd9":"Compartir…",
|
||||
|
|
@ -2099,6 +2103,7 @@
|
|||
"link_modal.you_already_have_n_link_here":{"one":"Ya tienes {n} enlace aquí ({list}). Los enlaces paralelos suman capacidad. ¿Cómo debe enrutarse este?","other":"Ya tienes {n} enlaces aquí ({list}). Los enlaces paralelos suman capacidad. ¿Cómo debe enrutarse este?"},
|
||||
"link_panels.a_bigger_fabric_carries_more_traffic":"Una fabric mayor transporta más tráfico y tiene sitio para más miembros. Tu router de aquí aún tiene que aguantar el ritmo.",
|
||||
"link_panels.a_link_on_standby_carries_traffic":"Un enlace en espera solo lleva tráfico cuando los demás enlaces entre estas ciudades están llenos o caídos.",
|
||||
"link_panels.a_link_s_cost_is_its":"El coste de un enlace es su longitud en km más 60, por un multiplicador. El tráfico toma la ruta con el menor coste total.",
|
||||
"link_panels.a_regen_site_turns_the_light":"Un sitio regenerador convierte la luz de nuevo en bits a mitad de camino y la envía renovada, así que las ópticas solo tienen que llegar al siguiente sitio. Cada uno necesita una tarjeta regeneradora por cada canal iluminado. {price}/mes por sitio por la caseta.",
|
||||
"link_panels.abandon_the_fiber":"Abandonar la fibra",
|
||||
"link_panels.add_parallel_link":"Añadir enlace paralelo",
|
||||
|
|
@ -2115,6 +2120,8 @@
|
|||
"link_panels.collecting_data_check_back_in_a":"Recopilando datos. Vuelve en unos días.",
|
||||
"link_panels.congested_upgrade_it_or_add_a":"Congestionado. Mejóralo o añade una ruta paralela.",
|
||||
"link_panels.connected_but_tight":"Conectado, pero justo.",
|
||||
"link_panels.cost_on_this_link_w_allowed":"Coste en este enlace: {w}. Permitido: de {lo} a {hi}.",
|
||||
"link_panels.cost_the_exact_number_whatever_the":"Coste: el número exacto, sea cual sea la distancia.",
|
||||
"link_panels.dark_fiber_kind_km_km":"Fibra oscura · {kind} · {km} km",
|
||||
"link_panels.de_kicks_personalised_pricing_p_of":"Precio personalizado de DE-KICKS: {p} % de lo que cobraría un IX normal (promo, quedan {n} días).",
|
||||
"link_panels.de_kicks_personalised_pricing_p_of_3d4f":"Precio personalizado de DE-KICKS: {p} % de lo que cobraría un IX normal.",
|
||||
|
|
@ -2138,6 +2145,7 @@
|
|||
"link_panels.lost_on_the_way":"Perdido por el camino",
|
||||
"link_panels.mainland_china_plays_by_its_own":"China continental juega con sus propias reglas. {list} y otros servicios extranjeros están bloqueados aquí, así que los usuarios llegan sobre todo a redes chinas. El tráfico que cruza la frontera pierde cerca del {pct} por filtrado y congestión, salvo que vaya por una ruta premium: tránsito CN-Too o un circuito transfronterizo premium (ambos solo se venden en Hong Kong), o un PNI con una red china. Los ingresos por usuario son menores aquí.",
|
||||
"link_panels.members_paying_you":"Miembros que te pagan",
|
||||
"link_panels.multiplier_scales_the_distance_cost":"Multiplicador: escala el coste de la distancia, así que un enlace más largo sigue costando más.",
|
||||
"link_panels.n_amp_huts":"{n} casetas de amplificación",
|
||||
"link_panels.n_amplifiers":"{n} amplificadores",
|
||||
"link_panels.n_exchanges_compete_in_city_members":"{n} intercambios compiten en {city}. Los miembros se solapan, pero no del todo, y los aspirantes bajan precios al establecido. Las redes pequeñas suelen estar solo en uno.",
|
||||
|
|
@ -2183,6 +2191,7 @@
|
|||
"link_panels.port_port_price_on_request":"Puerto {port} <small>Precio a consultar ☎</small>",
|
||||
"link_panels.ports_at_p_of_the_usual":"Puertos al {p} % del precio habitual.",
|
||||
"link_panels.ports_up_to_port_are_free":"Los puertos hasta {port} son gratis.",
|
||||
"link_panels.presets_on_this_link_list":"Valores predefinidos en este enlace: {list}.",
|
||||
"link_panels.price_n_days":"{price} · {n} días",
|
||||
"link_panels.put_this_link_on_standby":"Poner este enlace en espera",
|
||||
"link_panels.ready_for_a_pni_in_city":"Listo para un PNI en {city}",
|
||||
|
|
@ -2229,7 +2238,7 @@
|
|||
"link_panels.your_joint_venture_holds_an":"Tu empresa conjunta tiene una licencia de operación.",
|
||||
"link_panels.your_own_build":"construcción propia",
|
||||
"link_panels.your_own_fabric_name":"Tu propia fabric · {name}",
|
||||
"link_panels.your_routers_pick_the_lowest_cost":"Tus routers eligen la ruta de menor coste. Sube la métrica para empujar el tráfico a otras rutas. «Solo respaldo» lo deja inactivo salvo que nada más funcione. Se aplica a todos los enlaces entre estas dos ciudades.",
|
||||
"link_panels.your_routers_pick_the_lowest_cost_0160":"Tus routers eligen la ruta de menor coste. Sube la métrica para empujar el tráfico a otras rutas. «Solo respaldo» lo deja inactivo salvo que nada más funcione. Elige Propia para fijar tu propio multiplicador o coste. Se aplica a todos los enlaces entre estas dos ciudades.",
|
||||
"link_panels.your_traffic_crossing_the_border":"Tu tráfico que cruza la frontera",
|
||||
"link_panels.your_wave_was_sold_before_the":"Tu onda se vendió antes de que el dueño del cable la rediseñara, así que sigue funcionando.",
|
||||
"links.a_fab_fabric_unlocks_at_customer":"<b>Una fabric {fab} se desbloquea en el nivel de cliente {lv}.</b>",
|
||||
|
|
|
|||
|
|
@ -868,10 +868,12 @@
|
|||
"common.controller_off":"contrôleur désactivé",
|
||||
"common.cooling_failure":"Panne de refroidissement",
|
||||
"common.copy":"Copier",
|
||||
"common.cost":"Coût",
|
||||
"common.costs":"Coûts",
|
||||
"common.courtesy_route":"Route de courtoisie",
|
||||
"common.crashes_more":"plante plus souvent",
|
||||
"common.credit_rating":"Note de crédit",
|
||||
"common.custom":"Perso",
|
||||
"common.customer":"Client",
|
||||
"common.customer_care":"Service client",
|
||||
"common.customer_levels":"Niveaux clients",
|
||||
|
|
@ -1067,6 +1069,7 @@
|
|||
"common.more_scenarios":"Plus de scénarios",
|
||||
"common.ms_ms_one_way":"{ms} ms aller simple",
|
||||
"common.mtu_mismatch":"MTU incohérente",
|
||||
"common.multiplier":"Multiplicateur",
|
||||
"common.mystery_link":"Lien mystère",
|
||||
"common.n_box":{"one":"{n} boîtier","other":"{n} boîtiers"},
|
||||
"common.n_days_left":"encore {n} jours",
|
||||
|
|
@ -1224,6 +1227,7 @@
|
|||
"common.serious_backbone":"Backbone sérieux",
|
||||
"common.serve_as_much_traffic_as_you":"Sers autant de trafic que possible en un an.",
|
||||
"common.service_affected":"Service touché",
|
||||
"common.set":"Appliquer",
|
||||
"common.settings":"Réglages",
|
||||
"common.share":"Partager",
|
||||
"common.share_2cd9":"Partager…",
|
||||
|
|
@ -2099,6 +2103,7 @@
|
|||
"link_modal.you_already_have_n_link_here":{"one":"Tu as déjà {n} lien ici ({list}). Les liens parallèles ajoutent de la capacité. Par où faire passer celui-ci ?","other":"Tu as déjà {n} liens ici ({list}). Les liens parallèles ajoutent de la capacité. Par où faire passer celui-ci ?"},
|
||||
"link_panels.a_bigger_fabric_carries_more_traffic":"Un fabric plus gros transporte plus de trafic et accueille plus de membres. Ton routeur ici doit quand même suivre.",
|
||||
"link_panels.a_link_on_standby_carries_traffic":"Un lien en attente ne porte du trafic que lorsque les autres liens entre ces villes sont pleins ou coupés.",
|
||||
"link_panels.a_link_s_cost_is_its":"Le coût d’un lien, c’est sa longueur en km plus 60, fois un multiplicateur. Le trafic prend le chemin au coût total le plus bas.",
|
||||
"link_panels.a_regen_site_turns_the_light":"Un site de régénération reconvertit la lumière en bits à mi-chemin et la renvoie toute fraîche, donc les optiques n’ont qu’à atteindre le site suivant. Chacun demande une carte de régénération par canal allumé. {price}/mois par site pour l’abri.",
|
||||
"link_panels.abandon_the_fiber":"Abandonner la fibre",
|
||||
"link_panels.add_parallel_link":"Ajouter un lien parallèle",
|
||||
|
|
@ -2115,6 +2120,8 @@
|
|||
"link_panels.collecting_data_check_back_in_a":"Collecte des données en cours. Repasse dans quelques jours.",
|
||||
"link_panels.congested_upgrade_it_or_add_a":"Saturé. Augmente sa capacité ou ajoute un chemin parallèle.",
|
||||
"link_panels.connected_but_tight":"Connecté, mais de justesse.",
|
||||
"link_panels.cost_on_this_link_w_allowed":"Coût sur ce lien : {w}. Autorisé : de {lo} à {hi}.",
|
||||
"link_panels.cost_the_exact_number_whatever_the":"Coût : le nombre exact, quelle que soit la distance.",
|
||||
"link_panels.dark_fiber_kind_km_km":"Fibre noire · {kind} · {km} km",
|
||||
"link_panels.de_kicks_personalised_pricing_p_of":"Tarif personnalisé DE-KICKS : {p} % de ce que facturerait un IX normal (promo, encore {n} jours).",
|
||||
"link_panels.de_kicks_personalised_pricing_p_of_3d4f":"Tarif personnalisé DE-KICKS : {p} % de ce que facturerait un IX normal.",
|
||||
|
|
@ -2138,6 +2145,7 @@
|
|||
"link_panels.lost_on_the_way":"Perdu en route",
|
||||
"link_panels.mainland_china_plays_by_its_own":"La Chine continentale joue selon ses propres règles. {list} et d’autres services étrangers y sont bloqués, donc les utilisateurs atteignent surtout des réseaux chinois. Le trafic qui passe la frontière perd environ {pct} en filtrage et congestion, sauf s’il emprunte une route premium : du transit CN-Too ou un circuit transfrontalier premium (tous deux vendus uniquement à Hong Kong), ou un PNI avec un réseau chinois. Le revenu par utilisateur est plus faible ici.",
|
||||
"link_panels.members_paying_you":"Membres payants",
|
||||
"link_panels.multiplier_scales_the_distance_cost":"Multiplicateur : il multiplie le coût de la distance, donc un lien plus long coûte toujours plus.",
|
||||
"link_panels.n_amp_huts":"{n} abris d’amplis",
|
||||
"link_panels.n_amplifiers":"{n} amplificateurs",
|
||||
"link_panels.n_exchanges_compete_in_city_members":"{n} IX se font concurrence à {city}. Les membres se recoupent, mais pas totalement, et les challengers cassent les prix de l’historique. Les petits réseaux ne sont souvent que sur l’un d’eux.",
|
||||
|
|
@ -2183,6 +2191,7 @@
|
|||
"link_panels.port_port_price_on_request":"Port {port} <small>Prix sur demande ☎</small>",
|
||||
"link_panels.ports_at_p_of_the_usual":"Ports à {p} % du prix habituel.",
|
||||
"link_panels.ports_up_to_port_are_free":"Les ports jusqu’à {port} sont gratuits.",
|
||||
"link_panels.presets_on_this_link_list":"Préréglages sur ce lien : {list}.",
|
||||
"link_panels.price_n_days":"{price} · {n} jours",
|
||||
"link_panels.put_this_link_on_standby":"Mettre ce lien en attente",
|
||||
"link_panels.ready_for_a_pni_in_city":"Prêt pour un PNI à {city}",
|
||||
|
|
@ -2229,7 +2238,7 @@
|
|||
"link_panels.your_joint_venture_holds_an":"Ta coentreprise détient une licence d’opérateur.",
|
||||
"link_panels.your_own_build":"construite par toi",
|
||||
"link_panels.your_own_fabric_name":"Ton propre fabric · {name}",
|
||||
"link_panels.your_routers_pick_the_lowest_cost":"Tes routeurs choisissent le chemin le moins coûteux. Augmente la métrique pour pousser le trafic vers d’autres chemins. « Secours seul » le laisse au repos tant que le reste fonctionne. S’applique à tous les liens entre ces deux villes.",
|
||||
"link_panels.your_routers_pick_the_lowest_cost_0160":"Tes routeurs choisissent le chemin le moins coûteux. Augmente la métrique pour pousser le trafic vers d’autres chemins. « Secours seul » le laisse au repos tant que le reste fonctionne. Choisis Perso pour fixer ton propre multiplicateur ou coût. S’applique à tous les liens entre ces deux villes.",
|
||||
"link_panels.your_traffic_crossing_the_border":"Ton trafic qui passe la frontière",
|
||||
"link_panels.your_wave_was_sold_before_the":"Ta longueur d’onde a été vendue avant que le propriétaire du câble ne le réingénie, donc elle continue de tourner.",
|
||||
"links.a_fab_fabric_unlocks_at_customer":"<b>Un fabric {fab} se débloque au niveau client {lv}.</b>",
|
||||
|
|
|
|||
|
|
@ -868,10 +868,12 @@
|
|||
"common.controller_off":"controller spento",
|
||||
"common.cooling_failure":"Guasto al raffreddamento",
|
||||
"common.copy":"Copia",
|
||||
"common.cost":"Costo",
|
||||
"common.costs":"Costi",
|
||||
"common.courtesy_route":"Percorso di cortesia",
|
||||
"common.crashes_more":"crasha più spesso",
|
||||
"common.credit_rating":"Rating creditizio",
|
||||
"common.custom":"Personalizzata",
|
||||
"common.customer":"Cliente",
|
||||
"common.customer_care":"Cura del cliente",
|
||||
"common.customer_levels":"Livelli clienti",
|
||||
|
|
@ -1067,6 +1069,7 @@
|
|||
"common.more_scenarios":"Altri scenari",
|
||||
"common.ms_ms_one_way":"{ms} ms sola andata",
|
||||
"common.mtu_mismatch":"Mismatch di MTU",
|
||||
"common.multiplier":"Moltiplicatore",
|
||||
"common.mystery_link":"Link misterioso",
|
||||
"common.n_box":{"one":"{n} box","other":"{n} box"},
|
||||
"common.n_days_left":"mancano {n} giorni",
|
||||
|
|
@ -1224,6 +1227,7 @@
|
|||
"common.serious_backbone":"Backbone serio",
|
||||
"common.serve_as_much_traffic_as_you":"Servi più traffico che puoi in un anno.",
|
||||
"common.service_affected":"Servizio interessato",
|
||||
"common.set":"Imposta",
|
||||
"common.settings":"Impostazioni",
|
||||
"common.share":"Condividi",
|
||||
"common.share_2cd9":"Condividi…",
|
||||
|
|
@ -2099,6 +2103,7 @@
|
|||
"link_modal.you_already_have_n_link_here":{"one":"Hai già {n} link qui ({list}). I link paralleli aggiungono capacità. Che percorso deve fare questo?","other":"Hai già {n} link qui ({list}). I link paralleli aggiungono capacità. Che percorso deve fare questo?"},
|
||||
"link_panels.a_bigger_fabric_carries_more_traffic":"Un fabric più grande porta più traffico e ha posto per più membri. Il tuo router qui deve comunque starci dietro.",
|
||||
"link_panels.a_link_on_standby_carries_traffic":"Un link in standby porta traffico solo quando gli altri link tra queste città sono pieni o giù.",
|
||||
"link_panels.a_link_s_cost_is_its":"Il costo di un link è la sua lunghezza in km più 60, per un moltiplicatore. Il traffico prende il percorso col costo totale più basso.",
|
||||
"link_panels.a_regen_site_turns_the_light":"Un sito di rigenerazione riconverte la luce in bit a metà strada e la rimanda fresca, così le ottiche devono arrivare solo al sito successivo. Ognuno richiede una scheda di rigenerazione per ogni canale acceso. {price}/mese a sito per la casupola.",
|
||||
"link_panels.abandon_the_fiber":"Abbandona la fibra",
|
||||
"link_panels.add_parallel_link":"Aggiungi link parallelo",
|
||||
|
|
@ -2115,6 +2120,8 @@
|
|||
"link_panels.collecting_data_check_back_in_a":"Raccolta dati in corso. Ripassa tra qualche giorno.",
|
||||
"link_panels.congested_upgrade_it_or_add_a":"Congestionato. Potenzialo o aggiungi un percorso parallelo.",
|
||||
"link_panels.connected_but_tight":"Connesso, ma al limite.",
|
||||
"link_panels.cost_on_this_link_w_allowed":"Costo su questo link: {w}. Ammessi: da {lo} a {hi}.",
|
||||
"link_panels.cost_the_exact_number_whatever_the":"Costo: il numero esatto, a prescindere dalla distanza.",
|
||||
"link_panels.dark_fiber_kind_km_km":"Dark fiber · {kind} · {km} km",
|
||||
"link_panels.de_kicks_personalised_pricing_p_of":"Prezzi personalizzati DE-KICKS: {p}% di quanto chiederebbe un IX normale (promo, ancora {n} giorni).",
|
||||
"link_panels.de_kicks_personalised_pricing_p_of_3d4f":"Prezzi personalizzati DE-KICKS: {p}% di quanto chiederebbe un IX normale.",
|
||||
|
|
@ -2138,6 +2145,7 @@
|
|||
"link_panels.lost_on_the_way":"Perso per strada",
|
||||
"link_panels.mainland_china_plays_by_its_own":"La Cina continentale gioca con regole tutte sue. {list} e altri servizi stranieri qui sono bloccati, quindi gli utenti raggiungono soprattutto reti cinesi. Il traffico che attraversa il confine perde circa il {pct} tra filtri e congestione, a meno che non viaggi su una rotta premium: transit CN-Too o un circuito transfrontaliero premium (entrambi venduti solo a Hong Kong), oppure un PNI con una rete cinese. Qui i ricavi per utente sono più bassi.",
|
||||
"link_panels.members_paying_you":"Membri paganti",
|
||||
"link_panels.multiplier_scales_the_distance_cost":"Moltiplicatore: scala il costo della distanza, così un link più lungo costa comunque di più.",
|
||||
"link_panels.n_amp_huts":"{n} shelter amplificatori",
|
||||
"link_panels.n_amplifiers":"{n} amplificatori",
|
||||
"link_panels.n_exchanges_compete_in_city_members":"A {city} si fanno concorrenza {n} exchange. I membri si sovrappongono, ma non del tutto, e gli sfidanti fanno prezzi più bassi dell’incumbent. Le reti piccole spesso stanno su uno solo.",
|
||||
|
|
@ -2183,6 +2191,7 @@
|
|||
"link_panels.port_port_price_on_request":"Porta {port} <small>Prezzo su richiesta ☎</small>",
|
||||
"link_panels.ports_at_p_of_the_usual":"Porte al {p}% del prezzo normale.",
|
||||
"link_panels.ports_up_to_port_are_free":"Le porte fino a {port} sono gratis.",
|
||||
"link_panels.presets_on_this_link_list":"Preset su questo link: {list}.",
|
||||
"link_panels.price_n_days":"{price} · {n} giorni",
|
||||
"link_panels.put_this_link_on_standby":"Metti questo link in standby",
|
||||
"link_panels.ready_for_a_pni_in_city":"Pronto per un PNI a {city}",
|
||||
|
|
@ -2229,7 +2238,7 @@
|
|||
"link_panels.your_joint_venture_holds_an":"La tua joint venture ha una licenza operativa.",
|
||||
"link_panels.your_own_build":"costruita da te",
|
||||
"link_panels.your_own_fabric_name":"Il tuo fabric · {name}",
|
||||
"link_panels.your_routers_pick_the_lowest_cost":"I tuoi router scelgono il percorso a costo minore. Alza la metrica per spingere il traffico su altri percorsi. “Solo backup” lo lascia a riposo finché il resto funziona. Vale per tutti i link tra queste due città.",
|
||||
"link_panels.your_routers_pick_the_lowest_cost_0160":"I tuoi router scelgono il percorso a costo minore. Alza la metrica per spingere il traffico su altri percorsi. “Solo backup” lo lascia a riposo finché il resto funziona. Scegli Personalizzata per impostare il tuo moltiplicatore o costo. Vale per tutti i link tra queste due città.",
|
||||
"link_panels.your_traffic_crossing_the_border":"Il tuo traffico che passa il confine",
|
||||
"link_panels.your_wave_was_sold_before_the":"La tua wave è stata venduta prima che il proprietario del cavo lo riprogettasse, quindi continua a funzionare.",
|
||||
"links.a_fab_fabric_unlocks_at_customer":"<b>Un fabric {fab} si sblocca al livello clienti {lv}.</b>",
|
||||
|
|
|
|||
|
|
@ -868,10 +868,12 @@
|
|||
"common.controller_off":"controller desligado",
|
||||
"common.cooling_failure":"Falha na refrigeração",
|
||||
"common.copy":"Copiar",
|
||||
"common.cost":"Custo",
|
||||
"common.costs":"Custos",
|
||||
"common.courtesy_route":"Rota de cortesia",
|
||||
"common.crashes_more":"trava mais",
|
||||
"common.credit_rating":"Rating de crédito",
|
||||
"common.custom":"Personalizada",
|
||||
"common.customer":"Cliente",
|
||||
"common.customer_care":"Cuidado com o cliente",
|
||||
"common.customer_levels":"Níveis de clientes",
|
||||
|
|
@ -1067,6 +1069,7 @@
|
|||
"common.more_scenarios":"Mais cenários",
|
||||
"common.ms_ms_one_way":"{ms} ms só ida",
|
||||
"common.mtu_mismatch":"Mismatch de MTU",
|
||||
"common.multiplier":"Multiplicador",
|
||||
"common.mystery_link":"Link misterioso",
|
||||
"common.n_box":{"one":"{n} caixa","other":"{n} caixas"},
|
||||
"common.n_days_left":"faltam {n} dias",
|
||||
|
|
@ -1224,6 +1227,7 @@
|
|||
"common.serious_backbone":"Backbone de respeito",
|
||||
"common.serve_as_much_traffic_as_you":"Sirva o máximo de tráfego que conseguir em um ano.",
|
||||
"common.service_affected":"Serviço afetado",
|
||||
"common.set":"Aplicar",
|
||||
"common.settings":"Configurações",
|
||||
"common.share":"Compartilhar",
|
||||
"common.share_2cd9":"Compartilhar…",
|
||||
|
|
@ -2099,6 +2103,7 @@
|
|||
"link_modal.you_already_have_n_link_here":{"one":"Você já tem {n} link aqui ({list}). Links paralelos somam capacidade. Como este deve ser roteado?","other":"Você já tem {n} links aqui ({list}). Links paralelos somam capacidade. Como este deve ser roteado?"},
|
||||
"link_panels.a_bigger_fabric_carries_more_traffic":"Um fabric maior carrega mais tráfego e tem espaço para mais membros. Seu router aqui ainda precisa dar conta.",
|
||||
"link_panels.a_link_on_standby_carries_traffic":"Um link de reserva só leva tráfego quando os outros links entre estas cidades estão cheios ou fora do ar.",
|
||||
"link_panels.a_link_s_cost_is_its":"O custo de um link é seu comprimento em km mais 60, vezes um multiplicador. O tráfego segue o caminho de menor custo total.",
|
||||
"link_panels.a_regen_site_turns_the_light":"Um site de regeneração transforma a luz de volta em bits no meio do caminho e a reenvia novinha, então as ópticas só precisam alcançar o próximo site. Cada um precisa de uma placa de regeneração para cada canal aceso. {price}/mês por site pelo abrigo.",
|
||||
"link_panels.abandon_the_fiber":"Abandonar a fibra",
|
||||
"link_panels.add_parallel_link":"Adicionar link paralelo",
|
||||
|
|
@ -2115,6 +2120,8 @@
|
|||
"link_panels.collecting_data_check_back_in_a":"Coletando dados. Volte em alguns dias.",
|
||||
"link_panels.congested_upgrade_it_or_add_a":"Congestionado. Faça upgrade ou adicione um caminho paralelo.",
|
||||
"link_panels.connected_but_tight":"Conectado, mas no limite.",
|
||||
"link_panels.cost_on_this_link_w_allowed":"Custo neste link: {w}. Permitido: de {lo} a {hi}.",
|
||||
"link_panels.cost_the_exact_number_whatever_the":"Custo: o número exato, seja qual for a distância.",
|
||||
"link_panels.dark_fiber_kind_km_km":"Dark fiber · {kind} · {km} km",
|
||||
"link_panels.de_kicks_personalised_pricing_p_of":"Preço personalizado DE-KICKS: {p}% do que um IX normal cobraria (promo, faltam {n} dias).",
|
||||
"link_panels.de_kicks_personalised_pricing_p_of_3d4f":"Preço personalizado DE-KICKS: {p}% do que um IX normal cobraria.",
|
||||
|
|
@ -2138,6 +2145,7 @@
|
|||
"link_panels.lost_on_the_way":"Perdido no caminho",
|
||||
"link_panels.mainland_china_plays_by_its_own":"A China continental joga com regras próprias. {list} e outros serviços estrangeiros são bloqueados aqui, então os usuários acessam principalmente redes chinesas. O tráfego que cruza a fronteira perde cerca de {pct} com filtragem e congestionamento, a menos que vá por uma rota premium: transit CN-Too ou um circuito transfronteiriço premium (ambos vendidos só em Hong Kong), ou um PNI com uma rede chinesa. A receita por usuário aqui é menor.",
|
||||
"link_panels.members_paying_you":"Membros pagantes",
|
||||
"link_panels.multiplier_scales_the_distance_cost":"Multiplicador: multiplica o custo da distância, então um link mais longo continua custando mais.",
|
||||
"link_panels.n_amp_huts":"{n} abrigos de amplificador",
|
||||
"link_panels.n_amplifiers":"{n} amplificadores",
|
||||
"link_panels.n_exchanges_compete_in_city_members":"{n} exchanges competem em {city}. Os membros se sobrepõem, mas não totalmente, e os desafiantes cobram menos que o incumbente. Redes pequenas costumam ficar em só um deles.",
|
||||
|
|
@ -2183,6 +2191,7 @@
|
|||
"link_panels.port_port_price_on_request":"Porta {port} <small>Preço sob consulta ☎</small>",
|
||||
"link_panels.ports_at_p_of_the_usual":"Portas a {p}% do preço normal.",
|
||||
"link_panels.ports_up_to_port_are_free":"Portas até {port} são grátis.",
|
||||
"link_panels.presets_on_this_link_list":"Predefinições neste link: {list}.",
|
||||
"link_panels.price_n_days":"{price} · {n} dias",
|
||||
"link_panels.put_this_link_on_standby":"Deixar este link de reserva",
|
||||
"link_panels.ready_for_a_pni_in_city":"Pronto para um PNI em {city}",
|
||||
|
|
@ -2229,7 +2238,7 @@
|
|||
"link_panels.your_joint_venture_holds_an":"Sua joint venture tem uma licença de operação.",
|
||||
"link_panels.your_own_build":"construção própria",
|
||||
"link_panels.your_own_fabric_name":"Seu próprio fabric · {name}",
|
||||
"link_panels.your_routers_pick_the_lowest_cost":"Seus routers escolhem o caminho de menor custo. Aumente a métrica para empurrar o tráfego para outros caminhos. “Só backup” deixa o link ocioso a menos que nada mais funcione. Vale para todos os links entre essas duas cidades.",
|
||||
"link_panels.your_routers_pick_the_lowest_cost_0160":"Seus routers escolhem o caminho de menor custo. Aumente a métrica para empurrar o tráfego para outros caminhos. “Só backup” deixa o link ocioso a menos que nada mais funcione. Escolha Personalizada para definir seu próprio multiplicador ou custo. Vale para todos os links entre essas duas cidades.",
|
||||
"link_panels.your_traffic_crossing_the_border":"Seu tráfego cruzando a fronteira",
|
||||
"link_panels.your_wave_was_sold_before_the":"Sua wave foi vendida antes de o dono do cabo reprojetá-lo, então continua funcionando.",
|
||||
"links.a_fab_fabric_unlocks_at_customer":"<b>Um fabric {fab} desbloqueia no nível de cliente {lv}.</b>",
|
||||
|
|
|
|||
|
|
@ -35,7 +35,14 @@ const NNI=[{n:'10G',g:10,mo:500},{n:'100G',g:100,mo:1200}];
|
|||
const VXC=[{n:'10G',g:10,m:1},{n:'50G',g:50,m:2.4},{n:'100G',g:100,m:3.6}];
|
||||
const vxcMo=(km,sub,t)=>Math.round((150+km*0.12)*VXC[t].m*(sub?2:1));
|
||||
const MET={prefer:{l:tr('common.prefer'),f:0.5},normal:{l:tr('common.normal'),f:1},avoid:{l:tr('common.avoid'),f:4},backup:{l:tr('common.backup_only'),f:60}};
|
||||
// Custom metrics: a multiplier on the distance cost (f) or an absolute IGP cost (w), capped like an OSPF metric.
|
||||
const MET_LIM={f:[0.1,100],w:[1,65535]};
|
||||
const clampM=(k,v)=>{const [lo,hi]=MET_LIM[k];v=Math.min(hi,Math.max(lo,v));return k==='w'?Math.round(v):Math.round(v*100)/100;};
|
||||
const PREF={high:tr('common.prefer'),normal:tr('common.normal'),low:tr('common.backup_only')};
|
||||
const edgeKey=l=>l.a<l.b?l.a+'|'+l.b:l.b+'|'+l.a;
|
||||
// The routing metric of a city pair (edgeKey), set for every link between the two cities.
|
||||
function pairMet(k){return (S.pairMet&&S.pairMet[k])||'normal';}
|
||||
// A custom metric is stored as {k:'f'|'w',v}: a multiplier, or an exact cost whatever the distance.
|
||||
function pairMet(k){const m=S.pairMet&&S.pairMet[k];return m?(typeof m==='object'?'custom':m):'normal';}
|
||||
function pairCm(k){const m=S.pairMet&&S.pairMet[k];return m&&typeof m==='object'?m:null;}
|
||||
// The cost of one link of km on the pair k, as Dijkstra sees it.
|
||||
function pairW(k,km){const m=S.pairMet&&S.pairMet[k];return m&&typeof m==='object'?(m.k==='w'?m.v:(km+60)*m.v):(km+60)*MET[m||'normal'].f;}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
const slug=t=>String(t).toLowerCase().normalize('NFKD').replace(/[̀-ͯ]/g,'').replace(/[^a-z0-9]+/g,'-').replace(/^-|-$/g,'')||'x';
|
||||
function trPaths(src){const live=S.links.filter(l=>!linkDown(l)),rem=remoteCities(),ok=c=>popUp(c)||rem.includes(c),adj={};
|
||||
// Every link between two cities costs what the pair costs, as in compute(); the trace shows an active link over one on standby.
|
||||
const pw={};for(const l of live){const k=edgeKey(l);pw[k]=Math.min(pw[k]??Infinity,(l.km+60)*MET[pairMet(k)].f);}
|
||||
const pw={};for(const l of live){const k=edgeKey(l);pw[k]=Math.min(pw[k]??Infinity,pairW(k,l.km));}
|
||||
for(const l of live){if(!ok(l.a)||!ok(l.b))continue;const w=pw[edgeKey(l)]+(l.standby?1e-6:0);(adj[l.a]=adj[l.a]||[]).push([l.b,l,w]);(adj[l.b]=adj[l.b]||[]).push([l.a,l,w]);}
|
||||
const dist={[src]:0},prev={},done=new Set();for(;;){let u=null,ud=Infinity;for(const k in dist)if(!done.has(k)&&dist[k]<ud){u=k;ud=dist[k];}if(u===null)break;done.add(u);for(const [v,l,w] of adj[u]||[]){const nd=ud+w;if(nd<(dist[v]??Infinity)){dist[v]=nd;prev[v]=l;}}}
|
||||
const path=dst=>{if(dist[dst]===undefined)return null;const out=[];let v=dst;while(v!==src){const l=prev[v];out.unshift({l,from:l.a===v?l.b:l.a,to:v});v=l.a===v?l.b:l.a;}return out;};return {dist,path};}
|
||||
|
|
|
|||
|
|
@ -6,9 +6,9 @@ function compute(){
|
|||
const remote=remoteCities(),adj=new Array(NC); pops.concat(remote).forEach(p=>adj[CIDX[p]]=[]);
|
||||
const edges={},TRX=teRules(),live=[];let NE=0;R2.bizDem={};R2.bizSrv={};
|
||||
for(const l of S.links){const ai=CIDX[l.a],bi=CIDX[l.b];if(linkDown(l)||!adj[ai]||!adj[bi])continue;live.push(l);const key=l.a<l.b?l.a+'|'+l.b:l.b+'|'+l.a;let e=edges[key];
|
||||
// The metric belongs to the city pair; links on standby add capacity that fills only after the others (#122).
|
||||
if(!e){const f=MET[pairMet(key)].f;e=edges[key]={id:key,a:l.a,b:l.b,ai,bi,i:NE++,km:l.km,cap:0,scap:0,w:Infinity,lat:Infinity,slat:Infinity,links:[],res:0,ld:0,tr:null,pl:0,f:f*(TRX&&TRX.avoid.has(key)?60:1)};adj[ai].push([bi,e]);adj[bi].push([ai,e]);}
|
||||
const c=capOf(l),lt=linkLat(l);e.cap+=c;e.links.push(l);e.w=Math.min(e.w,(l.km+60)*e.f);if(l.standby){e.scap+=c;e.slat=Math.min(e.slat,lt);}else e.lat=Math.min(e.lat,lt);}
|
||||
// The metric belongs to the city pair (a preset or a custom one); links on standby add capacity that fills only after the others (#122).
|
||||
if(!e){e=edges[key]={id:key,a:l.a,b:l.b,ai,bi,i:NE++,km:l.km,cap:0,scap:0,w:Infinity,lat:Infinity,slat:Infinity,links:[],res:0,ld:0,tr:null,pl:0,f:TRX&&TRX.avoid.has(key)?60:1};adj[ai].push([bi,e]);adj[bi].push([ai,e]);}
|
||||
const c=capOf(l),lt=linkLat(l);e.cap+=c;e.links.push(l);e.w=Math.min(e.w,pairW(key,l.km)*e.f);if(l.standby){e.scap+=c;e.slat=Math.min(e.slat,lt);}else e.lat=Math.min(e.lat,lt);}
|
||||
for(const k in edges){const e=edges[k];if(e.lat===Infinity)e.lat=e.slat;}
|
||||
// Shortest paths from every POP: SPD[pop] the distance to each city index (Infinity: no path), SPP[pop] the edge it arrives by.
|
||||
// ALONE[i]: no other city lies within 1e-6 of POP i (so only its own exits can be at distance 0 from it).
|
||||
|
|
|
|||
|
|
@ -20,7 +20,9 @@ function sanitize(s){
|
|||
links, with all of them carrying traffic, so the pair keeps that metric and nothing goes on standby. */
|
||||
{const pm=s.pairMet,lo={};for(const l of s.links){if(l.metric!==undefined){const k=edgeKey(l),m=own(MET,l.metric)?l.metric:'normal';if(!lo[k]||MET[m].f<MET[lo[k]].f)lo[k]=m;}if(l.standby!==true)delete l.standby;}
|
||||
for(const l of s.links){const k=edgeKey(l);if(lo[k]&&l.metric===undefined)lo[k]='normal';delete l.metric;}
|
||||
for(const k in lo)pm[k]=lo[k];const ks=new Set(s.links.map(edgeKey));for(const k of Object.keys(pm))if(!ks.has(k)||!own(MET,pm[k])||pm[k]==='normal')delete pm[k];}
|
||||
for(const k in lo)pm[k]=lo[k];const ks=new Set(s.links.map(edgeKey));for(const k of Object.keys(pm)){const v=pm[k];
|
||||
if(v&&typeof v==='object'&&ks.has(k)){const mk=v.k==='w'?'w':'f';pm[k]={k:mk,v:clampM(mk,num(v.v,mk==='w'?60:1))};continue;}
|
||||
if(!ks.has(k)||typeof v!=='string'||!own(MET,v)||v==='normal')delete pm[k];}}
|
||||
const degO=v=>v&&typeof v==='object'?{until:num(v.until,0),f:Math.min(1,Math.max(0,num(v.f,1)))}:null;
|
||||
s.transit=s.transit.filter(t=>t&&isCity(t.city)&&isNet(t.net)).map(t=>(t.lacp=degO(t.lacp),t.site=['a','b','ab'].includes(t.site)?t.site:'a',t.id=sid(t.id),t.tier=tier(t.tier),t.n=lag(t.n),t.down=num(t.down,0),t.clean=!!t.clean,t.premium=premOnlyAt(NET[t.net],t.city)||!!t.premium&&premCity(NET[t.net],t.city),t));
|
||||
s.pni=s.pni.filter(x=>x&&isCity(x.city)&&isNet(x.net)).map(x=>(x.lacp=degO(x.lacp),x.site=['a','b','ab'].includes(x.site)?x.site:'a',x.id=sid(x.id),x.tier=tier(x.tier),x.n=lag(x.n),x.sacrif=!!x.sacrif,x));
|
||||
|
|
|
|||
|
|
@ -28,7 +28,14 @@ Object.assign(ACT,{
|
|||
upVxc:({id,t})=>{t=+t;const l=S.links.find(x=>x.id===id);if(!l||l.kind!=='vxc'||!VXC[t]||t<=l.vt)return;const extra=VXC[t].g-VXC[l.vt].g;for(const c of [l.a,l.b]){const pt=nniPort(c,l.prov);if(pt&&nniUsed(c,l.prov)+extra>NNI[pt.tier].g){toast(tr('links.fabric_port_in_city_is_full',{city:CITY[c].name}),'bad');sfx('err');return;}}const mo=vxcMo(l.km,l.sub,t);if(!spend(mo))return;l.vt=t;l.mo=mo;after();},
|
||||
cancelVxc:({id})=>{if(UI.confirm!==id){UI.confirm=id;renderPanel();return;}S.links=S.links.filter(l=>l.id!==id);prunePairMet();const rem=remoteCities();for(const c in S.ixp){if(!S.pops[ixCity(c)]&&!rem.includes(ixCity(c))){delete S.ixp[c];delete S.rs[c];for(const k in S.peers)if(k.endsWith('@'+c))delete S.peers[k];}}UI.sel=null;UI.confirm=null;after();},
|
||||
setPref:({kind,id,v})=>{if(!own(PREF,v))return;if(kind!=='t'&&kind!=='p'&&!(isIx(id)&&S.ixp[id]!==undefined))return;if(kind==='t'){const t=S.transit.find(x=>x.id===id);if(t)t.pref=v;}else if(kind==='p'){const x=S.pni.find(y=>y.id===id);if(x)x.pref=v;}else{S.ixPref=S.ixPref||{};S.ixPref[id]=v;}sfx('click');after();},
|
||||
setMetric:({id,v})=>{if(!own(MET,v))return;const l=S.links.find(x=>x.id===id);if(!l)return;const m=S.pairMet||(S.pairMet={}),k=edgeKey(l);if(v==='normal')delete m[k];else m[k]=v;sfx('click');after();},
|
||||
setMetric:({id,v})=>{if(v!=='custom'&&!own(MET,v))return;const l=S.links.find(x=>x.id===id);if(!l)return;const m=S.pairMet||(S.pairMet={}),k=edgeKey(l);
|
||||
// Switching to custom starts from the current preset's factor, so nothing moves until the player edits it.
|
||||
if(v==='custom'){if(!pairCm(k))m[k]={k:'f',v:MET[pairMet(k)].f};}else if(v==='normal')delete m[k];else m[k]=v;sfx('click');after();},
|
||||
metricMode:({id,k})=>{if(k!=='f'&&k!=='w')return;const l=S.links.find(x=>x.id===id);if(!l)return;const key=edgeKey(l),c=pairCm(key);if(!c||c.k===k)return;
|
||||
// The cost stays what it was on this link, written the other way.
|
||||
const w=pairW(key,l.km);S.pairMet[key]={k,v:clampM(k,k==='w'?w:w/(l.km+60))};sfx('click');after();},
|
||||
metricSet:({id})=>{const l=S.links.find(x=>x.id===id),t=$('metIn');if(!l||!t)return;const key=edgeKey(l),c=pairCm(key);if(!c)return;const v=parseFloat(String(t.value).replace(',','.'));if(!Number.isFinite(v)){sfx('err');return;}
|
||||
t.blur();S.pairMet[key]={k:c.k,v:clampM(c.k,v)};sfx('click');after();},
|
||||
setStandby:({id,on})=>{const l=S.links.find(x=>x.id===id);if(!l)return;if(on)l.standby=true;else delete l.standby;sfx('click');after();},
|
||||
goEgress:({city,k})=>{ACT.focusCity({city});UI.tab=k==='t'?'up':k==='l2'?'cust':k==='nni'?'links':'peer';renderPanel();},
|
||||
});
|
||||
|
|
|
|||
|
|
@ -85,6 +85,8 @@ function renderPanel(){checkLayer();
|
|||
const P=$('panel');
|
||||
if(!S||!UI.sel){P.hidden=true;return;}
|
||||
P.hidden=false;
|
||||
// Don't wipe a half-typed custom metric on the daily re-render.
|
||||
const fe=document.activeElement;if(fe&&fe.id==='metIn'&&UI.sel.type!=='city'&&fe.dataset.id===UI.sel.id)return;
|
||||
const scrollEl=$('panelBody').querySelector('.scroll');const st=scrollEl?scrollEl.scrollTop:0;
|
||||
const html=UI.sel.type==='city'?cityPanel(UI.sel.id):linkPanel(UI.sel.id);if(html===UI._ph&&!P.hidden&&$('panelBody').firstChild)return;UI._ph=html;morph($('panelBody'),html);
|
||||
const ns=$('panelBody').querySelector('.scroll');if(ns)ns.scrollTop=st;
|
||||
|
|
|
|||
|
|
@ -67,8 +67,15 @@ function trafficSection(l){
|
|||
if(u>=0.8&&egs.length){const d=R.egDesc[egs[0][0]];h+=`<p class="why">${tr('link_panels.biggest_feeder_egress_in_city_set',{egress:esc(d.lab),city:CITY[d.city].name})}</p>`;}
|
||||
return h+`</section>`;
|
||||
}
|
||||
function metricSection(l){const cur=pairMet(edgeKey(l)),pl=pairLinks(l.a,l.b),sb=!!l.standby;
|
||||
let h=`<section><h3>${tr('common.routing_metric')}</h3><p class="lead">${tr('link_panels.your_routers_pick_the_lowest_cost')}</p><div class="btns">${Object.keys(MET).map(k=>btn(MET[k].l,'setMetric',{id:l.id,v:k},cur===k?'pink sm':'ghost sm')).join('')}</div>`;
|
||||
function metricSection(l){const key=edgeKey(l),cur=pairMet(key),pl=pairLinks(l.a,l.b),sb=!!l.standby,base=l.km+60,sel=k=>cur===k?'pink sm':'ghost sm';
|
||||
let h=`<section><h3>${tr('common.routing_metric')}</h3><p class="lead">${tr('link_panels.your_routers_pick_the_lowest_cost_0160')}</p><div class="btns">${Object.keys(MET).map(k=>btn(MET[k].l,'setMetric',{id:l.id,v:k},sel(k))).join('')}${btn(tr('common.custom'),'setMetric',{id:l.id,v:'custom'},sel('custom'))}</div>`;
|
||||
const cm=pairCm(key);
|
||||
if(cm){const k=cm.k,[lo,hi]=MET_LIM[k],md=m=>k===m?'pink sm':'ghost sm';
|
||||
const pre=Object.keys(MET).map(m=>`${MET[m].l} ×${MET[m].f} = ${Math.round(base*MET[m].f)}`).join(', ');
|
||||
h+=`<p class="meta">${tr('link_panels.a_link_s_cost_is_its')} ${tr('link_panels.presets_on_this_link_list',{list:pre})}</p>
|
||||
<div class="btns">${btn(tr('common.multiplier'),'metricMode',{id:l.id,k:'f'},md('f'))}${btn(tr('common.cost'),'metricMode',{id:l.id,k:'w'},md('w'))}</div>
|
||||
<div class="metric-in"><input class="t" id="metIn" type="number" inputmode="decimal" min="${lo}" max="${hi}" step="${k==='w'?1:0.1}" value="${cm.v}" data-id="${esc(l.id)}" aria-label="${esc(k==='w'?tr('common.cost'):tr('common.multiplier'))}">${btn(tr('common.set'),'metricSet',{id:l.id},'pink sm')}</div>
|
||||
<p class="meta">${k==='w'?tr('link_panels.cost_the_exact_number_whatever_the'):tr('link_panels.multiplier_scales_the_distance_cost')} ${tr('link_panels.cost_on_this_link_w_allowed',{w:Math.round(pairW(key,l.km)),lo:k==='w'?lo:'×'+lo,hi:k==='w'?hi:'×'+hi})}</p>`;}
|
||||
// Standby only means something next to another link; a link left on standby alone can still be taken off it.
|
||||
if(pl.length>1||sb){const busy=(R.load[l.id]||0)>1e-3,alone=!pl.some(x=>x!==l&&!x.standby&&!linkDown(x));
|
||||
const st=!sb?tr('link_panels.a_link_on_standby_carries_traffic'):!busy?tr('link_panels.on_standby_idle_while_the_other'):alone?tr('link_panels.on_standby_but_carrying_the_traffic'):tr('link_panels.on_standby_taking_the_overflow');
|
||||
|
|
|
|||
|
|
@ -38,5 +38,5 @@ cv.addEventListener('pointerup',endPtr);cv.addEventListener('pointercancel',canc
|
|||
const ZMIN=0.35,ZMAX=16;
|
||||
function zoomAt(mx,my,f){const wx=cam.x+(mx-CW/2)/cam.z,wy=cam.y+(my-CH/2)/cam.z;cam.z=clamp(cam.z*f,ZMIN,ZMAX);cam.x=wx-(mx-CW/2)/cam.z;cam.y=wy-(my-CH/2)/cam.z;wrapCam();}
|
||||
cv.addEventListener('wheel',e=>{e.preventDefault();zoomAt(e.clientX,e.clientY,Math.exp(-e.deltaY*0.0015));},{passive:false});
|
||||
addEventListener('keydown',e=>{if(e.target.closest&&e.target.closest('input,textarea,select,[contenteditable]'))return;if(e.ctrlKey||e.metaKey||e.altKey)return;if(e.code==='Space'&&e.target.closest&&e.target.closest('button,a'))return;if(e.code==='Space'){e.preventDefault();UI.speed=UI.speed?0:1;renderHUD();}if(e.key==='0')ACT.speed({v:0.5});if(e.key==='1')ACT.speed({v:1});if(e.key==='2')ACT.speed({v:2});if(e.key==='3')ACT.speed({v:4});if(e.key==='4')ACT.speed({v:8});if(e.key==='Escape'&&!$('bankBox').hidden){$('bankBox').hidden=true;return;}if(e.key==='Escape'&&!$('dash').hidden){$('dash').hidden=true;return;}if(e.key==='Escape'){if(!$('modal').hidden){if(S&&UI.started&&!S.lost)closeModal();}else{UI.sel=null;renderPanel();}}});
|
||||
addEventListener('keydown',e=>{if(e.key==='Enter'&&e.target.id==='metIn'){ACT.metricSet({id:e.target.dataset.id});return;}if(e.target.closest&&e.target.closest('input,textarea,select,[contenteditable]'))return;if(e.ctrlKey||e.metaKey||e.altKey)return;if(e.code==='Space'&&e.target.closest&&e.target.closest('button,a'))return;if(e.code==='Space'){e.preventDefault();UI.speed=UI.speed?0:1;renderHUD();}if(e.key==='0')ACT.speed({v:0.5});if(e.key==='1')ACT.speed({v:1});if(e.key==='2')ACT.speed({v:2});if(e.key==='3')ACT.speed({v:4});if(e.key==='4')ACT.speed({v:8});if(e.key==='Escape'&&!$('bankBox').hidden){$('bankBox').hidden=true;return;}if(e.key==='Escape'&&!$('dash').hidden){$('dash').hidden=true;return;}if(e.key==='Escape'){if(!$('modal').hidden){if(S&&UI.started&&!S.lost)closeModal();}else{UI.sel=null;renderPanel();}}});
|
||||
|
||||
|
|
|
|||
|
|
@ -869,10 +869,12 @@
|
|||
"common.controller_off":"controller off",
|
||||
"common.cooling_failure":"Cooling failure",
|
||||
"common.copy":"Copy",
|
||||
"common.cost":"Cost",
|
||||
"common.costs":"Costs",
|
||||
"common.courtesy_route":"Courtesy route",
|
||||
"common.crashes_more":"crashes more",
|
||||
"common.credit_rating":"Credit rating",
|
||||
"common.custom":"Custom",
|
||||
"common.customer":"Customer",
|
||||
"common.customer_care":"Customer Care",
|
||||
"common.customer_levels":"Customer levels",
|
||||
|
|
@ -1068,6 +1070,7 @@
|
|||
"common.more_scenarios":"More scenarios",
|
||||
"common.ms_ms_one_way":"{ms} ms one-way",
|
||||
"common.mtu_mismatch":"MTU mismatch",
|
||||
"common.multiplier":"Multiplier",
|
||||
"common.mystery_link":"Mystery link",
|
||||
"common.n_box":{"one":"{n} box","other":"{n} boxes"},
|
||||
"common.n_days_left":"{n} days left",
|
||||
|
|
@ -1225,6 +1228,7 @@
|
|||
"common.serious_backbone":"Serious backbone",
|
||||
"common.serve_as_much_traffic_as_you":"Serve as much traffic as you can in one year.",
|
||||
"common.service_affected":"Service affected",
|
||||
"common.set":"Set",
|
||||
"common.settings":"Settings",
|
||||
"common.share":"Share",
|
||||
"common.share_2cd9":"Share…",
|
||||
|
|
@ -2100,6 +2104,7 @@
|
|||
"link_modal.you_already_have_n_link_here":{"one":"You already have {n} link here ({list}). Parallel links add capacity. How should this one be routed?","other":"You already have {n} links here ({list}). Parallel links add capacity. How should this one be routed?"},
|
||||
"link_panels.a_bigger_fabric_carries_more_traffic":"A bigger fabric carries more traffic and has room for more members. Your router here still has to keep up.",
|
||||
"link_panels.a_link_on_standby_carries_traffic":"A link on standby carries traffic only when the other links between these cities are full or down.",
|
||||
"link_panels.a_link_s_cost_is_its":"A link’s cost is its length in km plus 60, times a multiplier. Traffic takes the path with the lowest total cost.",
|
||||
"link_panels.a_regen_site_turns_the_light":"A regen site turns the light back into bits halfway and sends it on fresh, so optics only have to reach the next site. Each needs a regen card for every lit channel. {price}/mo per site for the hut.",
|
||||
"link_panels.abandon_the_fiber":"Abandon the fiber",
|
||||
"link_panels.add_parallel_link":"Add parallel link",
|
||||
|
|
@ -2116,6 +2121,8 @@
|
|||
"link_panels.collecting_data_check_back_in_a":"Collecting data. Check back in a few days.",
|
||||
"link_panels.congested_upgrade_it_or_add_a":"Congested. Upgrade it or add a parallel path.",
|
||||
"link_panels.connected_but_tight":"Connected, but tight.",
|
||||
"link_panels.cost_on_this_link_w_allowed":"Cost on this link: {w}. Allowed: {lo} to {hi}.",
|
||||
"link_panels.cost_the_exact_number_whatever_the":"Cost: the exact number, whatever the distance.",
|
||||
"link_panels.dark_fiber_kind_km_km":"Dark fiber · {kind} · {km} km",
|
||||
"link_panels.de_kicks_personalised_pricing_p_of":"DE-KICKS personalised pricing: {p}% of what a normal IX would charge (promo, {n} days left).",
|
||||
"link_panels.de_kicks_personalised_pricing_p_of_3d4f":"DE-KICKS personalised pricing: {p}% of what a normal IX would charge.",
|
||||
|
|
@ -2139,6 +2146,7 @@
|
|||
"link_panels.lost_on_the_way":"Lost on the way",
|
||||
"link_panels.mainland_china_plays_by_its_own":"Mainland China plays by its own rules. {list} and other foreign services are blocked here, so users mostly reach Chinese networks. Traffic crossing the border loses about {pct} to filtering and congestion, unless it rides a premium route: CN-Too transit or a premium cross-border circuit (both sold only in Hong Kong), or a PNI with a Chinese network. Revenue per user is lower here.",
|
||||
"link_panels.members_paying_you":"Members paying you",
|
||||
"link_panels.multiplier_scales_the_distance_cost":"Multiplier: scales the distance cost, so a longer link still costs more.",
|
||||
"link_panels.n_amp_huts":"{n} amp huts",
|
||||
"link_panels.n_amplifiers":"{n} amplifiers",
|
||||
"link_panels.n_exchanges_compete_in_city_members":"{n} exchanges compete in {city}. Members overlap, but not completely, and the challengers undercut the incumbent. Small networks often sit on just one of them.",
|
||||
|
|
@ -2184,6 +2192,7 @@
|
|||
"link_panels.port_port_price_on_request":"{port} port <small>Price on request ☎</small>",
|
||||
"link_panels.ports_at_p_of_the_usual":"Ports at {p}% of the usual price.",
|
||||
"link_panels.ports_up_to_port_are_free":"Ports up to {port} are free.",
|
||||
"link_panels.presets_on_this_link_list":"Presets on this link: {list}.",
|
||||
"link_panels.price_n_days":"{price} · {n} days",
|
||||
"link_panels.put_this_link_on_standby":"Put this link on standby",
|
||||
"link_panels.ready_for_a_pni_in_city":"Ready for a PNI in {city}",
|
||||
|
|
@ -2230,7 +2239,7 @@
|
|||
"link_panels.your_joint_venture_holds_an":"Your joint venture holds an operating license.",
|
||||
"link_panels.your_own_build":"your own build",
|
||||
"link_panels.your_own_fabric_name":"Your own fabric · {name}",
|
||||
"link_panels.your_routers_pick_the_lowest_cost":"Your routers pick the lowest-cost path. Raise the metric to push traffic onto other paths. “Backup only” keeps it idle unless nothing else works. Applies to every link between these two cities.",
|
||||
"link_panels.your_routers_pick_the_lowest_cost_0160":"Your routers pick the lowest-cost path. Raise the metric to push traffic onto other paths. “Backup only” keeps it idle unless nothing else works. Pick Custom to set your own multiplier or cost. Applies to every link between these two cities.",
|
||||
"link_panels.your_traffic_crossing_the_border":"Your traffic crossing the border",
|
||||
"link_panels.your_wave_was_sold_before_the":"Your wave was sold before the cable owner re-engineered it, so it keeps running.",
|
||||
"links.a_fab_fabric_unlocks_at_customer":"<b>A {fab} fabric unlocks at customer level {lv}.</b>",
|
||||
|
|
|
|||
|
|
@ -97,6 +97,7 @@ label.f{display:block;font-weight:900;font-size:12px;letter-spacing:.06em;text-t
|
|||
input.t{width:100%;box-sizing:border-box;border:3px solid var(--ink);border-radius:12px;padding:8px 12px;font-family:var(--display);font-weight:800;font-size:18px;background:var(--soft)}
|
||||
.network-name{display:flex;flex-wrap:wrap;align-items:center;gap:8px}
|
||||
.network-name input.t{flex:1 1 240px;width:auto;min-width:0}
|
||||
.metric-in{display:flex;gap:6px;align-items:center;margin-top:6px}.metric-in input.t{flex:1 1 120px;width:auto;min-width:0;font-size:16px;padding:4px 10px}
|
||||
.plug{display:flex;gap:12px;align-items:center;border:3px solid var(--ink);border-radius:14px;padding:10px 12px;margin:10px 0 4px;background:var(--soft);box-shadow:0 3px 0 var(--ink);color:var(--ink);text-decoration:none}
|
||||
.plug:hover{background:#FFF6D6}.plug .pi{font-size:30px;line-height:1}.plug b{font-family:var(--display);font-size:16px}.plug .meta{display:block;margin-top:2px}.plug .go{margin-left:auto;font-weight:900;white-space:nowrap}
|
||||
.starts{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}.starts .start:last-child:nth-child(odd){grid-column:1/-1}
|
||||
|
|
|
|||
|
|
@ -478,3 +478,118 @@ test('the broadband panel shows what homes in that city really pay, not the base
|
|||
assert.ok(ev("cityPanel('del')").includes(rev + '/mo'), `revenue line matches what the month pays (${rev})`);
|
||||
assert.deepEqual(errors, []);
|
||||
});
|
||||
|
||||
// Custom routing metrics: a fra–ams–par triangle where the direct fra–par link is normally shortest.
|
||||
const triangle = (ev) => {
|
||||
ev("ACT.start({});S.cash=1e9;S.lvl=4;for(const g of GOALS)S.done[g.id]=0;ACT.launchBB({city:'fra'})");
|
||||
ev("for(const c of ['ams','par'])ACT.buildPop({city:c});const L=(a,b)=>{UI.via=null;openLinkModal(a,b);ACT.buildLink({tier:1});closeModal();};L('fra','ams');L('ams','par');L('fra','par');compute()");
|
||||
ev("window.FP=S.links.find(l=>(l.a==='fra'&&l.b==='par')||(l.a==='par'&&l.b==='fra')).id;window.FK=edgeKey(S.links.find(l=>l.id===FP));window.pmOf=()=>S.pairMet[FK];window.hops=()=>JSON.stringify(trPaths('fra').path('par').map(h=>h.l.id))");
|
||||
};
|
||||
|
||||
test('a custom multiplier routes exactly like the matching preset', () => {
|
||||
const { ev, errors } = load();
|
||||
triangle(ev);
|
||||
assert.equal(ev("hops()"), JSON.stringify([ev("FP")]), 'direct link wins by default');
|
||||
ev("ACT.setMetric({id:FP,v:'avoid'})");
|
||||
const avoid = ev("JSON.stringify({h:hops(),load:R.load,served:R.served})");
|
||||
ev("ACT.setMetric({id:FP,v:'custom'})");
|
||||
assert.equal(ev("pairMet(FK)"), 'custom');
|
||||
const m = ev("pmOf()");
|
||||
assert.equal(m.k, 'f');
|
||||
assert.equal(m.v, 4, 'custom starts from the preset it replaces');
|
||||
assert.equal(ev("JSON.stringify({h:hops(),load:R.load,served:R.served})"), avoid);
|
||||
ev("ACT.setMetric({id:FP,v:'normal'})");
|
||||
assert.equal(ev("FK in S.pairMet"), false, 'presets drop the custom metric');
|
||||
assert.deepEqual(errors, []);
|
||||
});
|
||||
|
||||
test('an absolute custom cost steers the path, and switching modes keeps the cost', () => {
|
||||
const { ev, errors } = load();
|
||||
triangle(ev);
|
||||
ev("ACT.setMetric({id:FP,v:'custom'});ACT.metricMode({id:FP,k:'w'})");
|
||||
const l = ev("S.links.find(l=>l.id===FP)");
|
||||
assert.equal(ev("pmOf().k"), 'w');
|
||||
assert.equal(ev("pmOf().v"), Math.round(l.km + 60), 'switching to cost keeps the effective metric');
|
||||
ev("ACT.selLink({id:FP});renderAll();$('metIn').value='65535';ACT.metricSet({id:FP})");
|
||||
assert.equal(ev("pmOf().v"), 65535);
|
||||
assert.ok(!JSON.parse(ev("hops()")).includes(ev("FP")), 'a huge cost sends traffic round via Amsterdam');
|
||||
ev("renderAll();$('metIn').value='1';ACT.metricSet({id:FP})");
|
||||
assert.equal(ev("hops()"), JSON.stringify([ev("FP")]));
|
||||
ev("ACT.metricMode({id:FP,k:'f'})");
|
||||
assert.equal(ev("pmOf().v"), 0.1, 'converted back to a multiplier, clamped to the minimum');
|
||||
assert.deepEqual(errors, []);
|
||||
});
|
||||
|
||||
test('custom metric input is validated and clamped', () => {
|
||||
const { ev, errors } = load();
|
||||
triangle(ev);
|
||||
ev("ACT.setMetric({id:FP,v:'custom'});ACT.selLink({id:FP});renderAll()");
|
||||
ev("$('metIn').value='';ACT.metricSet({id:FP})");
|
||||
assert.equal(ev("pmOf().v"), 1, 'empty input changes nothing');
|
||||
ev("renderAll();$('metIn').value='9999';ACT.metricSet({id:FP})");
|
||||
assert.equal(ev("pmOf().v"), 100);
|
||||
ev("renderAll();$('metIn').value='0';ACT.metricSet({id:FP})");
|
||||
assert.equal(ev("pmOf().v"), 0.1);
|
||||
ev("ACT.metricMode({id:FP,k:'x'});ACT.setMetric({id:FP,v:'bogus'})");
|
||||
assert.equal(ev("pairMet(FK)"), 'custom');
|
||||
assert.deepEqual(errors, []);
|
||||
});
|
||||
|
||||
test('custom metrics survive a save, and broken ones are repaired', () => {
|
||||
const { ev, errors } = load();
|
||||
triangle(ev);
|
||||
ev("ACT.setMetric({id:FP,v:'custom'});ACT.metricMode({id:FP,k:'w'});pmOf().v=777;S=migrate(JSON.parse(JSON.stringify(S)));compute()");
|
||||
assert.deepEqual(JSON.parse(ev("JSON.stringify(pmOf())")), { k: 'w', v: 777 });
|
||||
ev("S.pairMet[FK]={k:'zz',v:'lots'};S=migrate(JSON.parse(JSON.stringify(S)));compute()");
|
||||
assert.deepEqual(JSON.parse(ev("JSON.stringify(pmOf())")), { k: 'f', v: 1 });
|
||||
ev("S.pairMet[FK]={k:'w',v:1e9};S=migrate(JSON.parse(JSON.stringify(S)))");
|
||||
assert.equal(ev("pmOf().v"), 65535);
|
||||
// An old save: a preset metric on the link itself, from before metrics moved to the city pair.
|
||||
ev("delete S.pairMet[FK];S.links.find(l=>l.id===FP).metric='avoid';S=migrate(JSON.parse(JSON.stringify(S)));compute()");
|
||||
assert.equal(ev("pmOf()"), 'avoid');
|
||||
assert.equal(ev("'metric' in S.links.find(l=>l.id===FP)"), false);
|
||||
assert.equal(JSON.parse(ev("hops()")).length, 2, 'the old save still routes, avoiding the direct link');
|
||||
assert.deepEqual(errors, []);
|
||||
});
|
||||
|
||||
test('preset buttons stay plain, and Custom explains the numbers, also on phones', () => {
|
||||
const { ev, dom, errors } = load();
|
||||
triangle(ev);
|
||||
for (const w of [1280, 390]) {
|
||||
ev(`window.innerWidth=${w};ACT.setMetric({id:FP,v:'normal'});ACT.selLink({id:FP});renderAll()`);
|
||||
const doc = dom.window.document;
|
||||
const btns = [...doc.querySelectorAll('#panel [data-act="setMetric"]')];
|
||||
assert.equal(btns.length, 5);
|
||||
const km = ev("S.links.find(l=>l.id===FP).km");
|
||||
assert.deepEqual(btns.map(b => b.textContent), ['Prefer', 'Normal', 'Avoid', 'Backup only', 'Custom']);
|
||||
assert.equal(doc.getElementById('metIn'), null);
|
||||
assert.doesNotMatch(doc.getElementById('panel').textContent, /times a multiplier/);
|
||||
ev("ACT.setMetric({id:FP,v:'custom'})");
|
||||
assert.ok(doc.getElementById('metIn'), `custom editor at ${w}px`);
|
||||
assert.ok(doc.querySelector('#panel [data-act="metricMode"]'));
|
||||
const txt = doc.getElementById('panel').textContent;
|
||||
assert.match(txt, /times a multiplier/);
|
||||
assert.match(txt, new RegExp(`Normal ×1 = ${Math.round(km + 60)}, Avoid ×4 = ${Math.round((km + 60) * 4)}`));
|
||||
assert.match(txt, /Multiplier: scales the distance cost/);
|
||||
assert.match(txt, /Cost on this link/);
|
||||
ev("ACT.metricMode({id:FP,k:'w'})");
|
||||
assert.match(doc.getElementById('panel').textContent, /Cost: the exact number/);
|
||||
}
|
||||
assert.deepEqual(errors, []);
|
||||
});
|
||||
|
||||
test('a custom metric belongs to the city pair, like the presets, and a standby link keeps it', () => {
|
||||
const { ev, errors } = load();
|
||||
triangle(ev);
|
||||
ev("UI.via=null;openLinkModal('fra','par');ACT.buildLink({tier:1});closeModal();compute()");
|
||||
ev("ACT.setMetric({id:FP,v:'custom'});ACT.metricMode({id:FP,k:'w'});ACT.selLink({id:FP});renderAll();$('metIn').value='65535';ACT.metricSet({id:FP})");
|
||||
const other = ev("S.links.find(l=>l.id!==FP&&edgeKey(l)===FK).id");
|
||||
assert.equal(ev(`pairMet(edgeKey(S.links.find(l=>l.id==='${other}')))`), 'custom', 'the second link between the cities shares it');
|
||||
ev(`ACT.setStandby({id:'${other}',on:1})`);
|
||||
assert.ok(!JSON.parse(ev("hops()")).includes(ev("FP")), 'the pair is still avoided');
|
||||
assert.equal(ev("pmOf().v"), 65535);
|
||||
// Removing every link of the pair drops the metric with it.
|
||||
ev("S.links=S.links.filter(l=>edgeKey(l)!==FK);prunePairMet()");
|
||||
assert.equal(ev("FK in S.pairMet"), false);
|
||||
assert.deepEqual(errors, []);
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue