MCPcopy Create free account
hub / github.com/cppla/ServerStatus / signalBars

Function signalBars

web/js/app.js:386–390  ·  view source on GitHub ↗
(ms)

Source from the content-addressed store, hash-verified

384 }).filter(Boolean);
385}
386function signalBars(ms){
387 const levels = [20, 50, 100, 160];
388 let on = typeof ms === 'number' ? (ms <= levels[0] ? 5 : ms <= levels[1] ? 4 : ms <= levels[2] ? 3 : ms <= levels[3] ? 2 : 1) : 0;
389 return `<span class="sig">${[0,1,2,3,4].map(i => `<i class="b ${i < on ? 'on' : 'off'}"></i>`).join('')}</span>`;
390}
391function monitorItems(s){
392 const items = parseCustom(s.custom);
393 return items.map(item => `<span class="mon-item"><span class="name">${esc(item.name)}</span>${signalBars(item.ms)}<span class="ms">${item.ms}ms</span></span>`).join('') || '-';

Callers 1

monitorItemsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected