diff --git a/dDashboardServer/static/js/packet-captures.js b/dDashboardServer/static/js/packet-captures.js index f050708ad..6e786fbca 100644 --- a/dDashboardServer/static/js/packet-captures.js +++ b/dDashboardServer/static/js/packet-captures.js @@ -143,6 +143,7 @@ state.records = []; state.worlds = []; byId('worldMarkers').innerHTML = ''; + byId('propertySummary').classList.add('d-none'); state.selected = -1; history.replaceState(null, '', '#capture=' + id); byId('viewer').classList.remove('d-none'); @@ -182,9 +183,71 @@ else render(); renderHeader(); loadWorlds(c.id); + loadProperty(c.id); }, function () { state.loading = false; }); } + // ---- the properties the capture was on ---- + + function point(p) { return p && p.length === 3 ? p.map(function (v) { return v.toFixed(1); }).join(', ') : ''; } + + // What happened to the models: placed, moved (a run of moves of one model is one entry) and removed + function modelEvents(world) { + var out = []; + (world.events || []).forEach(function (e) { + if (e.kind !== 'placed' && e.kind !== 'moved' && e.kind !== 'removed') return; + var last = out[out.length - 1]; + if (e.kind === 'moved' && last && last.kind === 'moved' && last.object === e.object) { last.moves++; last.position = e.position; return; } + out.push(Object.assign({ moves: 1 }, e)); + }); + return out; + } + + function eventHtml(e) { + var what = e.object ? esc(e.name || ('LOT ' + e.lot)) + ' LOT ' + esc(e.lot) + '' : 'a model'; + var text = e.kind === 'placed' ? 'Placed ' + what + (e.position ? ' at ' + esc(point(e.position)) : '') + (e.object ? '' : ' (not seen made)') + : e.kind === 'moved' ? 'Moved ' + what + (e.moves > 1 ? ' ' + e.moves + ' times' : '') + ' to ' + esc(point(e.position)) + : 'Removed ' + what + (e.reason ? ' (' + esc(e.reason) + ')' : ''); + // Jump to the packet that said it: the client's request for a removal it asked for + var index = e.kind === 'removed' && e.asked !== undefined ? e.asked : e.i; + return ''; + } + + function worldHtml(w) { + var info = (w.info || [])[0], last = (w.info || [])[(w.info || []).length - 1]; + var owner = info ? info.ownerName : (w.saved ? w.saved.ownerName : ''); + var ownerId = info ? info.ownerId : (w.saved ? w.saved.ownerId : ''); + var events = modelEvents(w); + var name = last && last.name ? last.name : (w.saved ? w.saved.name : ''); + return '