Fit the left tabs on small screens; move routing settings into a modal
The left panel's four tabs overflowed its 272px width on tablets and small laptops: Goals wrapped its count, Networks ran off the edge. Counts now sit on the tab's corner, labels stay on one line and shrink last. Backbone, Auto-TE and DDoS settings sat below every notification in the NOC tab. A Routing & DDoS button at the top opens them in a modal that redraws in place after each action, with a red dot when Auto-TE is paused.
This commit is contained in:
parent
4a66bbf998
commit
3048c18b14
19 changed files with 110 additions and 17 deletions
|
|
@ -6,6 +6,8 @@ All notable changes to this project are documented here. The project follows
|
|||
|
||||
## [Unreleased]
|
||||
|
||||
- Backbone, Auto-TE and DDoS settings now open from a Routing & DDoS button at the top of the NOC tab. They used to sit at the very bottom, below every notification; a red dot on the button says when Auto-TE is paused.
|
||||
- The tabs above the left panel no longer run off its edge on smaller screens and tablets. Counts such as finished goals now sit on the corner of their tab.
|
||||
- Networks you reach through an exchange's route server now stay "via RS" (#265). With an Open peering policy, the peering desk used to turn some of them into separate sessions of their own.
|
||||
- The intern's "Light more fiber" order has a new Optics setting: light new fiber with the biggest optic it can afford, to save channels for later (#262). Once a fiber is lit, the intern still adds more of the same optic and never swaps what is in there.
|
||||
- Gaming customers no longer warn that they attract attacks in modes without DDoS attacks, such as Change Freeze.
|
||||
|
|
|
|||
|
|
@ -58,7 +58,14 @@
|
|||
if (w.where === 'city') { UI.sel = { type: 'city', id: w.city }; UI.tab = w.tab; renderAll(); return btns($('panel')); }
|
||||
if (w.where === 'link') { if (!S.links.some((l) => l.id === w.id)) return []; UI.sel = { type: 'link', id: w.id }; renderAll(); return btns($('panel')); }
|
||||
if (w.where === 'dash') { $('dash').hidden = false; UI.dtab = w.tab; renderDash(); const b = btns($('dash')); return b; }
|
||||
if (w.where === 'left') { UI.left = w.tab; UI.leftOpen = true; renderLeft(); return btns($('leftBody')); }
|
||||
if (w.where === 'left') {
|
||||
UI.left = w.tab; UI.leftOpen = true; renderLeft(); let b = btns($('leftBody'));
|
||||
if (w.tab !== 'noc') return b;
|
||||
// The backbone, Auto-TE and DDoS settings moved from the NOC tab into the Routing & DDoS modal: offer them here on
|
||||
// both pages, in one order, so main's page (settings in the tab) and this one (behind the button) stay in lockstep.
|
||||
if (typeof routingBody === 'function' && b.some((x) => x.act === 'routingOpen')) { const d = document.createElement('div'); d.innerHTML = routingBody(); b = b.filter((x) => x.act !== 'routingOpen').concat(btns(d)); }
|
||||
return b.sort((x, y) => (sig(x) < sig(y) ? -1 : sig(x) > sig(y) ? 1 : 0));
|
||||
}
|
||||
if (w.where === 'openLink') { if (!S.pops[w.a]) return []; openLinkModal(w.a, w.b); return modalOpen() ? btns($('modal')) : []; }
|
||||
return [];
|
||||
};
|
||||
|
|
|
|||
|
|
@ -3524,6 +3524,9 @@
|
|||
"routescript.write_rules_check_them_against_live":"Schreib Regeln, prüfe sie gegen den Live-Traffic, dann deploye sie. Ein schlechtes Deployment ist ein sehr realer Weg, dein Netz kaputt zu machen.",
|
||||
"routescript.writing_a_script":"Ein Skript schreiben",
|
||||
"routescript.written_by_ai_prompt_make_my":"# ✨ Geschrieben von {ai}. Prompt: „mach mein Netz gut“.",
|
||||
"routing.ddos_defence":"DDoS-Abwehr",
|
||||
"routing.how_traffic_crosses_your_backbone":"Wie Traffic über deinen Backbone läuft und was passiert, wenn eine Flut kommt.",
|
||||
"routing.routing_and_ddos":"Routing & DDoS",
|
||||
"routing_and_routers.maintenance_window_in_city":"Wartungsfenster in {city}",
|
||||
"routing_and_routers.model_unlocks_at_customer_level_lv":"<b>{model} wird ab Kundenlevel {lv} freigeschaltet.</b>",
|
||||
"routing_and_routers.new_router_in_city_swapped_before":"<b>Neuer Router in {city}</b><br>Getauscht, bevor irgendwas eingesteckt war: null Ausfallzeit, null wütende Kunden.",
|
||||
|
|
|
|||
|
|
@ -3522,6 +3522,9 @@
|
|||
"routescript.write_rules_check_them_against_live":"Escribe reglas, compruébalas con el tráfico en vivo y luego despliega. Un mal despliegue es una forma muy real de romper tu red.",
|
||||
"routescript.writing_a_script":"Escribir un script",
|
||||
"routescript.written_by_ai_prompt_make_my":"# ✨ Escrito por {ai}. Prompt: «haz que mi red sea buena».",
|
||||
"routing.ddos_defence":"Defensa DDoS",
|
||||
"routing.how_traffic_crosses_your_backbone":"Cómo cruza el tráfico tu backbone y qué pasa cuando llega una inundación.",
|
||||
"routing.routing_and_ddos":"Routing y DDoS",
|
||||
"routing_and_routers.maintenance_window_in_city":"Ventana de mantenimiento en {city}",
|
||||
"routing_and_routers.model_unlocks_at_customer_level_lv":"<b>{model} se desbloquea en el nivel de cliente {lv}.</b>",
|
||||
"routing_and_routers.new_router_in_city_swapped_before":"<b>Router nuevo en {city}</b><br>Cambiado antes de conectar nada: cero inactividad, cero clientes enfadados.",
|
||||
|
|
|
|||
|
|
@ -3522,6 +3522,9 @@
|
|||
"routescript.write_rules_check_them_against_live":"Écris des règles, vérifie-les sur le trafic réel, puis déploie. Un mauvais déploiement est un moyen très concret de casser ton réseau.",
|
||||
"routescript.writing_a_script":"Écrire un script",
|
||||
"routescript.written_by_ai_prompt_make_my":"# ✨ Écrit par {ai}. Prompt : « rends mon réseau bien ».",
|
||||
"routing.ddos_defence":"Défense DDoS",
|
||||
"routing.how_traffic_crosses_your_backbone":"Comment le trafic traverse ton backbone, et ce qui se passe quand une attaque déferle.",
|
||||
"routing.routing_and_ddos":"Routage et DDoS",
|
||||
"routing_and_routers.maintenance_window_in_city":"Fenêtre de maintenance à {city}",
|
||||
"routing_and_routers.model_unlocks_at_customer_level_lv":"<b>Le {model} se débloque au niveau client {lv}.</b>",
|
||||
"routing_and_routers.new_router_in_city_swapped_before":"<b>Nouveau routeur à {city}</b><br>Remplacé avant que quoi que ce soit ne soit branché : zéro interruption, zéro client fâché.",
|
||||
|
|
|
|||
|
|
@ -3522,6 +3522,9 @@
|
|||
"routescript.write_rules_check_them_against_live":"Scrivi le regole, verificale sul traffico reale, poi fai il deploy. Un deploy sbagliato è un modo molto concreto per rompere la tua rete.",
|
||||
"routescript.writing_a_script":"Scrivere uno script",
|
||||
"routescript.written_by_ai_prompt_make_my":"# ✨ Scritto da {ai}. Prompt: “rendi buona la mia rete”.",
|
||||
"routing.ddos_defence":"Difesa DDoS",
|
||||
"routing.how_traffic_crosses_your_backbone":"Come il traffico attraversa il tuo backbone e cosa succede quando arriva un attacco.",
|
||||
"routing.routing_and_ddos":"Routing e DDoS",
|
||||
"routing_and_routers.maintenance_window_in_city":"Finestra di manutenzione a {city}",
|
||||
"routing_and_routers.model_unlocks_at_customer_level_lv":"<b>{model} si sblocca al livello clienti {lv}.</b>",
|
||||
"routing_and_routers.new_router_in_city_swapped_before":"<b>Nuovo router a {city}</b><br>Sostituito prima che ci fosse collegato qualcosa: zero downtime, zero clienti arrabbiati.",
|
||||
|
|
|
|||
|
|
@ -3522,6 +3522,9 @@
|
|||
"routescript.write_rules_check_them_against_live":"Escreva regras, teste no tráfego real e faça o deploy. Um deploy ruim é um jeito bem real de quebrar sua rede.",
|
||||
"routescript.writing_a_script":"Escrevendo um script",
|
||||
"routescript.written_by_ai_prompt_make_my":"# ✨ Escrito por {ai}. Prompt: “deixa minha rede boa”.",
|
||||
"routing.ddos_defence":"Defesa DDoS",
|
||||
"routing.how_traffic_crosses_your_backbone":"Como o tráfego cruza seu backbone e o que acontece quando chega uma enxurrada.",
|
||||
"routing.routing_and_ddos":"Roteamento e DDoS",
|
||||
"routing_and_routers.maintenance_window_in_city":"Janela de manutenção em {city}",
|
||||
"routing_and_routers.model_unlocks_at_customer_level_lv":"<b>{model} desbloqueia no nível de cliente {lv}.</b>",
|
||||
"routing_and_routers.new_router_in_city_swapped_before":"<b>Roteador novo em {city}</b><br>Trocado antes de qualquer coisa estar conectada: zero downtime, zero clientes bravos.",
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ Object.assign(ACT,{
|
|||
toast(tr('core.your_backbone_now_runs_lv',{lv:tr(CORE_LV[n])})+(out?' '+trn('core.n_pops_stay_outside',out):''),'good');sfx('build');after();},
|
||||
coreLab:()=>{if(!coreOn()||S.core.lab||S.core.lv<1)return;if(!spend(CORE_LAB))return;
|
||||
S.core.lab=true;toast(tr('core.interop_lab_open_vendors_now'),'good');sfx('coin');after();},
|
||||
routingOpen:()=>{if(S&&!pzOn())routingModal();},
|
||||
coreSet:({v})=>{if(!S.core)return;v=+v;if(!(v>=0&&v<=S.core.lv)||(v===S.core.run&&!S.core.legacy))return;S.core.run=v;delete S.core.legacy;sfx('click');after();},
|
||||
via:({v})=>{UI.via=v;if(UI.pending)openLinkModal(UI.pending.a,UI.pending.b);},
|
||||
setRoute:({id,m})=>{if(!own(RT,m))return;const b=S.biz.find(x=>x.id===id);if(b){b.route=m;sfx('click');after();}},
|
||||
|
|
|
|||
|
|
@ -22,6 +22,6 @@ function morphKids(a,b){let x=a.firstChild,y=b.firstChild;
|
|||
else if(x.nodeValue!==y.nodeValue)x.nodeValue=y.nodeValue;
|
||||
x=x&&x.nextSibling;y=ny;}
|
||||
while(x){const nx=x.nextSibling;a.removeChild(x);x=nx;}}
|
||||
function renderAll(){if(isTablet()&&!UI.sel)UI.leftOpen=false;renderHUD();renderLeft();renderPanel();renderHint();renderMega();renderCoach();pzRender();}
|
||||
function renderAll(){if(isTablet()&&!UI.sel)UI.leftOpen=false;renderHUD();renderLeft();renderPanel();renderHint();renderMega();renderCoach();pzRender();routingRefresh();}
|
||||
function renderMega(){const el=$('mega');if(!el)return;const on=!!(S&&S.ev&&S.ev.php>S.day);if(el.hidden===!on)return;el.hidden=!on;}
|
||||
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ function renderLeft(){checkLayer();
|
|||
renderTabbar();
|
||||
if(!S||pzOn()){L.hidden=true;return;}L.hidden=false;
|
||||
const ndone=GOALS.filter(g=>S.done[g.id]!==undefined).length;
|
||||
const tabs=[['goals',`${tr('common.goals')}<span class="cnt">${ndone}/${GOALS.length}</span>`],['deals',`${tr('common.deals')}${S.offers.length?`<span class="cnt">${S.offers.length}</span>`:''}`],['noc',`NOC${S.inc.length?`<span class="cnt red dot" aria-hidden="true"></span>`:''}`],['nets',tr('common.networks')]];
|
||||
const tabs=[['goals',`<span class="tl">${tr('common.goals')}</span><span class="cnt">${ndone}/${GOALS.length}</span>`],['deals',`<span class="tl">${tr('common.deals')}</span>${S.offers.length?`<span class="cnt">${S.offers.length}</span>`:''}`],['noc',`<span class="tl">NOC</span>${S.inc.length?`<span class="cnt red dot" aria-hidden="true"></span>`:''}`],['nets',`<span class="tl">${tr('common.networks')}</span>`]];
|
||||
$('leftTabs').innerHTML=tabs.map(([k,l])=>`<button class="${UI.left===k?'on':''}" data-act="leftTab" data-args='{"t":"${k}"}'>${l}</button>`).join('')+(innerWidth<760?`<button data-act="toggleLeft" style="margin-left:auto" aria-label="${tr('common.close')}">×</button>`:'');
|
||||
let h='';
|
||||
if(UI.left==='goals'){
|
||||
|
|
@ -48,17 +48,13 @@ function renderLeft(){checkLayer();
|
|||
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>${spotWhy(o)}${bRisk(o)}${reqList(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')}${btn(tr('common.connections'),'connOpen',{},'')}${btn(tr('common.traceroute'),'trace',{},'')}</div>`;
|
||||
h+=`<div class="btns" style="margin-bottom:8px">${btn(tr('hud_and_panels.open_noc_dashboard'),'dash',{},'pink')}${btn(tr('common.connections'),'connOpen',{},'')}${btn(tr('common.traceroute'),'trace',{},'')}${btn(`⚙️ ${tr('routing.routing_and_ddos')}${S.te&&!coreTE()?'<span class="cnt red dot" aria-hidden="true"></span>':''}`,'routingOpen',{},'')}</div>`;
|
||||
h+=`<p class="lead">${tr('hud_and_panels.your_network_operations_center_every')}</p>`;
|
||||
h+=opsCard()+mkCard()+ddosPanel();
|
||||
// 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+=`<div class="inc"><div class="nm">${incTitle(i.type)}</div><div class="meta">${esc(i.msg)}</div><div class="meta">${shipSea(i)?'🚢 '+esc(shipStatus(i)):trn('hud_and_panels.auto_fix_in_n_day',i.until-S.day)}${i.impact?` · ${tr('hud_and_panels.g_lost',{g:fmtG(i.impact)})}`:''}</div>${i.cost?`<div class="btns">${btn(`${esc(i.fix||tr('common.rush_repair'))} ${fmt$(i.cost)}`,'fixInc',{id:i.id},'red sm',S.cash<i.cost)}</div>`:''}</div>`;}
|
||||
h+=logSection();UI.logSeen=Date.now();
|
||||
h+=ddosSettings();
|
||||
if(S.grace&&S.grace.until>S.day&&R.graceNets)h+=`<div class="kv"><span>${tr('common.courtesy_route')}</span><b>${tr('hud_and_panels.n_networks_d_days_left',{n:R.graceNets,d:S.grace.until-S.day})}</b></div><p class="meta" style="margin:0 0 6px">${tr('hud_and_panels.reaches_networks_from_the_last')}</p>`;
|
||||
h+=corePanel();
|
||||
h+=S.te&&!coreTE()?`<div class="kv"><span>Auto-TE</span><b>${tr('core.paused')}</b></div><p class="why">${tr('core.auto_te_is_paused_it_needs')}</p>`:S.te?`<div class="kv"><span>Auto-TE</span><b>${S.te.on?tr('hud_and_panels.on_moving_g_onto_alternate_paths',{g:fmtG(R.teMoved||0)}):tr('common.off')}</b></div><div class="btns">${btn(S.te.on?tr('hud_and_panels.turn_auto_te_off'):tr('hud_and_panels.turn_auto_te_on'),'teToggle',{},'ghost sm')}${btn(S.te.script?tr('common.edit_routescript'):tr('hud_and_panels.write_a_routescript'),'teEdit',{},'pink sm')}</div>${S.te.script?`<p class="meta" style="margin:2px 0 6px">RouteScript: ${teRules()?tr('hud_and_panels.n_rules_live',{n:teRules().n}):S.te.on?tr('hud_and_panels.has_errors_not_running'):tr('common.controller_off')}${R.teBlack?` · ${tr('hud_and_panels.blackholing_g',{g:fmtG(R.teBlack)})}`:''}</p>`:''}`
|
||||
:`<div class="kv"><span>Auto-TE</span><b>${lvl()<3?tr('hud_and_panels.unlocks_at_customer_level_3'):tr('common.not_installed')}</b></div><p class="meta" style="margin:2px 0 6px">${tr('hud_and_panels.traffic_takes_the_shortest_path_even')}</p>${coreTE()?'':`<p class="why">${tr('core.auto_te_needs_an_rsvp_te_or')}</p>`}<div class="btns">${btn(tr('hud_and_panels.install_auto_te_cost_mo_mo',{cost:fmt$(TE_COST),mo:fmt$(TE_MO)}),'buyTE',{},'pink sm',lvl()<3||S.cash<TE_COST||!coreTE())}</div>`;
|
||||
const hot=S.links.filter(l=>!linkDown(l)&&capOf(l)>0&&(R.load[l.id]||0)/capOf(l)>=0.85).sort((a,b)=>(R.load[b.id]/capOf(b))-(R.load[a.id]/capOf(a)));
|
||||
if(hot.length){h+=`<h3 style="font-size:15px;margin:4px 0">${tr('common.congested_links')}</h3>${S.te&&S.te.on?'':'<p class="meta" style="margin:0 0 4px">'+tr('hud_and_panels.raise_a_full_link_s_metric')+'</p>'}`+hot.map(l=>`<div class="row"><div class="grow"><div class="nm">${CITY[l.a].name} ⇄ ${CITY[l.b].name}</div><div class="meta">${capName(l)} · ${tr('hud_and_panels.p_full',{p:pct((R.load[l.id]||0)/capOf(l))})}</div></div>${btn(tr('common.inspect'),'selLink',{id:l.id},'pink sm')}</div>`).join('');}
|
||||
h+=hwCard();
|
||||
|
|
|
|||
16
src/game/93-ui/46-routing-modal.js
Normal file
16
src/game/93-ui/46-routing-modal.js
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
/* ---------- Routing & DDoS: one modal for the network-wide settings ----------
|
||||
The backbone, Auto-TE and DDoS automation used to sit at the bottom of the NOC tab, below every incident and
|
||||
the log, where nobody found them. A button at the top of the NOC tab opens them here. */
|
||||
// Auto-TE: paused, installed or for sale.
|
||||
function tePanel(){
|
||||
return S.te&&!coreTE()?`<div class="kv"><span>Auto-TE</span><b>${tr('core.paused')}</b></div><p class="why">${tr('core.auto_te_is_paused_it_needs')}</p>`:S.te?`<div class="kv"><span>Auto-TE</span><b>${S.te.on?tr('hud_and_panels.on_moving_g_onto_alternate_paths',{g:fmtG(R.teMoved||0)}):tr('common.off')}</b></div><div class="btns">${btn(S.te.on?tr('hud_and_panels.turn_auto_te_off'):tr('hud_and_panels.turn_auto_te_on'),'teToggle',{},'ghost sm')}${btn(S.te.script?tr('common.edit_routescript'):tr('hud_and_panels.write_a_routescript'),'teEdit',{},'pink sm')}</div>${S.te.script?`<p class="meta" style="margin:2px 0 6px">RouteScript: ${teRules()?tr('hud_and_panels.n_rules_live',{n:teRules().n}):S.te.on?tr('hud_and_panels.has_errors_not_running'):tr('common.controller_off')}${R.teBlack?` · ${tr('hud_and_panels.blackholing_g',{g:fmtG(R.teBlack)})}`:''}</p>`:''}`
|
||||
:`<div class="kv"><span>Auto-TE</span><b>${lvl()<3?tr('hud_and_panels.unlocks_at_customer_level_3'):tr('common.not_installed')}</b></div><p class="meta" style="margin:2px 0 6px">${tr('hud_and_panels.traffic_takes_the_shortest_path_even')}</p>${coreTE()?'':`<p class="why">${tr('core.auto_te_needs_an_rsvp_te_or')}</p>`}<div class="btns">${btn(tr('hud_and_panels.install_auto_te_cost_mo_mo',{cost:fmt$(TE_COST),mo:fmt$(TE_MO)}),'buyTE',{},'pink sm',lvl()<3||S.cash<TE_COST||!coreTE())}</div>`;}
|
||||
// What the modal holds, without its title (scripts/lib/fuzz-page.js reads its buttons too).
|
||||
function routingBody(){return corePanel()+`<h3 style="font-size:15px;margin:8px 0 4px">${tr('common.traffic_engineering')}</h3>${tePanel()}`
|
||||
+`<h3 style="font-size:15px;margin:8px 0 4px">${tr('routing.ddos_defence')}</h3>${ddosSettings()}`;}
|
||||
function routingModal(){if(!S)return;const card=$('modalCard'),open=!$('modal').hidden&&card.querySelector('[data-routing]'),st=open?card.scrollTop:0;
|
||||
let h=`<div data-routing style="display:flex;align-items:center"><div><div class="eyebrow">NOC</div><h2 style="font-size:26px">${tr('routing.routing_and_ddos')}</h2></div><button class="x" data-act="closeModal" aria-label="${tr('common.close')}">×</button></div>
|
||||
<p class="tagline">${tr('routing.how_traffic_crosses_your_backbone')}</p>`;
|
||||
openModal(h+routingBody());if(open)card.scrollTop=st;}
|
||||
// Actions taken in the modal re-render the game through after(); this keeps the open modal in step.
|
||||
function routingRefresh(){if(S&&!$('modal').hidden&&$('modalCard').querySelector('[data-routing]'))routingModal();}
|
||||
|
|
@ -3523,6 +3523,9 @@
|
|||
"routescript.write_rules_check_them_against_live":"Write rules, check them against live traffic, then deploy. A bad deploy is a very real way to break your network.",
|
||||
"routescript.writing_a_script":"Writing a script",
|
||||
"routescript.written_by_ai_prompt_make_my":"# ✨ Written by {ai}. Prompt: “make my network good”.",
|
||||
"routing.ddos_defence":"DDoS defence",
|
||||
"routing.how_traffic_crosses_your_backbone":"How traffic crosses your backbone, and what happens when a flood arrives.",
|
||||
"routing.routing_and_ddos":"Routing & DDoS",
|
||||
"routing_and_routers.maintenance_window_in_city":"Maintenance window in {city}",
|
||||
"routing_and_routers.model_unlocks_at_customer_level_lv":"<b>{model} unlocks at customer level {lv}.</b>",
|
||||
"routing_and_routers.new_router_in_city_swapped_before":"<b>New router in {city}</b><br>Swapped before anything was plugged in: zero downtime, zero angry customers.",
|
||||
|
|
|
|||
|
|
@ -2,10 +2,15 @@
|
|||
#left{position:fixed;top:calc(env(safe-area-inset-top,0px) + 76px);left:max(12px,env(safe-area-inset-left,0px));width:300px;max-height:calc(100% - 96px - env(safe-area-inset-top,0px) - env(safe-area-inset-bottom,0px));display:flex;flex-direction:column;z-index:4}
|
||||
#panel{position:fixed;top:calc(env(safe-area-inset-top,0px) + 76px);right:max(12px,env(safe-area-inset-right,0px));width:370px;max-height:calc(100% - 96px - env(safe-area-inset-top,0px) - env(safe-area-inset-bottom,0px));display:flex;flex-direction:column;z-index:4}
|
||||
.scroll{overflow:auto;padding:12px 14px 14px;overscroll-behavior:contain}
|
||||
/* Labels stay on one line and give way (with an ellipsis) before the bar overflows the panel; the counts sit on
|
||||
the tab's corner so they cost no width. */
|
||||
.tabs{display:flex;gap:4px;padding:8px 8px 0;border-bottom:3px solid var(--ink);flex:none}
|
||||
.tabs button{border:2.5px solid var(--ink);border-bottom:none;border-radius:11px 11px 0 0;background:var(--soft);padding:4px 10px 3px;font-family:var(--display);font-weight:800;cursor:pointer;font-size:13.5px;position:relative;top:3px}
|
||||
.tabs button.on{background:var(--paper);padding-bottom:6px}
|
||||
.tabs .cnt{display:inline-block;background:var(--me);color:#fff;border-radius:9px;padding:0 6px;font-size:11px;margin-left:4px}
|
||||
#leftTabs{padding-top:11px}
|
||||
.tabs button{border:2.5px solid var(--ink);border-bottom:none;border-radius:11px 11px 0 0;background:var(--soft);padding:4px 10px 3px;font-family:var(--display);font-weight:800;cursor:pointer;font-size:13.5px;position:relative;top:3px;flex:0 1 auto;min-width:0;display:flex;align-items:center}
|
||||
.tabs .tl{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0}
|
||||
.tabs button.on{background:var(--paper);padding-bottom:6px;flex-shrink:0}
|
||||
.tabs .cnt{position:absolute;top:-10px;right:-6px;z-index:1;background:var(--me);color:#fff;border:1.5px solid var(--ink);border-radius:9px;padding:0 5px;font-size:10.5px;line-height:15px;white-space:nowrap}
|
||||
.tabs .cnt.dot{top:-5px;right:-4px;width:11px;height:11px}
|
||||
.tabs .cnt.red{background:var(--bad)}
|
||||
#leftToggle{display:none}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,6 +2,8 @@
|
|||
bigger touch targets so the map keeps some room in the middle. */
|
||||
@media (min-width:761px) and (max-width:1200px){
|
||||
#left{width:272px}
|
||||
#leftTabs{gap:3px;padding-left:6px;padding-right:6px}
|
||||
#leftTabs button{padding-left:6px;padding-right:6px;font-size:12.5px}
|
||||
#panel{width:336px}
|
||||
#left.closed{display:none}
|
||||
#leftToggle{display:flex;position:fixed;left:max(12px,env(safe-area-inset-left,0px));bottom:calc(env(safe-area-inset-bottom,0px) + 14px);z-index:4}
|
||||
|
|
|
|||
|
|
@ -160,7 +160,7 @@ test('the backbone panel and the router panels, on a phone too', () => {
|
|||
for (const w of [1280, 360]) {
|
||||
const { ev, dom, errors } = load();
|
||||
ev("ACT.start({});if(UI.pendGame)ACT.pitchSkip()");
|
||||
ev(`window.innerWidth=${w};` + start.replace('ACT.start({});', '') + `;ACT.buildPop({city:'ams'});S.pops.fra.rgen=${g('Disco 8K')};ACT.coreUp();ACT.coreUp();ACT.leftTab({t:'noc'});renderAll()`);
|
||||
ev(`window.innerWidth=${w};` + start.replace('ACT.start({});', '') + `;ACT.buildPop({city:'ams'});S.pops.fra.rgen=${g('Disco 8K')};ACT.coreUp();ACT.coreUp();ACT.leftTab({t:'noc'});ACT.routingOpen();renderAll()`);
|
||||
const txt = dom.window.document.body.textContent;
|
||||
assert.match(txt, /RSVP-TE\/MPLS/, `${w}px`);
|
||||
assert.match(txt, /outside the backbone/, 'Amsterdam is left out');
|
||||
|
|
|
|||
|
|
@ -170,12 +170,12 @@ test('saves before 2.2 load: an attack on a city finds its target, and an IX bla
|
|||
|
||||
test('the NOC card fits a phone and the sandbox can send a test flood', () => {
|
||||
const { ev, errors, dom } = load();
|
||||
ev("beginGame('T','fra',{mode:'sandbox',preset:'sandbox'});if(UI.pendGame)ACT.pitchSkip();ACT.launchBB({city:'fra'});ACT.buyTransit({city:'fra',net:'cog',tier:1});UI.left='noc';renderLeft()");
|
||||
const b = dom.window.document.querySelector('[data-act=ddosTest]');
|
||||
ev("beginGame('T','fra',{mode:'sandbox',preset:'sandbox'});if(UI.pendGame)ACT.pitchSkip();ACT.launchBB({city:'fra'});ACT.buyTransit({city:'fra',net:'cog',tier:1});UI.left='noc';renderLeft();ACT.routingOpen()");
|
||||
const b = dom.window.document.querySelector('#modal [data-act=ddosTest]');
|
||||
assert.ok(b, 'a test flood button in Sandbox');
|
||||
b.click();
|
||||
assert.equal(ev('ddosAll().length'), 1);
|
||||
ev("UI.left='noc';renderLeft()");
|
||||
ev("closeModal();UI.left='noc';renderLeft()");
|
||||
const card = dom.window.document.querySelector('#left .inc.ddos');
|
||||
assert.ok(card, 'the card is shown');
|
||||
assert.ok(card.querySelectorAll('.btns').length <= 2, 'one suggestion, the rest behind More');
|
||||
|
|
|
|||
|
|
@ -290,7 +290,8 @@ test('notifications: the NOC keeps the last ten minutes, folds repeats and opens
|
|||
ev("UI.left='noc';UI.leftOpen=true;UI.sel=null;renderLeft();renderHUD()");
|
||||
const body = doc.getElementById('leftBody').textContent;
|
||||
assert.match(body, /Notifications\s*last 10 minutes/);
|
||||
assert.ok(body.indexOf('Notifications') < body.indexOf('DDoS scrubbing'), 'near the top, not at the bottom');
|
||||
assert.ok(body.indexOf('Notifications') < body.indexOf('Incidents so far'), 'near the top, not at the bottom');
|
||||
assert.doesNotMatch(body, /DDoS scrubbing/, 'the settings moved to Routing & DDoS');
|
||||
assert.match(body, /×5/); assert.match(body, /just now/);
|
||||
assert.equal(doc.querySelectorAll('#leftBody [data-act=logOpen]').length, 2, 'Open only where it leads somewhere (2 of the 5 shown)');
|
||||
assert.equal(ev("logUnread()"), 0);
|
||||
|
|
|
|||
|
|
@ -992,7 +992,7 @@ test('#63 incidents you can fix with one click sit above hot ports in the NOC',
|
|||
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.ok(t.indexOf('Incidents so far') > fix, 'status lines come after the incidents');
|
||||
assert.deepEqual(errors, []);
|
||||
});
|
||||
|
||||
|
|
|
|||
45
tests/routing-modal.test.js
Normal file
45
tests/routing-modal.test.js
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
const test = require('node:test');
|
||||
const assert = require('node:assert/strict');
|
||||
const { load } = require('./harness');
|
||||
|
||||
const start = "ACT.start({});if(UI.pendGame)ACT.pitchSkip();S.cash=1e8;S.lvl=4;S.nextFail=1e9;S.nextEvent=1e9;ACT.launchBB({city:'fra'})";
|
||||
|
||||
test('the backbone, Auto-TE and DDoS settings open from a button at the top of the NOC tab', () => {
|
||||
const { ev, dom, errors } = load();
|
||||
const doc = dom.window.document;
|
||||
ev(start + ";UI.left='noc';UI.leftOpen=true;UI.sel=null;renderLeft()");
|
||||
const left = doc.getElementById('leftBody');
|
||||
const b = left.querySelector('[data-act=routingOpen]');
|
||||
assert.ok(b, 'the button is there');
|
||||
assert.ok(left.querySelector('.btns').contains(b), 'in the first row of buttons, above the notifications');
|
||||
assert.doesNotMatch(left.textContent, /Auto-RTBH|Install Auto-TE/, 'the settings no longer sit in the tab');
|
||||
b.click();
|
||||
assert.equal(ev("$('modal').hidden"), false);
|
||||
const m = () => doc.getElementById('modalCard').textContent;
|
||||
assert.match(m(), /Routing & DDoS/);
|
||||
assert.match(m(), /Backbone/); assert.match(m(), /Auto-TE/); assert.match(m(), /Auto-RTBH: off/);
|
||||
// An action inside redraws the modal in place.
|
||||
doc.querySelector('#modalCard [data-act=ddosAuto]').click();
|
||||
assert.equal(ev('S.ddosAuto.rtbh'), true);
|
||||
assert.match(m(), /Auto-RTBH: on/);
|
||||
doc.querySelector('#modalCard [data-act=coreUp]').click();
|
||||
assert.equal(ev('S.core.lv'), 1);
|
||||
assert.equal(ev("$('modal').hidden"), false, 'still open after buying');
|
||||
assert.ok(doc.querySelector('#modalCard [data-act=coreSet]'), 'with the new level to pick');
|
||||
// Other modals are left alone.
|
||||
ev("closeModal();ACT.opsOpen()");
|
||||
assert.doesNotMatch(m(), /Auto-RTBH/);
|
||||
assert.deepEqual(errors, []);
|
||||
});
|
||||
|
||||
test('a paused Auto-TE shows on the button, and the modal works on a phone', () => {
|
||||
const { ev, dom, errors } = load();
|
||||
ev("window.innerWidth=360;" + start + ";S.te={on:true,day:S.day};S.core.run=0;UI.left='noc';UI.leftOpen=true;renderLeft()");
|
||||
const b = dom.window.document.querySelector('#leftBody [data-act=routingOpen]');
|
||||
assert.ok(b.querySelector('.cnt.dot'), 'a red dot when Auto-TE is paused');
|
||||
ev('ACT.routingOpen()');
|
||||
assert.match(dom.window.document.getElementById('modalCard').textContent, /Auto-TE is paused/);
|
||||
ev("closeModal();S.core.run=S.core.lv=2;renderLeft()");
|
||||
assert.equal(dom.window.document.querySelector('#leftBody [data-act=routingOpen] .cnt'), null);
|
||||
assert.deepEqual(errors, []);
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue