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

Function value

web/js/app.js:183–194  ·  view source on GitHub ↗
(server, m)

Source from the content-addressed store, hash-verified

181 const dir = S.filters.dir === 'asc' ? 1 : -1;
182 const ma = metrics(a), mb = metrics(b);
183 const value = (server, m) => ({
184 name: String(server.name || ''),
185 type: String(server.type || ''),
186 location: String(server.location || ''),
187 status: m.online ? 1 : 0,
188 load: num(server.load_1),
189 cpu: num(server.cpu),
190 memory: m.memPct,
191 hdd: m.hddPct,
192 traffic: m.traffic,
193 loss: m.loss
194 })[S.filters.sort];
195 const va = value(a, ma), vb = value(b, mb);
196 if(typeof va === 'string') return va.localeCompare(vb, 'zh-CN') * dir;
197 return (va - vb) * dir;

Callers 1

visibleServersFunction · 0.85

Calls 1

numFunction · 0.85

Tested by

no test coverage detected