Keep the Connections list working with 400G fabric ports (#342)

This commit is contained in:
Germain Carré 2026-11-11 15:35:50 +01:00 • committed by GitHub
parent e27e9e3066
commit e2b3615a19
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 14 additions and 1 deletions

View file

@ -7,6 +7,7 @@ All notable changes to this project are documented here. The project follows
## [Unreleased]
- Alien waves you list on a fiber yourself now stay listed. With the capacity market selling for you, the broker used to cut your listing down to what its settings allowed the next day, or take it off altogether when the route's demand was below your minimum. Your own listing now stays put, and the broker adds what its settings allow on top (#340).
- The Connections list in the NOC dashboard no longer stays blank when you sort it by load or show only NNI ports while a fabric port runs at 400G. A 400G fabric port is the fastest there is, so the list now offers it one more LAG member instead of a faster port that does not exist.
## [3.4.0] — 2026-11-10

View file

@ -26,7 +26,7 @@ function connUp(r){if(r.mine)return '';const nx=t=>PORT[t+1]&&portShown(t+1)?t+1
if(i>=0)h+=btn(tr('common.upgrade_port_price',{port:PORT[i].n,price:portMo(ixPortMo(c,i)*n)}),'buyIx',{city:c,tier:i},'sm',(!!S.pops[city]&&!portOk(city,i))||(!S.pops[city]&&i>1));
if(S.pops[city]&&!S.myIx[c]&&n<LAG_MAX)h+=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]));}
else if(r.k==='c')h+=btn(tr('common.box'),'cache',{city:r.city,net:r.net},'sm');
else if(r.k==='nni'){const [city,prov]=r.id.split('|'),pt=nniPort(city,prov);if(!pt)return '';const n=pt.n||1,i=nx(pt.tier);
else if(r.k==='nni'){const [city,prov]=r.id.split('|'),pt=nniPort(city,prov);if(!pt)return '';const n=pt.n||1,i=NNI[pt.tier+1]?nx(pt.tier):-1;// fabric ports stop at 400G
if(i>=0){const c=NNI[i].mo*n;h+=btn(n>1?tr('common.upgrade_all_to_port_cost_mo',{port:NNI[i].n,cost:fmt$(c),mo:fmt$(c)}):tr('common.upgrade_port_price_mo',{port:NNI[i].n,price:fmt$(c)}),'buyNni',{city,prov,tier:i},'sm',S.cash<c||!portOk(city,i));}
if(n<LAG_MAX)h+=btn(tr('common.lag_member_price',{price:portMo(NNI[pt.tier].mo)}),'lagNni',{city,prov,d:1},'sm',S.cash<NNI[pt.tier].mo||!portOk(city,pt.tier));}
return h;}

View file

@ -136,3 +136,15 @@ test('saves: fabric ports that make no sense are dropped, LAGs are kept in bound
assert.equal(ev('R.cost.nni'), 500, 'a 10G port from before costs what it did');
assert.deepEqual(errors, []);
});
test('a 400G fabric port in the Connections list offers a LAG member and no faster port, whatever the sort', () => {
const { ev, errors } = open();
ev(`S.pops.fra.rgen=${fast(5)};ACT.buyNni({city:"fra",prov:FB,tier:2});compute()`);
assert.ok(ev('portShown(3)'), 'an 800G port is on sale, so nothing stops the list from offering one');
for (const [k, cf] of [['use', '{}'], ['k', "{k:'nni'}"]]) {
const h = ev(`UI.connSort='${k}';UI.connDir=-1;UI.cf=${cf};connSection()`);
assert.match(h, /data-act="lagNni"/, `sorted by ${k}`);
assert.doesNotMatch(h, /data-act="buyNni"/, `sorted by ${k}: no 800G fabric port`);
}
assert.deepEqual(errors, []);
});