MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / relationships

Function relationships

atomic-cli/src/commands/query/graph_inspector.js:118–141  ·  view source on GitHub ↗
(title, entries)

Source from the content-addressed store, hash-verified

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 : '';

Callers 1

selectFunction · 0.85

Calls 5

elementFunction · 0.85
selectFunction · 0.85
sectionFunction · 0.70
compactFunction · 0.70
getMethod · 0.65

Tested by

no test coverage detected