From 05bb2b680aca69fb6f11eee4a9e34a025ffa5b23 Mon Sep 17 00:00:00 2001 From: Frederic Jung Date: Sun, 25 Oct 2026 20:34:00 +0100 Subject: [PATCH] NOC: incidents first, paid one-click fixes at the top (#63) --- CHANGELOG.md | 1 + site/index.html | 3 ++- tests/issues.test.js | 15 +++++++++++++++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f3e572f..a3bf802 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ All notable changes to this project are documented here. The project follows ## [Unreleased] +- Incidents now come first in the NOC, with the ones you can fix in one click at the top (#63). No more scrolling past hot ports and congested links to replace a broken optic. - Embedded caches can now sit in either building of a two-site metro (#69). A new box goes to the building with fewer of them, you can move boxes between A and B in the Peering tab, and a dark building only takes out the boxes inside it. - Customers in Russian cities no longer get unhappy because of Goggle's throttling (#70). People there simply get, and ask for, half as much Goggle video, so a well-built network serves the whole city again and the throttled half no longer fills your links. - Four new cities in North America: Kansas City, Calgary, Vancouver and Ottawa (#76). Canada gets two more big networks, Tell Us and Bodgers Communications, which you also reach through the Tier 1s they buy transit from. Ottawa's power grid is about as reliable as you would expect, and Canadian fiber has a new natural enemy. diff --git a/site/index.html b/site/index.html index b97bb2a..33c1093 100644 --- a/site/index.html +++ b/site/index.html @@ -2968,6 +2968,8 @@ function renderLeft(){checkLayer(); }else if(UI.left==='noc'){ h+=`
${btn(tr('Open NOC dashboard'),'dash',{},'pink')}${btn(tr('Connections'),'connOpen',{},'')}${btn(tr('Traceroute'),'trace',{},'')}
`; h+=`

${tr('Your Network Operations Center. Every notification also lands here. Things fail all the time on the internet. Redundant links and multiple upstreams let traffic reroute by itself.')}

`; + // Incidents come first, the ones you can fix with one click at the top (#63): no scrolling past hot ports to replace an optic. + for(const i of S.inc.filter(i=>i.type!=='ddos').sort((a,b)=>(b.cost?1:0)-(a.cost?1:0)||(b.impact||0)-(a.impact||0))){h+=`
${incTitle(i.type)}
${esc(i.msg)}
${trn('Auto-fix in {n} day','Auto-fix in {n} days',i.until-S.day)}${i.impact?` · ${tr('{g} lost',{g:fmtG(i.impact)})}`:''}
${i.cost?`
${btn(`${esc(i.fix||tr('Rush repair'))} ${fmt$(i.cost)}`,'fixInc',{id:i.id},'red sm',S.cash`:''}
`;} h+=`
${tr('DDoS scrubbing')}${S.scrubAt?tr('On · {city}',{city:CITY[S.scrubAt].name}):tr('None (build one from a POP\'s Infra tab)')}
`; {const pops=Object.keys(S.pops),nfs=pops.filter(c=>fsAt(c)).length; h+=`
${tr('Flowspec-capable POPs')}${nfs}/${pops.length}
`; @@ -2981,7 +2983,6 @@ function renderLeft(){checkLayer(); const hotR=hotPorts(); if(hotR.length)h+=`

${tr('Ports, caches and routers running hot')}

`+hotR.map(x=>`
${HOTL[x.k]}
${CITY[x.city].name} · ${esc(x.lab)}
${tr('{p} full',{p:pct(Math.min(1,x.u))})}${x.u>=0.995?' · '+tr('dropping or overflowing'):''} · ${esc(x.tip)}
${btn(tr('Inspect'),'focusCity',{city:x.city},'pink sm')}
`).join(''); if(!S.inc.length&&!hot.length&&!hotR.length)h+=`

${tr('All systems green. Enjoy it while it lasts.')}

`; - for(const i of S.inc){if(i.type==='ddos')continue;h+=`
${incTitle(i.type)}
${esc(i.msg)}
${trn('Auto-fix in {n} day','Auto-fix in {n} days',i.until-S.day)}${i.impact?` · ${tr('{g} lost',{g:fmtG(i.impact)})}`:''}
${i.cost?`
${btn(`${esc(i.fix||tr('Rush repair'))} ${fmt$(i.cost)}`,'fixInc',{id:i.id},'red sm',S.cash`:''}
`;} if(S.log&&S.log.length){h+=`

${tr('Recent events')}

`+S.log.slice(0,15).map(e=>`
${dateStr(e.d)} ${esc(e.t)}
`).join('');} h+=`
${tr('Incidents so far')}${S.stats.incidents}
${tr('Survived with no impact')}${S.stats.survived}
`; }else{ diff --git a/tests/issues.test.js b/tests/issues.test.js index 422cc90..1253cd8 100644 --- a/tests/issues.test.js +++ b/tests/issues.test.js @@ -976,3 +976,18 @@ test('#69 embedded caches can sit in either metro building, so one dark building assert.equal(ev("S.caches.every(x=>x.site==='a')"), true); assert.deepEqual(errors, []); }); + +test('#63 incidents you can fix with one click sit above hot ports in the NOC', () => { + const { ev, errors } = load(); + ev("ACT.start({});S.cash=1e8;for(const g of GOALS)S.done[g.id]=0;ACT.launchBB({city:'fra'});ACT.buyTransit({city:'fra',net:'cog',tier:0});compute()"); + ev("R.useT[S.transit[0].id]=10;window.hotPorts=()=>[{k:'t',city:'fra',lab:'Cogentle transit',u:0.97,tip:'Upgrade it.'}]"); + ev("S.inc.push({id:'x1',type:'loss',ref:'l',until:S.day+5,msg:'Free one',start:S.day},{id:'x2',type:'optic',ref:'l',until:S.day+9,msg:'A transceiver died.',cost:7000,fix:'Replace the optic',start:S.day})"); + ev("UI.left='noc';UI.leftOpen=true;UI.sel=null;renderLeft()"); + const t = ev("document.getElementById('leftBody').textContent"); + const fix = t.indexOf('Replace the optic'), hot = t.indexOf('running hot'), free = t.indexOf('Free one'); + assert.ok(fix >= 0 && hot >= 0 && free >= 0, 'all three are shown'); + assert.ok(fix < hot, 'the paid fix comes before the hot ports'); + assert.ok(fix < free, 'and before incidents without a fix'); + assert.ok(t.indexOf('DDoS scrubbing') > fix, 'status lines come after the incidents'); + assert.deepEqual(errors, []); +});