PNI buttons show the monthly port fee next to the setup cost (#110)

The buy buttons only showed the one-off setup (1500 + setup/2), so a
$1.8k cross-connect read like a monthly bill, while the real monthly
fee (PORT[i].pni) was shown nowhere. Reuse the existing translated
'{port} <small>{cost} + {mo}/mo</small>' label, like transit and IX.
This commit is contained in:
clayberF 2026-10-26 10:16:43 -03:00
parent b0684bca82
commit 497f970eac
3 changed files with 11 additions and 1 deletions

View file

@ -6,6 +6,8 @@ All notable changes to this project are documented here. The project follows
## [Unreleased]
- PNI buttons now show the monthly port fee next to the one-off setup cost, like IX ports do, so a $1.8k cross-connect no longer looks like a monthly bill (#110).
## [1.30.0] — 2026-10-26
- Twelve Pacific islands join the map: Honolulu, Guam, Koror, Majuro, Port Moresby, Honiara, Nouméa, Suva, Nuku’alofa, Apia, Pago Pago and Papeete. The cables across the Pacific now stop where they really land, and a POP on an island splits a long crossing into shorter hops that each carry more: California to Sydney goes from 400G to 1.6T per wave via Honolulu and Suva, Hong Kong and Manila to Los Angeles from 400G to 800G via Guam, and Santiago to Sydney from 400G to 800G via Tahiti. Twelve new cables, among them SEA-US Later, Echo-Chamber and Coral Sea Shanty, link the islands, and the old ones gain island stops. Only islands with a real exchange today get one: Honolulu, Guam, Suva, Nouméa and Honiara. Island telcos from Hawaiian Telecombo to Never Too Atoll join the networks, PacNOG meets in Suva every December, Guam, Port Moresby and Honiara have unreliable power, Tonga’s cable has a volcano for a neighbour, and a new scenario, Stepping Stones, asks you to hop the Pacific at 1.6T.

View file

@ -3371,7 +3371,7 @@ function cityPanel(c){
for(const n of here){const pn=S.pni.find(x=>x.city===c&&x.net===n.id),chk=peerOk(n.id,'pni',c);
h+=`<div class="row">${logo(n)}<div class="grow"><div class="nm">${esc(n.name)} <span class="tag ${n.pol}">${n.pol}</span></div>`;
if(pn){const u=R.usePni[pn.id]||0,cap=lagCap(PORT[pn.tier].g,pn.n);h+=`<div class="kv"><span>${(pn.n||1)>1?`${pn.n}×${PORT[pn.tier].n} LAG`:PORT[pn.tier].n} PNI</span><b>${fmtG(u)}</b></div><div class="bar ${barCls(u/cap)}"><i style="width:${u/cap*100}%"></i></div>${prefCtl('p',pn.id,pn.pref)}${siteCtl('p',pn.id,c,pn.site)}<div class="btns">${PORT.map((P2,i)=>i>pn.tier?btn((pn.n||1)>1?tr('Upgrade all to {port} <small>{cost}</small>',{port:P2.n,cost:fmt$((1500+P2.setup/2)*(pn.n||1))}):tr('Upgrade {port} <small>{cost}</small>',{port:P2.n,cost:fmt$((1500+P2.setup/2)*(pn.n||1))}),'pni',{city:c,net:n.id,tier:i},'sm',!portOk(c,i)||S.cash<(1500+P2.setup/2)*(pn.n||1)):'').join('')}${(pn.n||1)<LAG_MAX?btn(tr('+ LAG member <small>{cost} + {mo}/mo</small>',{cost:fmt$(1500+PORT[pn.tier].setup/2),mo:fmt$(PORT[pn.tier].pni)}),'lagP',{id:pn.id,d:1},'sm',S.cash<1500+PORT[pn.tier].setup/2):''}${(pn.n||1)>1?btn(tr('− member'),'lagP',{id:pn.id,d:-1},'ghost sm'):''}${NET[n.id].cn?btn(pn.sacrif?tr('Sacrificial choke ✓'):tr('Make sacrificial <small>contains floods · ½ capacity</small>'),'sacrif',{id:pn.id},pn.sacrif?'green sm':'sm'):''}${btn(UI.confirm===pn.id?tr('Really remove?'):tr('Remove'),'cancelPni',{id:pn.id},'ghost sm')}</div>`;}
else{h+=chk.ok?`<div class="btns">${PORT.map((P2,i)=>portShown(i)?btn(`${P2.n} <small>${fmt$(1500+P2.setup/2)}</small>`,'pni',{city:c,net:n.id,tier:i},'sm',S.cash<1500+P2.setup/2||!portOk(c,i)):'').join('')}</div>${chk.fee?`<div class="meta">${tr('Paid peering: {price}/mo on top',{price:fmt$(chk.fee)})}</div>`:''}`:`<div class="why">${esc(chk.why)}</div>`;}
else{h+=chk.ok?`<div class="btns">${PORT.map((P2,i)=>portShown(i)?btn(tr('{port} <small>{cost} + {mo}/mo</small>',{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>${chk.fee?`<div class="meta">${tr('Paid peering: {price}/mo on top',{price:fmt$(chk.fee)})}</div>`:''}`:`<div class="why">${esc(chk.why)}</div>`;}
h+=`</div></div>`;}
h+=`</section><section><h3>${tr('Embedded caches')}</h3><p class="lead">${tr('CDNs put free cache servers inside your POP. Most of their traffic is then served right here, with no transit and no IX port.')}</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;

View file

@ -1139,3 +1139,11 @@ test('#107 a bigger optic never carries less than a smaller one at the same dist
assert.equal(ev("optMode('tp32',{km:7000,sub:true,regen:0}).g"), 1200);
assert.deepEqual(errors, []);
});
test('#110 PNI buttons show the monthly port fee, not just the one-off setup', () => {
const { ev, errors } = load();
ev("ACT.start({});S.cash=1e9;S.lvl=6;for(const g of GOALS)S.done[g.id]=0;ACT.launchBB({city:'fra'});selectCity('fra');ACT.tab({t:'peer'})");
const txt = ev("document.getElementById('panelBody').textContent");
assert.match(txt, /10G \$1\.8k \+ \$200\/mo/, 'setup plus the monthly fee, like IX ports and LAG members');
assert.deepEqual(errors, []);
});