feat(peering): step exchange ports, transit ports and PNIs down one size

Shrinking a port meant leaving and rejoining. The exchange, transit and PNI panels now have a button that steps the port down one size (downIx, downT, downP). A PNI cannot step down while an augment is on order. The actions are classified in the MCP command table.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Lambro-codes 2026-11-04 05:36:04 +01:00
parent b2366ed260
commit 35854ee253
13 changed files with 100 additions and 3 deletions

View file

@ -0,0 +1,9 @@
/* Step a port down one size: exchange ports, transit ports and PNIs. Upgrading was possible, downsizing meant leaving and rejoining. */
Object.assign(ACT,{
downIx:({city})=>{const had=S.ixp[city];if(had===undefined||S.myIx[city]||!(had>0))return;
S.ixp[city]=had-1;toast(tr('ix_downgrade.port_downgraded_at_ix',{port:PORT[had-1].n,ix:esc(ixName(city))}),'good');sfx('click');after();},
downT:({id})=>{const t=S.transit.find(x=>x.id===id);if(!t||!(t.tier>0))return;t.tier--;
toast(tr('ix_downgrade.transit_downgraded',{net:esc(NET[t.net].name),city:CITY[t.city].name,port:lagName(t.tier,t.n)}),'good');sfx('click');after();},
downP:({id})=>{const p=S.pni.find(x=>x.id===id);if(!p||!pniOn(p)||p.up||p.g1||!(p.tier>0))return;p.tier--;
toast(tr('ix_downgrade.pni_downgraded',{net:esc(NET[p.net].name),city:CITY[p.city].name,port:pniPN(p)}),'good');sfx('click');after();},
});