MCPcopy Create free account
hub / github.com/Rello/analytics / choose

Function choose

js/jsonPicker.js:139–155  ·  view source on GitHub ↗
(key, parts, value, parent)

Source from the content-addressed store, hash-verified

137 return button;
138 };
139 const choose = (key, parts, value, parent) => {
140 const label = document.createElement('label');
141 label.className = 'jsonPickerValue';
142 const checkbox = document.createElement('input');
143 checkbox.type = 'checkbox';
144 checkbox.disabled = !picker.selectable(parts);
145 const path = parts.join('/');
146 checkbox.checked = selected.includes(path);
147 checkbox.addEventListener('change', () => {
148 selected = checkbox.checked ? [...selected, path] : selected.filter(item => item !== path);
149 update();
150 });
151 const text = document.createElement('span');
152 text.textContent = key + ': ' + JSON.stringify(value)?.slice(0, 120);
153 label.append(checkbox, text);
154 parent.appendChild(label);
155 };
156 // Render at most 50 entries at once, and only expand objects on demand.
157 const children = (samples, parts, parent, fields = false) => {
158 const entries = new Map();

Callers 1

renderFunction · 0.85

Calls 4

filterMethod · 0.80
appendMethod · 0.80
updateFunction · 0.70
addEventListenerMethod · 0.45

Tested by

no test coverage detected