Show traffic, price per Gbps and path terms on renewal haggles; link panel city names open the city

Renewal haggles in Deals now show booked and served Gbps (sites for SD-WAN), the
price per Gbps now and asked, and the latency limit and path terms the customer
signed for, each ticked as the network stands today (#292).

The two city names in the header of wave, dark fiber and virtual circuit panels
are buttons that open that city (#196).
This commit is contained in:
Frederic Jung 2026-11-10 06:51:34 +00:00
parent 80baa970e7
commit d086fcbd92
No known key found for this signature in database
12 changed files with 186 additions and 4 deletions

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, []);
});