Merge remote-tracking branch 'origin/main' into claude/latency-contracts
# Conflicts: # CHANGELOG.md
This commit is contained in:
commit
12ce66b33a
36 changed files with 881 additions and 23 deletions
|
|
@ -38,6 +38,8 @@ const API_DOMAINS={
|
|||
opsKey:{table:'OPSK',kind:'key'},
|
||||
opsPopKind:{kind:'enum',values:()=>OPS_POP.slice()},
|
||||
opsTplKey:{kind:'enum',values:()=>OPS_TPL.slice()},
|
||||
// The three POP standards (#315).
|
||||
popTier:{kind:'enum',values:()=>POP_TIERS.slice()},
|
||||
// The specialist's offers: a seat on a consortium cable, the charter, a vendor demo.
|
||||
seatPairs:{kind:'enum',values:()=>SEAT_N.slice()},
|
||||
callAmount:{kind:'enum',values:()=>CALL_AMTS.slice()},
|
||||
|
|
|
|||
|
|
@ -239,6 +239,10 @@ const API_CMD={
|
|||
/* ---------- customers ---------- */
|
||||
accept:{args:[['id','entityId']],
|
||||
doc:'Sign a pending offer. Rejected without a POP in every city it needs, without free channels for a wave sale, or after an event\'s start date. Extra waves for a carrier you already serve grow that contract.'},
|
||||
acceptFix:{args:[['id','entityId'],['cost','integer',false]],watch:['pops','biz','offers'],
|
||||
quote:a=>{const q=S?reqFix(S.offers.find(x=>x.id===a.id)):null;return q?{setup:q.cost,monthly:q.mo}:{setup:0};},
|
||||
pass:a=>({id:a.id,cost:a.cost??((reqFix(S.offers.find(x=>x.id===a.id))||{}).cost)}),
|
||||
doc:'Buy what an offer asks for at POPs you already have (backup generator, a second router, a second site), then sign it. Pass the quoted setup as cost; the game checks it still matches.'},
|
||||
decline:{args:[['id','entityId']],
|
||||
doc:'Throw an offer away.'},
|
||||
salesHire:{args:[['id','salesPersona']],
|
||||
|
|
@ -402,6 +406,22 @@ const API_CMD={
|
|||
quote:a=>{const q=S?utilityKit(a.city):null;return q?{setup:q.cost,monthly:q.mo}:{};},
|
||||
pass:a=>({city:a.city,cost:a.cost??((utilityKit(a.city)||{}).cost)}),
|
||||
doc:'Install the POP redundancy kit in one go: generator, second building, a second router, and the cache boxes balanced between sites. Pass the quoted setup as cost; the game checks it still matches. Nothing to do reads as no_effect.'},
|
||||
utilityKitAll:{args:[['cost','integer',false],['city','cityId',false]],watch:['pops','caches'],
|
||||
quote:a=>{const q=S?utilityKitAll():null;return q?{setup:q.cost,monthly:q.mo}:{setup:0};},
|
||||
pass:a=>({city:a.city,cost:a.cost??((utilityKitAll()||{}).cost)}),
|
||||
doc:'Install the redundancy kit at every POP still missing part of it, at one quoted price. From customer level 2. Pass the quoted setup as cost.'},
|
||||
utilityKitNew:{args:[['city','cityId',false]],watch:['ops'],
|
||||
doc:'Put the redundancy kit in the intern\'s new-POP template, or take it out (the same switch as in the Ops sheet).'},
|
||||
ptSave:{args:[['city','cityId'],['k','popTier']],watch:['popTiers'],
|
||||
doc:'Save a POP\'s routers (model and count) as one of three POP standards: micro, medium or hub. The POP is marked as that kind. From customer level 2.'},
|
||||
ptApply:{args:[['city','cityId'],['k','popTier'],['cost','integer',false]],watch:['pops.#city','popTiers'],
|
||||
quote:a=>{const q=S?ptPlan(a.city,a.k):null;return q?{setup:q.cost,monthly:q.mo,blocked:q.why?[q.why]:[]}:{setup:0};},
|
||||
pass:a=>({city:a.city,k:a.k,cost:a.cost??((S&&ptPlan(a.city,a.k))||{cost:0}).cost}),
|
||||
doc:'Mark a POP as one kind and bring its routers up to that standard: add routers, swap to the standard\'s model if it is bigger. Never a step down. Pass the quoted setup as cost.'},
|
||||
ptAll:{args:[['k','popTier'],['cost','integer',false],['city','cityId',false]],watch:['pops','popTiers'],
|
||||
quote:a=>{const A=S?ptAll(a.k):null;return A?{setup:A.cost}:{setup:0};},
|
||||
pass:a=>({k:a.k,city:a.city,cost:a.cost??(ptAll(a.k)||{}).cost}),
|
||||
doc:'Bring every POP marked as one kind up to that standard, at one quoted price. Pass the quoted setup as cost.'},
|
||||
utilityCaches:{args:[['city','cityId'],['quote','string',false]],watch:['caches'],
|
||||
quote:a=>{const q=S?utilityCaches(a.city):null;return q?{key:q.key}:{};},
|
||||
pass:a=>({city:a.city,quote:a.quote??((utilityCaches(a.city)||{}).key)}),
|
||||
|
|
@ -530,6 +550,9 @@ const API_VIEW={
|
|||
pniFilter:{args:[['f','pniFilter']],doc:'Filter the PNI list: all, via transit, worth it, already PNI.'},
|
||||
pniGrp:{args:[['g','string'],['o','boolean',false]],doc:'Fold or unfold one group of the PNI list.'},
|
||||
pniSort:{args:[],doc:'Flip the PNI list sort between A-Z and worth-it-first.'},
|
||||
netFind:{args:[['q','string']],doc:'Filter a POP\'s transit, exchange, PNI and cache lists by network name or AS number.'},
|
||||
netOnly:{args:[],doc:'Show only the networks you are connected to in a POP\'s lists, or all of them again.'},
|
||||
netClear:{args:[],doc:'Clear the network search and the connected-only switch.'},
|
||||
puzzleMenu:{args:[],doc:'Open the puzzle list.'},
|
||||
puzzleDoor:{args:[],doc:'From the title screen: open the puzzle list (keeps the typed name).'},
|
||||
pzFinish:{args:[],doc:'Puzzles only: run the star count and show the results sheet.'},
|
||||
|
|
|
|||
|
|
@ -62,6 +62,7 @@ const API_STATE_DOC={
|
|||
core:{type:'map',doc:'Your backbone technology: lv bought, the level it runs at, the interop lab.'},
|
||||
ddosAuto:{type:'map',doc:'The NOC\'s auto-mitigation switches: rtbh and scrub.'},
|
||||
popStd:{type:'map',doc:'The standard POP: router model and count new POPs start with, or null for none.'},
|
||||
popTiers:{type:'map',doc:'POP standards by kind: def.micro|medium|hub is {g: router model, rt: routers} or null; at maps a POP city to its kind.'},
|
||||
demo:{type:'map',doc:'Vendor demo units on order, by "kind:id" → ready day.'},
|
||||
seatOff:{type:'map',doc:'The pending consortium-cable seat offer: landings, km, name, expiry day.'},
|
||||
monkey:{type:'map',doc:'The chaos monkey: next visit day, whether it is in your network now, days left, whether anyone noticed.'},
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ function apiValidate(spec,args){
|
|||
// maps, and the paths a command declares in watch. R is left out: it is rebuilt after every action.
|
||||
const API_FP_LEN=['links','transit','pni','caches','biz','offers','nni','loans','loanOffers','inc','scrubs'];
|
||||
const API_FP_KEYS=['pops','ixp','peers','myIx','done','ach','merged','confReg'];
|
||||
const API_FP_JSON=['name','pairMet','rs','ixn','ixSite','ixPref','spares','te','cnLic','hw','scrubMode','ppol','ops','core','ddosAuto','popStd','demo','charter','monkey','seatOff','pz','ar','dk','ev'];
|
||||
const API_FP_JSON=['name','pairMet','rs','ixn','ixSite','ixPref','spares','te','cnLic','hw','scrubMode','ppol','ops','core','ddosAuto','popStd','popTiers','demo','charter','monkey','seatOff','pz','ar','dk','ev'];
|
||||
function apiFp(watch,args){
|
||||
if(!S)return null;
|
||||
const f={cash:S.cash,day:S.day,lvl:S.lvl||1,won:!!S.won,lost:!!S.lost};
|
||||
|
|
|
|||
20
src/game/60-features/39-req-fix.js
Normal file
20
src/game/60-features/39-req-fix.js
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
/* ---------- Buy what a customer asks for, on signing (#241) ----------
|
||||
Some requirements are hardware at a POP you already have: a backup generator, a second router, a second building.
|
||||
An offer that asks for them gets a second button that buys exactly what is missing and signs, with the price on it.
|
||||
Never silent: the player presses it, and nothing is bought unless the deal can be signed right after. */
|
||||
const REQ_FIX=['gen','routers','metro'];
|
||||
// What is missing for this offer, priced as the Infra tab's own buttons price it: [{k, city, cost, mo}], with totals.
|
||||
function reqFix(o){if(!o||!bHas(o)||pzOn())return null;const items=[],cs=[o.city,o.city2].filter(Boolean);
|
||||
for(const k of o.reqs||[]){if(!REQ_FIX.includes(k)||!REQS[k]||REQS[k].ok(o))continue;
|
||||
for(const c of k==='routers'?[o.city]:cs){const p=S.pops[c];if(!p||items.some(x=>x.k===k&&x.city===c))continue;
|
||||
if(k==='gen'&&!p.gen)items.push({k,city:c,cost:GEN_COST,mo:GEN_MO});
|
||||
else if(k==='metro'&&!p.site2)items.push({k,city:c,cost:SITE2_COST,mo:SITE2_MO});
|
||||
else if(k==='routers'&&(p.routers||1)<2){const g=p.rgen||0;items.push({k,city:c,cost:routerCost(g,p.routers||1),mo:routerMo(g)});}}}
|
||||
if(!items.length)return null;return {items,cost:items.reduce((a,x)=>a+x.cost,0),mo:items.reduce((a,x)=>a+x.mo,0)};}
|
||||
// Whether accept() would sign this offer now: the same checks, so money is never spent on a deal that then refuses.
|
||||
const reqFixCanSign=o=>bHas(o)&&!(BIZ_T[o.type].event&&S.day>=o.start);
|
||||
const REQ_FIX_L={gen:N_('req_fix.generator_in_city'),routers:N_('req_fix.second_router_in_city'),metro:N_('req_fix.second_site_in_city')};
|
||||
// The button and one line saying what it buys. sm: the button size the list around it uses.
|
||||
function reqFixHtml(o){const q=reqFix(o);if(!q||!reqFixCanSign(o))return '';
|
||||
return `<div class="meta">${tr('req_fix.buys_list',{list:q.items.map(x=>tr(REQ_FIX_L[x.k],{city:CITY[x.city].name})).join(', '),cost:fmt$(q.cost),mo:fmt$(q.mo)})}</div>
|
||||
<div class="btns">${btn(tr('req_fix.buy_and_sign',{cost:fmt$(q.cost)}),'acceptFix',{id:o.id,cost:q.cost},'pink sm',S.cash<q.cost)}</div>`;}
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
function newGame(name,home){
|
||||
S={v:1,name,asn:200000+Math.floor(_rand()*15000),home,day:0,cash:START_CASH,
|
||||
ltv:2,t1v:4,auV:1,calV:1,pieV:1,pie:null,ops:opsNew(),slAuto:slAutoNew(),achP:{},seen:NETS.map(n=>n.id),spares:{},pops:{[home]:{day:0,bb:null,boost:0,down:0,routers:1,gen:false}},links:[],nni:[],transit:[],ixp:{},rs:{},peers:{},pni:[],caches:[],biz:[],offers:[],myIx:{},pairMet:{},
|
||||
done:{},inc:[],fleet:{},ev:{ddosMore:[]},ddosStarts:[],priceMul:1,nextFail:45,nextEvent:40,usedNames:[],stats:{survived:0,incidents:0,peak:0},vol:0,cnLic:{state:'none'},scrubs:[],scrubMode:'always',ddosAuto:{rtbh:false,scrub:true},capDeal:null,core:{lv:0,run:0},popStd:null,won:false,lost:false,neg:0,loans:[],loanOffers:[],loanStrikes:0,ppol:'open',pdesk:null,pdeskRep:null,hw:{},rules:makeRules('oncall'),charter:'global',cm:cmNew(),chartSet:false,demo:{},seatOff:null,solWon:0,monkey:{next:null,on:0}};
|
||||
done:{},inc:[],fleet:{},ev:{ddosMore:[]},ddosStarts:[],priceMul:1,nextFail:45,nextEvent:40,usedNames:[],stats:{survived:0,incidents:0,peak:0},vol:0,cnLic:{state:'none'},scrubs:[],scrubMode:'always',ddosAuto:{rtbh:false,scrub:true},capDeal:null,core:{lv:0,run:0},popStd:null,popTiers:ptNew(),won:false,lost:false,neg:0,loans:[],loanOffers:[],loanStrikes:0,ppol:'open',pdesk:null,pdeskRep:null,hw:{},rules:makeRules('oncall'),charter:'global',cm:cmNew(),chartSet:false,demo:{},seatOff:null,solWon:0,monkey:{next:null,on:0}};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -25,7 +25,10 @@ const OPS=[
|
|||
{k:'ix',i:'🔀',t:N_('ops.o_ix'),d:N_('ops.o_ix_d'),p:{}},
|
||||
{k:'pni',i:'🤝',pop:1,cap:50000,t:N_('ops.o_pni'),d:N_('ops.o_pni_d'),p:{g:{d:25,v:[5,10,25,50,100],l:N_('ops.p_g'),f:v=>fmtG(v)},tier:{d:0,v:[0,1,2],l:N_('ops.p_tier'),f:v=>tr('ops.at_least_port',{port:PORT[v].n})},paid:{d:false,v:[false,true],l:N_('ops.p_paid'),f:v=>v?tr('common.on'):tr('common.off')}}},
|
||||
{k:'repair',i:'🔧',cap:50000,t:N_('ops.o_repair'),d:N_('ops.o_repair_d'),p:{}},
|
||||
{k:'optics',i:'🌈',cap:250000,t:N_('ops.o_optics'),d:N_('ops.o_optics_d'),p:{at:{d:70,v:[50,60,70,80,90],l:N_('ops.p_at'),f:v=>v+'%'},pick:{d:'cheap',v:['cheap','big'],l:N_('ops.p_pick'),f:v=>tr({cheap:N_('ops.pick_cheap'),big:N_('ops.pick_big')}[v])}}},
|
||||
{k:'optics',i:'🌈',cap:250000,t:N_('ops.o_optics'),d:N_('ops.o_optics_d'),p:{at:{d:70,v:[50,60,70,80,90],l:N_('ops.p_at'),f:v=>v+'%'},pick:{d:'cheap',v:['cheap','big'],l:N_('ops.p_pick'),f:v=>tr({cheap:N_('ops.pick_cheap'),big:N_('ops.pick_big')}[v])},
|
||||
// New fiber pulls traffic onto itself the day it is lit (#316): the player may want to light it by hand, when the
|
||||
// ports behind it are ready. Off: fiber without a channel stays dark; lit fiber still gets more optics when hot.
|
||||
fresh:{d:true,v:[true,false],l:N_('ops.p_fresh'),f:v=>v?tr('common.on'):tr('common.off')}}},
|
||||
// Line systems up to a bigger one, and optics swapped for bigger ones, on fiber that is full and runs hot, or every fiber up to
|
||||
// a chosen line system. A line system swap is a day without that fiber: only where the traffic gets around it.
|
||||
{k:'optup',i:'🔭',cap:250000,t:N_('ops.o_optup'),d:N_('ops.o_optup_d'),p:{at:{d:80,v:[60,70,80,90],l:N_('ops.p_at'),f:v=>v+'%'},
|
||||
|
|
@ -208,8 +211,8 @@ const OPS_RUN={
|
|||
const lag=o.lag(),wantLag=o.n()<2&&o.rt>1,ups=wantLag&&lag?null:o.ups(),fit=ups&&(ups.find(u=>u.cap>=N*o.use)||ups.at(-1)),job=wantLag?lag||fit:fit||lag,was=o.sig();
|
||||
if(!job||!X.can('ports',job.cost)||!X.pay('ports',()=>{job.go();return o.sig()!==was;})){KV.rv=null;KV.pu.clear();break;}
|
||||
KV.rv=null;KV.pu.clear();X.did('ports',o.at+' '+job.w);yield;}},
|
||||
*optics(X){const at=opsP('optics','at')/100,big=opsP('optics','pick')==='big',gpd=(o,l)=>optG(o,l)/optCost(o);
|
||||
for(const l of S.links){if(l.kind!=='df'||l.ready>S.day||l.eqDown>S.day||l.standby||l.cut>S.day)continue;
|
||||
*optics(X){const at=opsP('optics','at')/100,big=opsP('optics','pick')==='big',fresh=opsP('optics','fresh'),gpd=(o,l)=>optG(o,l)/optCost(o);
|
||||
for(const l of S.links){if(l.kind!=='df'||l.ready>S.day||l.eqDown>S.day||l.standby||l.cut>S.day||(!fresh&&!(l.ch||[]).length))continue;
|
||||
let cap=dfCap(l);const load=((R.load&&R.load[l.id])||0)*opsAhead();
|
||||
// New fiber gets its first channel; lit fiber gets more while it runs hot.
|
||||
for(let step=0;step<8&&(cap<=0?!(l.ch||[]).length:load>=cap*at);step++){if(chMax(l)-(l.ch||[]).length-soldSlots(l)<=0)break;
|
||||
|
|
|
|||
49
src/game/60-features/96-pop-tiers.js
Normal file
49
src/game/60-features/96-pop-tiers.js
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
/* ---------- POP standards: micro, medium, regional hub (#315) ----------
|
||||
Real networks build a few kinds of POP, not one: a small edge site, a medium one, a regional hub. The player saves a
|
||||
POP's routers as one of three standards and marks POPs as that kind; a POP is brought up to its standard with one
|
||||
button, and every POP of a kind with one more once the standard grows (a new model unlocked, more routers). Which POP
|
||||
is which stays the player's choice, so growth stays selective. Never a step down: a POP with a bigger model keeps it.
|
||||
The standard for brand-new POPs (#240, 96-pop-standard.js) is a separate thing. From customer level 2, like the intern. */
|
||||
const POP_TIERS=['micro','medium','hub'];
|
||||
const POP_TIER_L={micro:N_('pop_tiers.micro'),medium:N_('pop_tiers.medium'),hub:N_('pop_tiers.hub')};
|
||||
const ptNew=()=>({def:{micro:null,medium:null,hub:null},at:{}});
|
||||
const ptOn=()=>!!S&&opsCanHire()&&!pzOn();
|
||||
const ptO=()=>S.popTiers||(S.popTiers=ptNew());
|
||||
// Saves are untrusted: known kinds, router models that exist, POPs that still exist.
|
||||
function ptSanitize(s){const o=s.popTiers&&typeof s.popTiers==='object'&&!Array.isArray(s.popTiers)?s.popTiers:{},n=ptNew(),d=o.def&&typeof o.def==='object'?o.def:{},at=o.at&&typeof o.at==='object'&&!Array.isArray(o.at)?o.at:{};
|
||||
for(const k of POP_TIERS){const x=d[k];if(x&&typeof x==='object'&&Number.isInteger(x.g)&&RG[x.g])n.def[k]={g:x.g,rt:int(x.rt,1,RMAX,1)};}
|
||||
for(const c of Object.keys(at))if(isCity(c)&&own(s.pops,c)&&POP_TIERS.includes(at[c]))n.at[c]=at[c];
|
||||
s.popTiers=n;}
|
||||
// The clicks that bring a POP up to a standard, in order, priced as each click prices it: a second router first where a
|
||||
// lone router carries traffic (so the swap is a rolling upgrade, not a maintenance window), the bigger model, the rest of
|
||||
// the routers. null when the POP already meets it. why: what stops it today.
|
||||
function ptPlan(c,k){const p=S.pops[c],d=S.popTiers&&S.popTiers.def[k];if(!p||!d)return null;
|
||||
const g0=p.rgen||0,rt0=p.routers||1,up=d.g!==g0&&RG[d.g].cap>RG[g0].cap,steps=[];let rt=rt0,cost=0;
|
||||
if(up&&rt===1&&d.rt>=2&&!popIdle(c)){cost+=routerCost(g0,1);steps.push('add');rt=2;}
|
||||
if(up){cost+=Math.max(0,Math.round(RG[d.g].cost*rt*hwMul('rt')*techMul(RG[d.g].lvl))-tradeIn(g0,rt));steps.push('swap');}
|
||||
const g=up?d.g:g0;while(rt<d.rt){cost+=routerCost(g,rt);steps.push('add');rt++;}
|
||||
if(!steps.length)return null;
|
||||
const mo=n=>(n-1)*ROUTER_MO+cageMo(n),why=up?(!techOk('rg',d.g,RG[d.g].lvl)?tr('pop_tiers.model_locked',{model:esc(RG[d.g].n),lv:RG[d.g].lvl}):modelFits(c,d.g)||(p.rupDay===S.day?tr('pop_tiers.swapped_today'):'')):'';
|
||||
return {steps,cost,g:d.g,mo:mo(rt)+rt*RG[g].mo-mo(rt0)-rt0*RG[g0].mo,why};}
|
||||
// Run the plan through the Infra tab's own actions, quietly. True when every click went through.
|
||||
function ptRun(c,q){let ok=true;opsQuiet(()=>{for(const s of q.steps){const p=S.pops[c],rt=p.routers||1,g=p.rgen||0;
|
||||
if(s==='add')ACT.addRouter({city:c});else ACT.upRouter({city:c,g:q.g});if((p.routers||1)===rt&&(p.rgen||0)===g){ok=false;break;}}});return ok;}
|
||||
// The POPs of one kind, the busiest first, with their plans.
|
||||
function ptAll(k){const at=S.popTiers?S.popTiers.at:{},cs=Object.keys(at).filter(c=>at[c]===k&&S.pops[c]).sort((a,b)=>(R.nodeLoad[b]||0)-(R.nodeLoad[a]||0)||a.localeCompare(b));
|
||||
const todo=[],stuck=[];for(const c of cs){const q=ptPlan(c,k);if(!q)continue;(q.why?stuck:todo).push({c,q});}
|
||||
return {cs,todo,stuck,cost:todo.reduce((a,x)=>a+x.q.cost,0)};}
|
||||
const ptName=k=>tr(POP_TIER_L[k]),ptDesc=d=>d?`${d.rt} × ${esc(RG[d.g].n)}`:tr('pop_tiers.not_set');
|
||||
// In a POP's router section: the three standards, what this POP is, and one button each.
|
||||
function popTierHtml(c){if(!ptOn()||!S.pops[c])return '';const T=ptO(),p=S.pops[c],mine=T.at[c];
|
||||
return `<div class="ptier"><div class="kv"><span>${tr('pop_tiers.title')}</span><b>${mine?tr('pop_tiers.this_pop_is',{kind:ptName(mine)}):tr('pop_tiers.no_kind')}</b></div>
|
||||
${POP_TIERS.map(k=>{const d=T.def[k],q=d?ptPlan(c,k):null,same=d&&d.g===(p.rgen||0)&&d.rt===(p.routers||1);
|
||||
const main=!d?'':q?btn(tr('pop_tiers.apply_cost',{cost:fmt$(q.cost)}),'ptApply',{city:c,k,cost:q.cost},mine===k?'pink sm':'sm',!!q.why||S.cash<q.cost):mine!==k?btn(tr('pop_tiers.mark'),'ptApply',{city:c,k,cost:0},'sm'):`<span class="tag st on">✓ ${tr('pop_tiers.meets_it')}</span>`;
|
||||
return `<div class="row"><div class="grow"><div class="nm">${ptName(k)} <span class="meta">${ptDesc(d)}</span></div>${q&&q.why?`<div class="why">${esc(q.why)}</div>`:''}
|
||||
<div class="btns">${main}${same?'':btn(tr('pop_tiers.save_here'),'ptSave',{city:c,k},'ghost sm')}</div></div></div>`;}).join('')}
|
||||
<p class="note">${tr('pop_tiers.note')}</p></div>`;}
|
||||
// In Utilities: every kind with its POPs, and one button that brings them all up to their standard.
|
||||
function popTierAllHtml(city){if(!ptOn())return '';const T=ptO();if(!POP_TIERS.some(k=>T.def[k]))return '';
|
||||
return `<section><h3>${tr('pop_tiers.title')}</h3><p class="lead">${tr('pop_tiers.bulk_note')}</p>
|
||||
${POP_TIERS.filter(k=>T.def[k]).map(k=>{const A=ptAll(k);return `<div class="row"><div class="grow"><div class="nm">${ptName(k)} <span class="meta">${ptDesc(T.def[k])}</span></div>
|
||||
<div class="meta">${trn('pop_tiers.n_pops',A.cs.length)}${A.todo.length?' · '+trn('pop_tiers.n_below',A.todo.length):''}${A.stuck.length?' · '+trn('pop_tiers.n_stuck',A.stuck.length):''}</div>
|
||||
${A.todo.length?`<div class="btns">${btn(trn('pop_tiers.bring_up_n',A.todo.length,{cost:fmt$(A.cost)}),'ptAll',{k,cost:A.cost,city},'pink sm',S.cash<A.cost)}</div>`:''}</div></div>`;}).join('')}</section>`;}
|
||||
|
|
@ -40,6 +40,12 @@ function utilityKit(city){const p=S&&S.pops[city];if(!p)return null;
|
|||
const gen=!p.gen,site=!p.site2,router=(p.routers||1)<2,g=p.rgen||0;
|
||||
return {gen,site,router,moves:utilityCacheMoves(city),cost:(gen?GEN_COST:0)+(site?SITE2_COST:0)+(router?routerCost(g,1):0),
|
||||
mo:(gen?GEN_MO:0)+(site?SITE2_MO:0)+(router?routerMo(g):0)};}
|
||||
// The kit at every POP that lacks part of it (#317): one quote, one button. From customer level 2, like the intern: early
|
||||
// on, every generator is a choice about money.
|
||||
const utilityKitAllOn=()=>!!S&&opsCanHire()&&!pzOn();
|
||||
function utilityKitAll(){if(!utilityKitAllOn())return null;const cities=[];let cost=0,mo=0,moves=0;
|
||||
for(const c of Object.keys(S.pops)){const q=utilityKit(c);if(!q||(!q.cost&&!q.moves.length))continue;cities.push(c);cost+=q.cost;mo+=q.mo;moves+=q.moves.length;}
|
||||
return {cities,cost,mo,moves};}
|
||||
function utilityPeers(){if(!S)return [];return Object.keys(S.ixp).filter(isIx).map(ix=>{
|
||||
const sessions=ixSessions(ix),requests=[],blocked=[];let existing=0;
|
||||
for(const id of ixMembers(ix)){
|
||||
|
|
|
|||
|
|
@ -64,6 +64,8 @@ function sanitize(s){
|
|||
// The backbone's technology: a save from before it with Auto-TE bought keeps the old rules on RSVP-TE (legacy).
|
||||
// The standard POP build (#240): a router model and how many.
|
||||
{const d=s.popStd;s.popStd=d&&typeof d==='object'&&Number.isInteger(d.g)&&RG[d.g]?{g:d.g,rt:int(d.rt,1,RMAX,1)}:null;}
|
||||
// POP standards by kind (#315): micro, medium, regional hub, and which POP is which.
|
||||
ptSanitize(s);
|
||||
{const c=s.core&&typeof s.core==='object'?s.core:null,lv=c?int(c.lv,0,4,0):(s.te?2:0);s.core={lv,run:c?int(c.run,0,lv,lv):lv};if(c?c.legacy===true:!!s.te)s.core.legacy=true;if(c&&c.lab===true)s.core.lab=true;if(c&&c.since!==undefined)s.core.since=num(c.since,0);}
|
||||
s.capDeal=s.capDeal&&typeof s.capDeal==='object'&&own(CAP_ROUTES,s.capDeal.c)?{at:num(s.capDeal.at,0),c:s.capDeal.c}:null;
|
||||
s.inc=s.inc.filter(i=>i&&typeof i.type==='string').map(i=>(i.type==='maxpfx'&&(i.type='ixloop'),i.id=sid(i.id),i.until=num(i.until,s.day),i.cost=num(i.cost,0),i.msg=String(i.msg||'').slice(0,400),i.fix=i.fix==null?undefined:String(i.fix).slice(0,60),i));
|
||||
|
|
|
|||
|
|
@ -114,11 +114,21 @@ function mktPrice(from){const m=mkt();for(let i=from;i<S.offers.length;i++){cons
|
|||
const clMid=b=>Math.round((b.rate+b.hag.rate)/2);
|
||||
const clBill=(b,rate)=>BIZ_T[b.type].fiber?rate:b.bw*rate;
|
||||
const clHags=()=>S?S.biz.reduce((a,b)=>a+(b.hag?1:0),0):0;
|
||||
/* What is at stake in a renewal (#292): how much traffic they book and get, the price per Gbps now and asked, and the
|
||||
path terms they signed for (latency, diverse, no subsea), each ticked as it stands today. Two short lines for a phone. */
|
||||
function clRenInfo(b){const T=BIZ_T[b.type],tick=v=>`<b style="color:${v?'var(--eye)':'var(--bad)'}">${v?'✓':'✗'}</b> `,top=[],rq=[];
|
||||
if(!T.fiber){const sf=bizSf(b),srv=`<b${sf<0.95?' style="color:var(--bad)"':''}>${fmtG(b.bw*sf)}</b>`;
|
||||
top.push(b.sites?trn('lifecycle.ren_sites_traffic',b.sites.length,{bw:fmtG(b.bw),srv}):tr('lifecycle.ren_traffic',{bw:fmtG(b.bw),srv}));
|
||||
top.push(tr('lifecycle.ren_per_g',{was:fmt$(b.rate),price:fmt$(b.hag.rate)}));}
|
||||
for(const k of b.reqs||[]){const Q=REQS[k];if(!Q)continue;const ok=Q.ok(b);
|
||||
if(k==='lat'){const v=R.l2lat[b.id]!==undefined?R.l2lat[b.id]:bestLat(b.city,b.city2);rq.push(tick(ok)+tr('lifecycle.ren_lat',{max:b.latMax,now:isFinite(v)?tr('common.ms_ms_one_way',{ms:v.toFixed(1)}):tr('common.no_path')}));}
|
||||
else rq.push(tick(ok)+(k==='diverse'?tr('lifecycle.ren_diverse'):k==='sharks'?tr('lifecycle.ren_no_subsea'):esc(typeof Q.l==='function'?Q.l(b):Q.l)));}
|
||||
return (top.length?`<div class="meta">${top.join(' · ')}</div>`:'')+(rq.length?`<div class="meta">${rq.join(' · ')}</div>`:'');}
|
||||
// The renewals waiting for an answer, at the top of Deals.
|
||||
function clDealsHtml(){const hs=S.biz.filter(b=>b.hag).sort((a,b)=>a.hag.until-b.hag.until);if(!hs.length)return '';
|
||||
return `<h3 class="sub4">${tr('lifecycle.renewals')}</h3><p class="meta" style="margin:0 0 6px">${tr('lifecycle.unanswered_matches')}</p>`+hs.map(b=>{const now=BIZ_T[b.type].fiber?b.hag.rate:b.bw*b.hag.rate,was=bizMo(b);
|
||||
return `<div class="row"><div class="grow"><div class="nm">${esc(b.name)}</div><div class="meta">${esc(BIZ_T[b.type].l)} · ${esc(clWhere(b))} · ${tr('ui.n_d_left',{n:b.hag.until-S.day})}</div>
|
||||
<div class="meta">${tr('lifecycle.wants_price',{was:fmt$(was),price:fmt$(now),p:pct(1-now/Math.max(1,was))})}</div>${slRenRow(b)}
|
||||
<div class="meta">${tr('lifecycle.wants_price',{was:fmt$(was),price:fmt$(now),p:pct(1-now/Math.max(1,was))})}</div>${clRenInfo(b)}${slRenRow(b)}
|
||||
<div class="btns">${btn(tr('lifecycle.match'),'renewMatch',{id:b.id},'green sm')}${btn(tr('lifecycle.meet_halfway',{price:fmt$(clBill(b,clMid(b)))}),'renewMeet',{id:b.id},'sm')}${btn(tr('lifecycle.let_them_go'),'renewLet',{id:b.id},'ghost sm')}</div></div></div>`;}).join('');}
|
||||
// The contract line on a customer row.
|
||||
const clTermTxt=b=>clOn(b)&&b.te?(b.hag?tr('lifecycle.renewal_haggle',{date:dateStr(b.te)}):tr('lifecycle.contract_until',{date:dateStr(b.te)})):'';
|
||||
|
|
|
|||
6
src/game/90-actions/46-net-filter.js
Normal file
6
src/game/90-actions/46-net-filter.js
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
// Find a network at a POP (#199): view state only.
|
||||
Object.assign(ACT,{
|
||||
netFind:({q})=>{UI.netQ=String(q??'').slice(0,40);listReset('pni');renderPanel();},
|
||||
netOnly:()=>{UI.netOnly=!UI.netOnly;listReset('pni');renderPanel();},
|
||||
netClear:()=>{UI.netQ='';UI.netOnly=false;listReset('pni');renderPanel();},
|
||||
});
|
||||
10
src/game/90-actions/51-customer-fix.js
Normal file
10
src/game/90-actions/51-customer-fix.js
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
Object.assign(ACT,{
|
||||
// Buy what the offer asks for, then sign (#241). cost: the price the button showed; a changed quote buys nothing.
|
||||
acceptFix:({id,cost})=>{const o=S.offers.find(x=>x.id===id),q=reqFix(o);if(!o||!q||!reqFixCanSign(o))return;
|
||||
if(q.cost!==+cost){toast(tr('utilities.quote_changed'),'bad');sfx('err');after();return;}
|
||||
if(S.cash<q.cost){toast(tr('interface.not_enough_cash_wait_for_revenue'),'bad');sfx('err');return;}
|
||||
// The Infra tab's own buttons, quietly, then the ordinary signing with its toast and redraw.
|
||||
opsQuiet(()=>{for(const x of q.items){if(x.k==='gen')ACT.addGen({city:x.city});else if(x.k==='metro')ACT.addSite({city:x.city});else ACT.addRouter({city:x.city});}});
|
||||
toast(esc(tr('req_fix.bought',{list:q.items.map(x=>tr(REQ_FIX_L[x.k],{city:CITY[x.city].name})).join(', '),cost:fmt$(q.cost)})),'good');
|
||||
ACT.accept({id});},
|
||||
});
|
||||
|
|
@ -4,7 +4,10 @@ Object.assign(ACT,{
|
|||
decomToggle:({city})=>{if(!S.pops[city])return;UI.decom=UI.decom||new Set();if(UI.decom.has(city))UI.decom.delete(city);else UI.decom.add(city);decomModal();},
|
||||
decomGo:()=>{const sel=[...(UI.decom||[])].filter(c=>S.pops[c]);if(!sel.length||sel.length>=Object.keys(S.pops).length)return;closeModal();UI.decom=null;UI.sel=null;decommission(sel);sfx('alert');after();},
|
||||
rmLink:({id})=>{if(UI.confirm!==id){UI.confirm=id;renderPanel();return;}{const l=S.links.find(x=>x.id===id),back=cabBack(l);if(back>0){S.cash+=back;toast(tr('links.name_is_called_off_the_cable',{name:esc(l.cname||tr('common.your_cable')),price:fmt$(back)}),'good');}
|
||||
const n=chBack(l?[l]:[]);if(n)toast(trn('links.n_optic_back_on_the_spares_shelf',n),'good');}S.links=S.links.filter(l=>l.id!==id);prunePairMet();UI.sel=null;UI.confirm=null;after();},
|
||||
const n=chBack(l?[l]:[]);if(n)toast(trn('links.n_optic_back_on_the_spares_shelf',n),'good');}const l0=S.links.find(x=>x.id===id),sib=l0?pairLinks(l0.a,l0.b).filter(x=>x!==l0&&x.kind!=='vxc'):[];S.links=S.links.filter(l=>l.id!==id);prunePairMet();
|
||||
// One of several parallel links (#119): the panel moves on to the next one between the same cities, so a row of them
|
||||
// can be handed back without opening the panel again each time.
|
||||
UI.sel=sib.length?{type:'link',id:sib[0].id}:null;UI.confirm=null;after();},
|
||||
// The chaos monkey takes a banana and goes home early (no bonus).
|
||||
mkBanana:()=>{if(!mkOn())return;if(!spend(mkBananaCost()))return;S.stats.bananas=(S.stats.bananas||0)+1;mkLeave('banana');track('monkey_banana');after();},
|
||||
fixInc:({id})=>{const i=S.inc.find(x=>x.id===id);if(!i||!(i.cost>0))return;
|
||||
|
|
|
|||
16
src/game/90-actions/85-pop-tiers.js
Normal file
16
src/game/90-actions/85-pop-tiers.js
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
// POP standards (#315): save one, bring a POP up to one, bring every POP of a kind up to it.
|
||||
Object.assign(ACT,{
|
||||
ptSave:({city,k})=>{const p=S.pops[city];if(!ptOn()||!p||!POP_TIERS.includes(k))return;const T=ptO();T.def[k]={g:p.rgen||0,rt:p.routers||1};T.at[city]=k;
|
||||
toast(esc(tr('pop_tiers.saved',{kind:ptName(k),desc:`${T.def[k].rt} × ${RG[T.def[k].g].n}`})),'good');sfx('click');after();},
|
||||
// cost: the price on the button; a plan that changed under it buys nothing. A POP that already meets it is only marked.
|
||||
ptApply:({city,k,cost})=>{if(!ptOn()||!S.pops[city]||!POP_TIERS.includes(k)||!ptO().def[k])return;const q=ptPlan(city,k);
|
||||
if((q?q.cost:0)!==+cost){toast(tr('utilities.quote_changed'),'bad');sfx('err');after();return;}
|
||||
if(q&&q.why){toast(esc(q.why),'bad');sfx('err');return;}if(q&&S.cash<q.cost){toast(tr('interface.not_enough_cash_wait_for_revenue'),'bad');sfx('err');return;}
|
||||
S.popTiers.at[city]=k;const ok=!q||ptRun(city,q);
|
||||
toast(esc(ok?tr('pop_tiers.city_is_kind',{city:CITY[city].name,kind:ptName(k)}):tr('pop_tiers.not_all',{city:CITY[city].name})),ok?'good':'bad');sfx(q?'build':'click');after();},
|
||||
ptAll:({k,cost,city})=>{if(!ptOn()||!POP_TIERS.includes(k))return;const A=ptAll(k);if(!A.todo.length)return;
|
||||
if(A.cost!==+cost){utilitiesModal(city,tr('utilities.quote_changed'));return;}
|
||||
if(S.cash<A.cost){toast(tr('interface.not_enough_cash_wait_for_revenue'),'bad');sfx('err');return;}
|
||||
let n=0;for(const {c,q} of A.todo)if(ptRun(c,q))n++;
|
||||
sfx('build');after();utilitiesModal(city,trn('pop_tiers.bulk_done',n,{kind:ptName(k)}));},
|
||||
});
|
||||
|
|
@ -10,6 +10,14 @@ Object.assign(ACT,{
|
|||
if(q.gen)p.gen=true;if(q.site){p.site2=true;p.site2Day=S.day;}if(q.router)p.routers=2;
|
||||
const moves=new Map(q.moves.map(m=>[m.id,m.site]));for(const c of S.caches)if(moves.has(c.id))c.site=moves.get(c.id);
|
||||
after();const msg=tr('utilities.kit_applied',{city:CITY[city].name});if(modal)utilitiesModal(city,msg);else toast(esc(msg),'good');},
|
||||
// Every POP's kit in one go (#317), all or nothing on the quoted price, one redraw at the end.
|
||||
utilityKitAll:({cost,city})=>{const q=utilityKitAll();if(!q||!q.cities.length)return;
|
||||
if(q.cost!==+cost){utilitiesModal(city,tr('utilities.quote_changed'));return;}
|
||||
if(S.cash<q.cost){toast(tr('interface.not_enough_cash_wait_for_revenue'),'bad');sfx('err');return;}
|
||||
let n=0;opsQuiet(()=>{for(const c of q.cities){const k=utilityKit(c);if(!k||S.cash<k.cost)continue;const c0=S.cash;ACT.utilityKit({city:c,cost:k.cost});if(S.cash<c0||!k.cost)n++;}});
|
||||
sfx('build');after();utilitiesModal(city,trn('utilities.kit_all_applied',n));},
|
||||
// The intern's new-POP template with or without the kit, from the Utilities sheet: the same switch as in Ops.
|
||||
utilityKitNew:({city})=>{if(!opsHired())return;S.ops.tpl.kit=!S.ops.tpl.kit;sfx('click');after();utilitiesModal(city);},
|
||||
utilityCaches:({city,quote,modal})=>{const q=utilityCaches(city);if(!q||!q.add.length)return;
|
||||
if(q.key!==quote){if(modal)utilitiesModal(city,tr('utilities.quote_changed'));else{renderPanel();toast(tr('utilities.quote_changed'));}return;}
|
||||
if(!portGate(city,q.ports))return;
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ function renderLeft(){checkLayer();
|
|||
{const lv=S.lvl||1,nx=LEVELS[lv];h+=`<div class="inc" style="background:#FFF6CF"><div class="nm">${tr('hud_and_panels.customer_level_lv_name',{lv,name:LEVELS[lv-1].n})}</div><div class="meta">${nx?tr('hud_and_panels.next_req_unlocks_what',{req:nx.req,what:lc1(nx.unlock)}):tr('common.every_customer_type_is_unlocked_go')}</div></div>`;}
|
||||
if(!S.offers.length)h+=`<p class="empty">${tr('hud_and_panels.no_open_offers_right_now_businesses')}</p>`;
|
||||
for(const o of S.offers.slice().sort((a,b)=>a.exp-b.exp)){const has=bHas(o);
|
||||
h+=`<div class="row"><div class="grow"><div class="nm">${esc(o.name)}</div><div class="meta">${esc(BIZ_T[o.type].l)} · ${CITY[o.city].name}${o.city2?' ⇄ '+CITY[o.city2].name:''} · <b>${bTerms(o)}</b> · ${tr('ui.n_d_left',{n:o.exp-S.day})}${(o.reqs||[]).length?` · ${trn('hud_and_panels.n_special_requirement',o.reqs.length)}`:''}</div>${o.refN?`<div class="meta">${tr('lifecycle.referred_by',{name:esc(o.refN)})}</div>`:''}${spotWhy(o)}${bRisk(o)}${reqList(o)}
|
||||
h+=`<div class="row"><div class="grow"><div class="nm">${esc(o.name)}</div><div class="meta">${esc(BIZ_T[o.type].l)} · ${CITY[o.city].name}${o.city2?' ⇄ '+CITY[o.city2].name:''} · <b>${bTerms(o)}</b> · ${tr('ui.n_d_left',{n:o.exp-S.day})}${(o.reqs||[]).length?` · ${trn('hud_and_panels.n_special_requirement',o.reqs.length)}`:''}</div>${o.refN?`<div class="meta">${tr('lifecycle.referred_by',{name:esc(o.refN)})}</div>`:''}${spotWhy(o)}${bRisk(o)}${reqList(o)}${reqFixHtml(o)}
|
||||
<div class="btns">${has?btn(tr('common.accept'),'accept',{id:o.id},'green sm'):btn(tr('common.go_there'),'focusCity',{city:bCities(o).find(c=>!S.pops[c])},'ghost sm')}${btn(tr('common.decline'),'decline',{id:o.id},'ghost sm')}</div>${has?'':`<div class="why">${tr('hud_and_panels.needs_a_pop_in_cities',{cities:bCities(o).filter(x=>!S.pops[x]).map(x=>CITY[x].name).join(', ')})}</div>`}</div></div>`;}
|
||||
}else if(UI.left==='noc'){
|
||||
h+=`<div class="btns" style="margin-bottom:8px">${btn(tr('hud_and_panels.open_noc_dashboard'),'dash',{},'pink')}${pieNocBtn()}${btn(`⚙️ ${tr('routing.routing_and_ddos')}${S.te&&!coreTE()?'<span class="cnt red dot" aria-hidden="true"></span>':''}`,'routingOpen',{},'')}</div>`;
|
||||
|
|
|
|||
|
|
@ -40,10 +40,10 @@ function cityPanel(c){
|
|||
for(const b of bz)h+=`<div class="row"><div class="grow"><div class="nm">${esc(b.name)}</div><div class="meta">${esc(BIZ_T[b.type].l)}${b.city2?` ${CITY[b.city].name} ⇄ ${CITY[b.city2].name}`:''} · ${bTerms(b)}${clTermTxt(b)?' · '+clTermTxt(b):''}${BIZ_T[b.type].l2?` · ${b.sites?tr('city_panel.carrying_g_per_site',{g:fmtG(R.l2[b.id]||0)}):tr('city_panel.carrying_g',{g:fmtG(R.l2[b.id]||0)})}`:''}${BIZ_T[b.type].fiber&&!fiberOk(b)?' · <b style="color:var(--bad)">'+tr('city_panel.fiber_is_down')+'</b>':''}${BIZ_T[b.type].event&&eventLive(b)?` · <b>${tr('city_panel.serving_v',{v:pct(sfOf(R,b.city))})}</b>`:''}${b.type==='scrub'&&!hasScrub()?' · <b style="color:var(--bad)">'+tr('common.needs_a_scrubbing_center')+'</b>':''}${S.day-(b.since||0)<15?` · <b>${tr('common.provisioning_n_d_grace',{n:15-(S.day-(b.since||0))})}</b>`:''}</div>${bRisk(b)}${reqList(b)}${BIZ_T[b.type].l2?routeCtl(b):''}${pathCtl(b)}<div class="bar ${b.mood<30?'bad':b.mood<65?'warn':''}"><i style="width:${b.mood}%"></i></div><div class="meta">${tr('common.happiness_p',{p:Math.round(b.mood)})}</div></div>${btn(UI.confirm===b.id?tr('common.really_drop'):tr('common.drop'),'dropBiz',{id:b.id},'ghost sm')}</div>`;
|
||||
h+=`</section>`+offersHere(c);
|
||||
}else if(UI.tab==='up'){
|
||||
h+=portNote(c)+latNote(c);
|
||||
h+=netFilterHtml()+portNote(c)+latNote(c);
|
||||
h+=`<section><h3>${tr('common.ip_transit')}</h3><p class="lead">${tr('city_panel.pay_a_bigger_network_per_gbps')}</p>`;
|
||||
const prov=NETS.filter(n=>sellsAt(n,c)).sort((a,b)=>a.price-b.price);
|
||||
if(!prov.length)h+=`<p class="empty">${tr('city_panel.nobody_sells_transit_here_haul_your')}</p>`;
|
||||
const prov0=NETS.filter(n=>sellsAt(n,c)).sort((a,b)=>a.price-b.price),prov=prov0.filter(n=>netKeep(n,S.transit.some(x=>x.city===c&&x.net===n.id)));
|
||||
if(!prov0.length)h+=`<p class="empty">${tr('city_panel.nobody_sells_transit_here_haul_your')}</p>`;else if(!prov.length)h+=netNone();
|
||||
for(const n of prov){const t=S.transit.find(x=>x.city===c&&x.net===n.id);const pr=transitPerG(n,c,premOnlyAt(n,c)||!!(t&&premOn(t)))*S.priceMul;
|
||||
h+=`<div class="row">${logo(n)}<div class="grow"><div class="nm">${esc(n.name)} <span class="tag ${n.type}">${TYPE_L[n.type]}</span></div><div class="meta">${tr('city_panel.price_per_gbps_month_billed_on',{price:pr.toFixed(2)})}</div>${premOnlyAt(n,c)&&!t?`<div class="meta">${tr('city_panel.only_the_cn_too_premium_crossing')}</div>`:''}`;
|
||||
if(t){const u=R.useT[t.id]||0,cap=lagCap(PORT[t.tier].g,t.n),tdown=t.down>S.day;
|
||||
|
|
@ -53,12 +53,12 @@ function cityPanel(c){
|
|||
h+=`</div></div>`;}
|
||||
h+=`</section>`;
|
||||
}else if(UI.tab==='peer'){
|
||||
h+=portNote(c);
|
||||
h+=netFilterHtml()+portNote(c);
|
||||
h+=ixSection(c);
|
||||
h+=`<section><h3>${tr('city_panel.private_interconnects_pni')}</h3><p class="lead">${tr('city_panel.a_dedicated_cross_connect_to_one',{dc:esc(siteName(c,'a'))})}</p>`;
|
||||
h+=pniListHtml(c);
|
||||
h+=`</section><section><h3>${tr('common.embedded_caches')}</h3><p class="lead">${tr('city_panel.cdns_put_free_cache_servers_inside')}</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;
|
||||
for(const n of NETS.filter(n=>n.cache&&netKeep(n,S.caches.some(x=>x.city===c&&x.net===n.id)))){const have=S.caches.filter(x=>x.city===c&&x.net===n.id),dem=R.demTo[n.id]||0,ok=dem>=n.cache.min;
|
||||
h+=`<div class="row">${logo(n)}<div class="grow"><div class="nm">${esc(n.cache.name)}</div><div class="meta">${tr('common.from_net',{net:esc(n.name)})} · ${have.length?`${trn('common.n_box',have.length)} · ${tr('city_panel.serving_v',{v:fmtG(have.reduce((a,x)=>a+(R.useCache[x.id]||0),0))})}`:tr('city_panel.100g_per_box')}</div>${!ok?`<div class="why">${tr('city_panel.needs_min_gbps_of_traffic_to',{min:n.cache.min,net:esc(n.name),now:dem.toFixed(1)})}</div>`:''}</div>
|
||||
${have.length?btn(tr('common.remove'),'rmCache',{id:(have.find(x=>x.site==='b')||have[0]).id},'ghost sm'):''}${btn(have.length?tr('common.box'):tr('common.request'),'cache',{city:c,net:n.id},'sm',!ok)}</div>${S.pops[c].site2&&have.length?(()=>{const nb=have.filter(x=>x.site==='b').length,na=have.length-nb;return `<div class="seg site"><span class="meta">${tr('city_panel.boxes_a_in_a_b_in',{a:na,b:nb})}</span>${na?btn(tr('city_panel.move_one_to_b'),'cacheSite',{city:c,net:n.id,s:'b'},'ghost sm'):''}${nb?btn(tr('city_panel.move_one_to_a'),'cacheSite',{city:c,net:n.id,s:'a'},'ghost sm'):''}</div>`;})():''}`;}
|
||||
h+=`</section>`;
|
||||
|
|
@ -75,7 +75,7 @@ function cityPanel(c){
|
|||
${nl>=nc*0.95?`<p class="why">${tr('city_panel.maxed_out_traffic_here_is_being')}</p>`:''}
|
||||
<div class="btns">${N?(!techOk('rg',Ni,N.lvl)?demoBtn('rg',Ni,N.lvl,tr('city_panel.model_level_lv',{model:esc(N.n),lv:N.lvl}),'pink'):btn(tr('city_panel.upgrade_to_model_cost_mo_mo',{model:esc(N.n),cost:fmt$(swapCost(c,Ni)),mo:fmt$(N.mo*rt)}),'upRouter',{city:c,g:Ni},'pink',S.cash<swapCost(c,Ni)||p.rupDay===S.day)):''}${btn(UI.models?tr('city_panel.hide_other_models'):tr('common.other_models'),'models',{},'ghost sm')}${rt<RMAX?btn(tr('city_panel.add_router_cost_mo_mo',{cost:fmt$(routerCost(g,rt)),mo:fmt$(routerMo(g)+(rt>=RCAGE?CAGE_MO:0))}),'addRouter',{city:c},'',S.cash<routerCost(g,rt)):''}${rt>1?btn(tr('common.remove_one'),'rmRouter',{city:c},'ghost sm'):''}</div>
|
||||
${rt>=RCAGE&&rt<RMAX?`<p class="note">${tr('city_panel.the_standard_cage_holds_n_routers',{n:RCAGE,mo:fmt$(CAGE_MO)})}</p>`:''}${rt>=RMAX?`<p class="note">${tr('city_panel.this_pop_has_the_most_routers',{n:RMAX})}</p>`:''}${rt>RCAGE?`<div class="kv"><span>${tr('city_panel.cage_extension')}</span><b>${fmt$(cageMo(rt))}/mo</b></div>`:''}
|
||||
${popStdHtml(c)}
|
||||
${popStdHtml(c)}${popTierHtml(c)}
|
||||
${UI.models?routerModels(c):''}
|
||||
${N||UI.models?`<p class="note">${(p.rgen||0)>0?tr('city_panel.prices_include_p_back_for_the',{p:fmt$(tradeIn(p.rgen||0,rt))})+' ':''}${p.rupDay===S.day?tr('city_panel.new_routers_went_in_today_the')+' ':''}${rt>1?tr('city_panel.rolling_upgrade_one_router_at_a'):tr('city_panel.with_one_router_the_upgrade_needs')}</p>`:''}
|
||||
<p class="note">${rt>=2?tr('city_panel.a_crash_here_only_costs_one'):tr('city_panel.one_router_is_a_single_point')}</p></section>
|
||||
|
|
|
|||
14
src/game/93-ui/51-net-filter.js
Normal file
14
src/game/93-ui/51-net-filter.js
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
/* ---------- Find a network at a POP (#199) ----------
|
||||
The Transit and Peering tabs list every network that sells or peers there: dozens in a big city. One search box and a
|
||||
"connected only" switch filter all of them (transit, exchange members, PNIs, caches). View state only, never saved;
|
||||
it stays while you hop between POPs, and a Clear button says it is on. */
|
||||
const netQ=()=>(UI.netQ||'').trim().toLowerCase();
|
||||
const netFiltered=()=>!!netQ()||!!UI.netOnly;
|
||||
// on: connected to that network in this list (a transit port, a session, a PNI, a cache box). A number finds an AS.
|
||||
function netKeep(n,on){const q=netQ();if(q&&!n.name.toLowerCase().includes(q)&&!(n.asn&&String(n.asn).startsWith(q)))return false;return !UI.netOnly||!!on;}
|
||||
function netFilterHtml(){return `<div class="netf"><input type="search" id="netQ" class="t" value="${esc(UI.netQ||'')}" maxlength="40" autocomplete="off" placeholder="${esc(tr('net_filter.find_a_network'))}" aria-label="${esc(tr('net_filter.find_a_network'))}">
|
||||
<div class="btns">${btn(tr('net_filter.connected_only'),'netOnly',{},UI.netOnly?'green sm':'ghost sm')}${netFiltered()?btn(tr('net_filter.clear'),'netClear',{},'ghost sm'):''}</div></div>`;}
|
||||
const netNone=()=>`<p class="empty">${tr('pni_list.nothing_matches')}</p>`;
|
||||
// Typing redraws the panel. The morph swaps an input whose value changed, so the new box gets the focus and the caret back.
|
||||
document.addEventListener('input',e=>{if(e.target.id!=='netQ'||!S)return;const at=e.target.selectionStart;ACT.netFind({q:e.target.value});
|
||||
const n=$('netQ');if(n&&n!==e.target){n.focus();try{n.setSelectionRange(at,at);}catch(err){}}});
|
||||
|
|
@ -15,7 +15,8 @@ function pniRow(c,n,pn,v,chk){let h=`<div class="row prow">${logo(n)}<div class=
|
|||
else{h+=chk.ok?`<div class="btns">${pniG1(n.id)?btn(tr('city_panel.port_cost_mo_mo',{port:'1G',cost:fmt$(PNI_G1_COST),mo:fmt$(Math.round(PORT[0].pni/2))}),'pni',{city:c,net:n.id,tier:-1},'sm',S.cash<PNI_G1_COST||!portOk(c,0)):''}${PORT.map((P2,i)=>portShown(i)&&i>=pniMin(n.id)?btn(tr('city_panel.port_cost_mo_mo',{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><div class="meta">${pniEta(n.id)}${pniMin(n.id)?' · '+tr('city_panel.no_10g_net_starts_at_100g',{net:esc(n.name)}):pniG1(n.id)?' · '+tr('city_panel.sells_pnis_down_to_1g'):''}</div>${chk.fee?`<div class="meta">${tr('city_panel.paid_peering_price_mo_on_top',{price:fmt$(chk.fee)})}</div>`:''}`:`<div class="why">${esc(chk.why)}</div>`;}
|
||||
return h+`</div></div>`;}
|
||||
function pniListHtml(c){const f=UI.pniF||'all',az=UI.pniSort==='az',open=UI.pniOpen||{};
|
||||
const rows=NETS.filter(n=>n.pops.includes(c)).map(n=>{const pn=S.pni.find(x=>x.city===c&&x.net===n.id)||null;const chk=pn?null:peerOk(n.id,'pni',c),v=pn?null:pniVal(n.id,c);return {n,pn,v,chk,s:pniStat(n.id,c).k,go:!!pn||(chk.ok&&v.g>=1)};});
|
||||
// The search (#199) first: a network it hides needs no value worked out.
|
||||
const rows=NETS.filter(n=>n.pops.includes(c)).map(n=>[n,S.pni.find(x=>x.city===c&&x.net===n.id)||null]).filter(([n,pn])=>netKeep(n,pn)).map(([n,pn])=>{const chk=pn?null:peerOk(n.id,'pni',c),v=pn?null:pniVal(n.id,c);return {n,pn,v,chk,s:pniStat(n.id,c).k,go:!!pn||(chk.ok&&v.g>=1)};});
|
||||
const keep=r=>f==='all'||(f==='t'&&(r.s==='t'||r.s==='none'))||(f==='worth'&&r.v&&r.v.worth)||(f==='pni'&&(r.s==='here'||r.s==='else'));
|
||||
const val=r=>r.v?r.v.val:-Infinity;
|
||||
rows.sort((a,b)=>az?a.n.name.localeCompare(b.n.name):(b.v&&b.v.worth)-(a.v&&a.v.worth)||val(b)-val(a)||a.n.name.localeCompare(b.n.name));
|
||||
|
|
@ -23,7 +24,7 @@ function pniListHtml(c){const f=UI.pniF||'all',az=UI.pniSort==='az',open=UI.pniO
|
|||
const shown=rows.filter(keep);if(!shown.length)return h+`<p class="empty">${tr('pni_list.nothing_matches')}</p>`;
|
||||
let left=listN('pni'),tot=0;
|
||||
for(const g of PNI_GRP){const gr=shown.filter(r=>pniGrpOf(r.n)===g);if(!gr.length)continue;
|
||||
const w=gr.filter(r=>r.v&&r.v.worth).length,act=w||gr.some(r=>r.go),isOpen=f!=='all'||(open[g]??act);
|
||||
const w=gr.filter(r=>r.v&&r.v.worth).length,act=w||gr.some(r=>r.go),isOpen=f!=='all'||netFiltered()||(open[g]??act);
|
||||
h+=`<div class="pgrp">${btn(`${isOpen?'▾':'▸'} ${esc(pniGrpL(g))} <small>${trn('pni_list.n_networks_w_worth_it',gr.length,{w})}</small>`,'pniGrp',{g,o:isOpen?0:1},'ghost sm')}</div>`;
|
||||
if(!isOpen)continue;tot+=gr.length;
|
||||
for(const r of gr){if(left--<=0)break;h+=pniRow(c,r.n,r.pn,r.v,r.chk);}}
|
||||
|
|
|
|||
|
|
@ -26,5 +26,13 @@ function utilitiesModal(city,message){if(!S)return;const cities=Object.keys(S.po
|
|||
${ppol()!=='open'?`<p class="why">${tr('link_panels.off_while_your_peering_policy_is',{pol:tr(PPOL_N[ppol()])})}</p>${btn(tr('common.peering_policy'),'leftTab',{t:'nets'},'ghost sm')}`:''}
|
||||
${rows.map(r=>`<details><summary>${esc(ixName(r.ix))} · ${tr('utilities.peer_counts',{ready:r.requests.length,existing:r.existing,blocked:r.blocked.length})}</summary>
|
||||
${r.blocked.map(b=>`<p class="meta"><b>${esc(NET[b.id].name)}</b>: ${esc(b.why)}</p>`).join('')}</details>`).join('')}</section>
|
||||
${utilityKitAllHtml(city)}${popTierAllHtml(city)}
|
||||
${cities.length?`<section><label for="utilityCity">${tr('common.your_pop')}</label><div class="btns"><select id="utilityCity" style="max-width:100%">${cities.map(c=>`<option value="${c}"${c===city?' selected':''}>${esc(CITY[c].name)}</option>`).join('')}</select>${btn(tr('utilities.view_pop'),'utilityPick',{},'sm')}</div></section>${utilityKitHtml(city,true)}`:''}`);
|
||||
}
|
||||
// The kit everywhere (#317), and where new POPs get it: the intern's template, which the intern clicks through.
|
||||
function utilityKitAllHtml(city){const q=utilityKitAll();if(!q)return '';const tpl=opsHired()&&S.ops.tpl.kit;
|
||||
return `<section><h3>${tr('utilities.kit_everywhere')}</h3><p class="lead">${tr('utilities.kit_everywhere_note')}</p>
|
||||
${q.cities.length?`<p class="meta">${trn('utilities.kit_all_quote',q.cities.length,{cost:fmt$(q.cost),mo:fmt$(q.mo)})}${q.moves?' · '+tr('utilities.cache_moves',{n:q.moves}):''}</p>
|
||||
<div class="btns">${btn(trn('utilities.kit_all_apply',q.cities.length,{cost:fmt$(q.cost)}),'utilityKitAll',{cost:q.cost,city},'pink',S.cash<q.cost)}</div>`:`<p class="meta">${tr('utilities.kit_all_done')}</p>`}
|
||||
<p class="note">${opsHired()?(tpl?tr('utilities.kit_new_pops_on',{name:opsName()}):tr('utilities.kit_new_pops_off',{name:opsName()})):tr('utilities.kit_new_pops_hire')}</p>
|
||||
${opsHired()?`<div class="btns">${btn(tpl?tr('utilities.kit_new_pops_stop'):tr('utilities.kit_new_pops_start'),'utilityKitNew',{city},tpl?'ghost sm':'sm')}</div>`:''}</section>`;}
|
||||
|
|
|
|||
|
|
@ -16,16 +16,19 @@ function ixBlock(c,multi){const city=ixCity(c),C=CITY[city],ix=ixName(c),X=XIXM[
|
|||
else h+=`<div class="btns">${PORT.map((P2,i)=>i>S.ixp[c]&&portShown(i)?btn(tr('common.upgrade_port_price',{port:P2.n,price:portMo(ixPortMo(c,i)*((S.ixn||{})[c]||1))}),'buyIx',{city:c,tier:i},'sm',(!!S.pops[city]&&!portOk(city,i))||(!S.pops[city]&&i>1)):'').join('')}${S.pops[city]&&((S.ixn||{})[c]||1)<LAG_MAX?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])):''}${((S.ixn||{})[c]||1)>1?btn(tr('common.member'),'lagIx',{city:c,d:-1},'ghost sm'):''}${S.ixp[c]>0?btn(tr('link_panels.downgrade_port_price',{port:PORT[S.ixp[c]-1].n,price:portMo(ixPortMo(c,S.ixp[c]-1)*((S.ixn||{})[c]||1))}),'downIx',{city:c},'ghost sm'):''}${btn(S.rs[c]?tr('link_panels.leave_route_server'):tr('link_panels.join_route_server'),'rs',{city:c},S.rs[c]?'ghost sm':'pink sm')}${S.rs[c]&&ppol()!=='open'?`<span class="meta">${tr('link_panels.off_while_your_peering_policy_is',{pol:tr(PPOL_N[ppol()])})}</span>`:''}${btn(UI.confirm==='ix'+c?tr('common.really_leave'):tr('common.leave_ix'),'cancelIx',{city:c},'ghost sm')}</div>`;
|
||||
h+=`<div style="margin-top:8px">`;
|
||||
{const elig=mine?[]:ixMembers(c).filter(id=>!set.has(id)&&peerOk(id,'ix',c).ok);if(elig.length>1)h+=`<div class="btns">${btn(tr('link_panels.request_all_n_willing_peers',{n:elig.length}),'peerAll',{city:c},'pink sm')}</div>`;}
|
||||
for(const id of ixMembers(c).sort((a,b)=>NSH[b]-NSH[a])){const n=NET[id],on=set.has(id),viaRs=on&&!S.peers[id+'@'+c]&&!mine,chk=peerOk(id,'ix',c);
|
||||
{const ms=ixMembers(c),shown=ms.filter(id=>netKeep(NET[id],set.has(id)));if(ms.length&&!shown.length)h+=netNone();}
|
||||
for(const id of ixMembers(c).filter(id=>netKeep(NET[id],set.has(id))).sort((a,b)=>NSH[b]-NSH[a])){const n=NET[id],on=set.has(id),viaRs=on&&!S.peers[id+'@'+c]&&!mine,chk=peerOk(id,'ix',c);
|
||||
h+=`<div class="row">${logo(n)}<div class="grow"><div class="nm">${esc(n.name)}</div><div class="meta"><span class="tag ${n.type}">${TYPE_L[n.type]}</span> <span class="tag ${n.pol}">${n.pol}</span> · ${(NSH[id]*100).toFixed(NSH[id]<0.01?1:0)}%${n.tail?' <span class="tag st">'+tr('common.tiny')+'</span>':''}</div>${!on&&!chk.ok?`<div class="why">${esc(chk.why)}</div>`:''}</div>
|
||||
${on?(viaRs||mine?`<span class="tag st on">${mine?tr('common.member_fef5'):tr('common.via_rs')}</span>`:btn(tr('common.peered_ce2f'),'unpeer',{city:c,net:id},'green sm',false,tr('link_panels.click_to_tear_down'))):btn(tr('common.request'),'peer',{city:c,net:id},'sm',!chk.ok)}</div>`;}
|
||||
h+=`</div>`;}
|
||||
h+=`</section>`;return h;
|
||||
}
|
||||
function borderSection(l){const w=borderShut(l);return w?`<section><h3 style="color:var(--bad)">${tr('link_panels.border_closed')}</h3><p class="lead">${w==='gulf'?tr('link_panels.a_diplomatic_spat_has_closed_the')+' '+tr('link_panels.back_in_n_days',{n:S.ev.gulf-S.day}):tr('link_panels.russia_has_unplugged_itself_from_the')}</p></section>`:'';}
|
||||
// Both ends of a link in its panel header open that city (#196), say to upgrade the router there for a bigger wave.
|
||||
const lkEnds=l=>[l.a,l.b].map(c=>cityOn(c)?btn(esc(CITY[c].name),'popGo',{city:c},'clink'):esc(CITY[c].name)).join(' ⇄ ');
|
||||
function vxcPanel(l){
|
||||
const load=R.load[l.id]||0,cap=VXC[l.vt].g,u=load/cap,down=linkDown(l),f=FAB[l.prov];
|
||||
let h=`<div class="ph"><div><div class="eyebrow">${tr('link_panels.virtual_circuit_name_km_km',{name:esc(f.name),km:l.km.toLocaleString()})}</div><h2>${CITY[l.a].name} ⇄ ${CITY[l.b].name}</h2></div><button class="x" data-act="closePanel" aria-label="${tr('common.close')}">×</button></div><div class="scroll">`;
|
||||
let h=`<div class="ph"><div><div class="eyebrow">${tr('link_panels.virtual_circuit_name_km_km',{name:esc(f.name),km:l.km.toLocaleString()})}</div><h2>${lkEnds(l)}</h2></div><button class="x" data-act="closePanel" aria-label="${tr('common.close')}">×</button></div><div class="scroll">`;
|
||||
h+=borderSection(l);if(down&&!borderShut(l))h+=`<section><h3 style="color:var(--bad)">${tr('common.fabric_outage')}</h3><p class="lead">${tr('link_panels.name_is_down_nothing_you_can',{name:esc(f.name)})}</p></section>`;
|
||||
h+=`<section><h3>${tr('common.capacity')}</h3><div class="kv"><span>${tr('link_panels.name_circuit',{name:VXC[l.vt].n})}</span><b>${fmtG(load)} / ${fmtG(cap)}</b></div><div class="bar ${barCls(u)}"><i style="width:${Math.min(100,u*100)}%"></i></div>
|
||||
<div class="kv"><span>${tr('common.monthly')}</span><b>${tr('common.price_mo',{price:fmt$(l.mo)})}</b></div>${!S.pops[l.b]?`<p class="note">${tr('link_panels.remote_peering_leg_into_ix',{ix:esc(CITY[l.b].ix)})}</p>`:''}
|
||||
|
|
@ -114,7 +117,7 @@ function layPanel(l){const d=S.day,st=layStart(l),q=layQuote(l),km=Math.round(la
|
|||
return h;}
|
||||
function dfPanel(l){
|
||||
const load=R.load[l.id]||0,cap=dfCap(l),u=cap?load/cap:0,bld=l.ready>S.day,A=CITY[l.a].name,B=CITY[l.b].name,inc=S.inc.find(i=>i.ref===l.id||i.ref===(l.trench||l.id)),amps=ampCount(l.km),sysD=DF_SYS[l.sys];
|
||||
let h=`<div class="ph"><div><div class="eyebrow">${tr('link_panels.dark_fiber_kind_km_km',{kind:l.own?tr('link_panels.your_own_build'):tr('common.leased_iru'),km:l.km.toLocaleString()})}</div><h2>${A} ⇄ ${B}</h2></div><button class="x" data-act="closePanel" aria-label="${tr('common.close')}">×</button></div><div class="scroll">`;
|
||||
let h=`<div class="ph"><div><div class="eyebrow">${tr('link_panels.dark_fiber_kind_km_km',{kind:l.own?tr('link_panels.your_own_build'):tr('common.leased_iru'),km:l.km.toLocaleString()})}</div><h2>${lkEnds(l)}</h2></div><button class="x" data-act="closePanel" aria-label="${tr('common.close')}">×</button></div><div class="scroll">`;
|
||||
if(bld){const tot=Math.max(1,l.ready-l.day),done=clamp((S.day-l.day)/tot,0,1);
|
||||
h+=`<section><h3>${l.own?tr('common.under_construction'):tr('common.being_spliced')}</h3><div class="kv"><span>${l.own?tr('link_panels.permits_trenching_splicing'):tr('common.iru_handover')}</span><b>${tr('common.n_days_left',{n:l.ready-S.day})}</b></div><div class="bar me"><i style="width:${done*100}%"></i></div>${l.own&&l.sub?layPanel(l):l.own?`<div class="btns">${btn(tr('link_panels.hire_extra_crews_price_30_days',{price:fmt$(crewCost(l))}),'crews',{id:l.id},'sm',!crewSteps(l)||S.cash<crewCost(l))}${btn(trn('link_panels.all_crews_done_in_n_days_price',Math.max(1,crewFloor(l)-S.day),{price:fmt$(crewSteps(l)*crewCost(l))}),'crews',{id:l.id,all:1},'sm',!crewSteps(l)||S.cash<crewSteps(l)*crewCost(l))}</div>${!crewSteps(l)&&l.ready>S.day+1?`<p class="note">${tr('link_panels.crews_can_halve_a_build_at_most')}</p>`:''}`:''}<p class="note">${tr('link_panels.you_can_pre_install_optics_now')}</p></section>`;}
|
||||
else if(inc&&linkDown(l))h+=`<section><h3 style="color:var(--bad)">${tr('common.dark_6bf5')}</h3><p class="lead">${esc(inc.msg)}</p>${shipNote(inc)}${inc.cost?btn(`${esc(inc.fix||tr('common.rush_repair'))} ${fmt$(inc.cost)}`,'fixInc',{id:inc.id},'red',S.cash<inc.cost):''}</section>`;
|
||||
|
|
@ -142,14 +145,14 @@ function dfPanel(l){
|
|||
}
|
||||
function offersHere(c){
|
||||
const os=S.offers.filter(o=>bCities(o).includes(c));if(!os.length)return '';
|
||||
return `<section><h3>${tr('common.offers_here')}</h3>${os.map(o=>`<div class="row${o.id===UI.offerAt?' on':''}"><div class="grow"><div class="nm">${esc(o.name)}</div><div class="meta">${esc(BIZ_T[o.type].l)}${o.city2?` ${CITY[o.city].name} ⇄ ${CITY[o.city2].name}`:''} · ${bTerms(o)} · ${tr('ui.n_d_left',{n:o.exp-S.day})}</div>${spotWhy(o)}${R.reach<0.99&&!BIZ_T[o.type].l2?`<div class="why">${tr('link_panels.they_need_the_full_internet_your',{pct:pct(R.reach)})}</div>`:''}${o.type==='scrub'&&!hasScrub()?`<div class="why">${tr('link_panels.needs_your_own_scrubbing_center')}</div>`:''}${bRisk(o)}${reqList(o)}${bHas(o)?'':`<div class="why">${tr('link_panels.needs_a_pop_in_cities_too',{cities:bCities(o).filter(x=>!S.pops[x]).map(x=>CITY[x].name).join(', ')})}</div>`}</div>${bHas(o)?btn(tr('common.accept'),'accept',{id:o.id},'green sm'):''}${btn(tr('common.no'),'decline',{id:o.id},'ghost sm')}</div>`).join('')}</section>`;
|
||||
return `<section><h3>${tr('common.offers_here')}</h3>${os.map(o=>`<div class="row${o.id===UI.offerAt?' on':''}"><div class="grow"><div class="nm">${esc(o.name)}</div><div class="meta">${esc(BIZ_T[o.type].l)}${o.city2?` ${CITY[o.city].name} ⇄ ${CITY[o.city2].name}`:''} · ${bTerms(o)} · ${tr('ui.n_d_left',{n:o.exp-S.day})}</div>${spotWhy(o)}${R.reach<0.99&&!BIZ_T[o.type].l2?`<div class="why">${tr('link_panels.they_need_the_full_internet_your',{pct:pct(R.reach)})}</div>`:''}${o.type==='scrub'&&!hasScrub()?`<div class="why">${tr('link_panels.needs_your_own_scrubbing_center')}</div>`:''}${bRisk(o)}${reqList(o)}${reqFixHtml(o)}${bHas(o)?'':`<div class="why">${tr('link_panels.needs_a_pop_in_cities_too',{cities:bCities(o).filter(x=>!S.pops[x]).map(x=>CITY[x].name).join(', ')})}</div>`}</div>${bHas(o)?btn(tr('common.accept'),'accept',{id:o.id},'green sm'):''}${btn(tr('common.no'),'decline',{id:o.id},'ghost sm')}</div>`).join('')}</section>`;
|
||||
}
|
||||
function linkPanel(id){
|
||||
const l=S.links.find(x=>x.id===id);if(!l){UI.sel=null;return '';}
|
||||
if(l.kind==='vxc')return vxcPanel(l);
|
||||
if(l.kind==='df')return dfPanel(l);
|
||||
const load=R.load[l.id]||0,cap=LT[l.tier].g,u=load/cap,cut=l.cut>S.day,trk=l.trench||l.id,inc=S.inc.find(i=>(LINKCUT_TR.includes(i.type)&&i.ref===trk)||((i.type==='fatwave'||i.type==='label'||i.type==='mtu')&&i.ref===l.id)),sib=pairLinks(l.a,l.b).filter(x=>x!==l&&x.kind!=='vxc'),mates=sib.filter(x=>(x.trench||x.id)===trk);
|
||||
let h=`<div class="ph"><div><div class="eyebrow">${l.cable?esc(CAB[l.cable].name):l.sub?tr('common.subsea_cable'):tr('common.terrestrial_fiber')} · ${l.km.toLocaleString()} km</div><h2>${CITY[l.a].name} ⇄ ${CITY[l.b].name}</h2></div><button class="x" data-act="closePanel" aria-label="${tr('common.close')}">×</button></div><div class="scroll">`;
|
||||
let h=`<div class="ph"><div><div class="eyebrow">${l.cable?esc(CAB[l.cable].name):l.sub?tr('common.subsea_cable'):tr('common.terrestrial_fiber')} · ${l.km.toLocaleString()} km</div><h2>${lkEnds(l)}</h2></div><button class="x" data-act="closePanel" aria-label="${tr('common.close')}">×</button></div><div class="scroll">`;
|
||||
if(cut)h+=`<section><h3 style="color:var(--bad)">${tr('common.cut_2e50')}</h3><p class="lead">${inc?esc(inc.msg):''} ${inc&&shipSea(inc)?'':tr('link_panels.back_in_n_days',{n:l.cut-S.day})}</p>${shipNote(inc)}${inc&&inc.cost?btn(`${esc(inc.fix||tr('common.rush_repair'))} ${fmt$(inc.cost)}`,'fixInc',{id:inc.id},'red',S.cash<inc.cost):''}</section>`;
|
||||
h+=borderSection(l);
|
||||
h+=`<section><h3>${tr('common.capacity')}</h3><div class="kv"><span>${tr('link_panels.name_wave',{name:LT[l.tier].n})}</span><b>${fmtG(load)} / ${fmtG(cap)}</b></div><div class="bar ${barCls(u)}"><i style="width:${Math.min(100,u*100)}%"></i></div>
|
||||
|
|
|
|||
|
|
@ -2741,6 +2741,12 @@
|
|||
"lifecycle.odd_wireguard":"They are going fully remote. All 40 staff will run WireGuard from their kitchens, and the office line is just for the plants.",
|
||||
"lifecycle.odd_wrong_blue":"The new office manager wants every cable the same colour, and yours is the wrong blue.",
|
||||
"lifecycle.referred_by":"Referred by {name}, one of your happiest customers.",
|
||||
"lifecycle.ren_diverse":"two diverse paths",
|
||||
"lifecycle.ren_lat":"latency within {max} ms (now {now})",
|
||||
"lifecycle.ren_no_subsea":"no subsea cable",
|
||||
"lifecycle.ren_per_g":"{was} → {price} per Gbps",
|
||||
"lifecycle.ren_sites_traffic":{"one":"{n} site × {bw} booked, {srv} served","other":"{n} sites × {bw} booked, {srv} served"},
|
||||
"lifecycle.ren_traffic":"{bw} booked, {srv} served",
|
||||
"lifecycle.renewal_haggle":"renewal on {date}: haggling",
|
||||
"lifecycle.renewals":"Renewals",
|
||||
"lifecycle.renewals_soon":"Renewals",
|
||||
|
|
@ -3164,6 +3170,9 @@
|
|||
"modal_and_names.the_real_thing_follow_a_packet":"The real thing: follow a packet from Wi-Fi to undersea fiber.",
|
||||
"modals.lay_your_own_subsea_cable":"Lay your own subsea cable…",
|
||||
"modals.your_own_subsea_cable_level_n":"Your own subsea cable <small>level {n} or Tier 1</small>",
|
||||
"net_filter.clear":"Clear",
|
||||
"net_filter.connected_only":"Connected only",
|
||||
"net_filter.find_a_network":"Find a network or AS number",
|
||||
"networks.a_mobile_network_named_after_the":"A mobile network named after the sound of a toast. Cheers to every 5G tower.",
|
||||
"networks.a_spanish_carrier_starring_in_every":"A Spanish carrier starring in every Latin American market, at least until it sells the next one.",
|
||||
"networks.a_tiny_telco_in_a_country":"A tiny telco in a country where the world’s cables come ashore. Prices to match.",
|
||||
|
|
@ -3399,6 +3408,7 @@
|
|||
"ops.ops":"Ops",
|
||||
"ops.ops_name":"Ops · {name}",
|
||||
"ops.p_at":"Above",
|
||||
"ops.p_fresh":"Light new fiber",
|
||||
"ops.p_g":"From",
|
||||
"ops.p_how":"How",
|
||||
"ops.p_keep":"Keep one spare",
|
||||
|
|
@ -3930,6 +3940,29 @@
|
|||
"pop_std.none":"None",
|
||||
"pop_std.not_all_of_the_standard":"Not enough cash or level for the whole standard in {city}: it got what fit.",
|
||||
"pop_std.standard_for_new_pops":"Standard for new POPs",
|
||||
"pop_tiers.apply_cost":"Bring it up <small>{cost}</small>",
|
||||
"pop_tiers.bring_up_n":{"one":"Bring {n} POP up <small>{cost}</small>","other":"Bring {n} POPs up <small>{cost}</small>"},
|
||||
"pop_tiers.bulk_done":{"one":"{kind}: {n} POP brought up to the standard.","other":"{kind}: {n} POPs brought up to the standard."},
|
||||
"pop_tiers.bulk_note":"Every POP you marked as a kind, brought up to its standard in one go. Change a standard (a new model, more routers) and press again.",
|
||||
"pop_tiers.city_is_kind":"{city} meets the {kind} standard.",
|
||||
"pop_tiers.hub":"Regional hub",
|
||||
"pop_tiers.mark":"Mark it",
|
||||
"pop_tiers.medium":"Medium POP",
|
||||
"pop_tiers.meets_it":"Meets it",
|
||||
"pop_tiers.micro":"Micro POP",
|
||||
"pop_tiers.model_locked":"{model} unlocks at customer level {lv}.",
|
||||
"pop_tiers.n_below":{"one":"{n} below the standard","other":"{n} below the standard"},
|
||||
"pop_tiers.n_pops":{"one":"{n} POP","other":"{n} POPs"},
|
||||
"pop_tiers.n_stuck":{"one":"{n} can't take it yet","other":"{n} can't take it yet"},
|
||||
"pop_tiers.no_kind":"No kind yet",
|
||||
"pop_tiers.not_all":"Not all of the standard went in at {city}. Check the Infra tab.",
|
||||
"pop_tiers.not_set":"not set yet",
|
||||
"pop_tiers.note":"Save a POP's routers as a standard, then mark other POPs as that kind. Bringing a POP up adds routers and swaps to the bigger model, never a step down. Utilities brings every POP of a kind up at once.",
|
||||
"pop_tiers.save_here":"Save these routers",
|
||||
"pop_tiers.saved":"{kind} is now {desc}.",
|
||||
"pop_tiers.swapped_today":"The routers here were swapped today. Try again tomorrow.",
|
||||
"pop_tiers.this_pop_is":"This POP: {kind}",
|
||||
"pop_tiers.title":"POP standards",
|
||||
"pops_transit_ix.40_off_for_6_months":"40% off for 6 months",
|
||||
"pops_transit_ix.40_off_ix_for_6_months":"<b>40% off {ix} for 6 months.</b><br>Your account manager is relieved. Read the small print later.",
|
||||
"pops_transit_ix.after_consulting_with_management_the":"<b>\"After consulting with management…\"</b><br>The price went up. Management was consulted.",
|
||||
|
|
@ -4197,6 +4230,12 @@
|
|||
"release_notes.read_the_full_notes_on_github":"Read the full notes on GitHub",
|
||||
"release_notes.series_of_tubes_v_is_out":"Series of Tubes {v} is out!",
|
||||
"release_notes.your_game_is_saved_automatically":"Your game is saved automatically.",
|
||||
"req_fix.bought":"Bought {list} for {cost}.",
|
||||
"req_fix.buy_and_sign":"Buy it and sign <small>{cost}</small>",
|
||||
"req_fix.buys_list":"Missing: {list}. {cost} + {mo}/mo.",
|
||||
"req_fix.generator_in_city":"a backup generator in {city}",
|
||||
"req_fix.second_router_in_city":"a second router in {city}",
|
||||
"req_fix.second_site_in_city":"a second site in {city}",
|
||||
"requirements.a_spare_fiber_pair_in_your":"a spare fiber pair in your {a}–{b} trench",
|
||||
"requirements.afraid_of_sharks_needs_a_path":"Afraid of sharks: needs a path with no subsea cable",
|
||||
"requirements.backup_generator_in_every_city_they":"Backup generator in every city they touch",
|
||||
|
|
@ -4831,9 +4870,20 @@
|
|||
"utilities.caches_requested":"Installed {n} cache boxes in {city}.",
|
||||
"utilities.ix_peering":"Network-wide IX peering",
|
||||
"utilities.join_route_servers":"Join all route servers ({n})",
|
||||
"utilities.kit_all_applied":{"one":"Redundancy kit installed at {n} POP.","other":"Redundancy kit installed at {n} POPs."},
|
||||
"utilities.kit_all_apply":{"one":"Kit {n} POP <small>{cost}</small>","other":"Kit all {n} POPs <small>{cost}</small>"},
|
||||
"utilities.kit_all_done":"Every POP has the full kit.",
|
||||
"utilities.kit_all_quote":{"one":"{n} POP needs it · {cost} + {mo}/mo","other":"{n} POPs need it · {cost} + {mo}/mo"},
|
||||
"utilities.kit_applied":"Redundancy updated in {city}.",
|
||||
"utilities.kit_balanced":"Hardware installed and caches balanced.",
|
||||
"utilities.kit_cost":"One-off: {cost} · Additional monthly cost: {mo}",
|
||||
"utilities.kit_everywhere":"Redundancy kit everywhere",
|
||||
"utilities.kit_everywhere_note":"The kit at every POP still missing part of it: generator, second building, second router, caches balanced between sites. One price for all of them.",
|
||||
"utilities.kit_new_pops_hire":"Hire a NOC intern to open new POPs from a template with the kit already in.",
|
||||
"utilities.kit_new_pops_off":"New POPs opened from {name}'s template come without the kit.",
|
||||
"utilities.kit_new_pops_on":"New POPs opened from {name}'s template get the kit too.",
|
||||
"utilities.kit_new_pops_start":"Put the kit in the template",
|
||||
"utilities.kit_new_pops_stop":"Leave it out of the template",
|
||||
"utilities.peer_counts":"{ready} eligible · {existing} existing · {blocked} unavailable",
|
||||
"utilities.peering_note":"Request eligible peers at every IX you have joined. Existing sessions, including route-server peers, are skipped. Refusals and traffic thresholds still apply. No ports or paid PNIs are purchased.",
|
||||
"utilities.peers_requested":"Established {n} new IX peering sessions.",
|
||||
|
|
|
|||
|
|
@ -49,6 +49,8 @@ section h3{font-size:17px;margin-bottom:6px;display:flex;align-items:center;gap:
|
|||
.b.green{background:var(--ok);color:#fff}
|
||||
.b.sm{font-size:12px;padding:2px 8px 1px;border-radius:9px;box-shadow:0 2px 0 var(--ink)}
|
||||
.b.big{font-size:18px;padding:7px 18px 5px}
|
||||
/* A city name in a heading that opens the city (link panels, #196): reads as the heading, underlined like a link. */
|
||||
.b.clink,.b.clink:active{font:inherit;color:inherit;background:none;border:0;box-shadow:none;transform:none;padding:2px 0;border-radius:0;white-space:normal;text-align:left;text-decoration:underline;text-decoration-thickness:2px;text-underline-offset:4px;text-decoration-color:var(--me)}
|
||||
.b small{font-family:var(--body);font-weight:800;font-size:10.5px;opacity:.85;margin-left:3px}
|
||||
|
||||
.logo{width:30px;height:30px;border-radius:50%;background:var(--c);border:2.5px solid var(--ink);display:grid;place-items:center;color:#fff;font-family:var(--display);font-weight:800;font-size:11px;flex:none;letter-spacing:-.02em}
|
||||
|
|
|
|||
5
src/styles/36-net-filter.css
Normal file
5
src/styles/36-net-filter.css
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
/* Find a network at a POP (#199) and the POP standards rows (#315). */
|
||||
.netf{display:flex;flex-direction:column;gap:6px;margin:0 0 10px}
|
||||
.netf input.t{font-size:16px;padding:6px 10px;min-height:44px}
|
||||
.netf .btns{margin:0}
|
||||
.ptier .row .btns{margin-top:4px}
|
||||
Loading…
Add table
Add a link
Reference in a new issue