| 116 | result.appendChild(notes); |
| 117 | } |
| 118 | function relationships(title, entries) { |
| 119 | var list = section(title + ' (' + entries.length + ')'); |
| 120 | if (!entries.length) list.appendChild(element('p', 'None in this exported graph.', 'inspector-muted')); |
| 121 | entries.forEach(function(entry) { |
| 122 | var row = element('div', undefined, 'inspector-relation'); |
| 123 | row.appendChild(element('div', compact(entry.edge.kind), 'inspector-predicate')); |
| 124 | var neighbor = byId.get(entry.other); |
| 125 | if (neighbor) { |
| 126 | var button = element('button', neighbor.label || neighbor.id, 'inspector-neighbor'); |
| 127 | button.type = 'button'; |
| 128 | button.title = entry.other; |
| 129 | button.addEventListener('click', function() { select(entry.other); picker.focus(); }); |
| 130 | row.appendChild(button); |
| 131 | } |
| 132 | row.appendChild(element('code', entry.other, 'inspector-node-id')); |
| 133 | if (entry.edge.metadata !== undefined && entry.edge.metadata !== null) { |
| 134 | var details = element('details'); |
| 135 | details.appendChild(element('summary', 'Relationship metadata')); |
| 136 | details.appendChild(element('pre', JSON.stringify(entry.edge.metadata, null, 2), 'inspector-value')); |
| 137 | row.appendChild(details); |
| 138 | } |
| 139 | list.appendChild(row); |
| 140 | }); |
| 141 | } |
| 142 | function select(id) { |
| 143 | var node = byId.get(id); |
| 144 | picker.value = node ? node.id : ''; |