| 666 | } |
| 667 | |
| 668 | function select(kind, id, el) { |
| 669 | clearSelection(); |
| 670 | selection = { kind: kind, id: id }; |
| 671 | if (el) el.classList.add('is-selected'); |
| 672 | else (unitEls[id] || []).forEach(function (e) { e.classList.add('is-selected'); }); |
| 673 | const fn = { |
| 674 | document: openDocumentPanel, chunk: openChunkPanel, entity: openEntityPanel, |
| 675 | summary: openSummaryPanel, bucket: openBucketPanel, |
| 676 | group: function (gid) { |
| 677 | const grp = L.groups.find(function (g) { return g.type_id === gid; }); |
| 678 | if (grp) openGroupPanel(grp); |
| 679 | }, |
| 680 | }[kind]; |
| 681 | if (fn) fn(id); |
| 682 | } |
| 683 | |
| 684 | function selectNodeById(id) { |
| 685 | const kindByStage = { document: 'document', chunk: 'chunk', entity: 'entity', summary: 'summary', context: 'bucket', type: 'group' }; |