MCPcopy Create free account
hub / github.com/TechJeeper/Printventory / renderPathTree

Function renderPathTree

renderer.js:2232–2371  ·  view source on GitHub ↗
(filePath, containerId)

Source from the content-addressed store, hash-verified

2230 if (idx === -1) return false;
2231 container.currentModels[idx] = model;
2232 invalidateVirtualGridLayoutCache(container);
2233 return true;
2234}
2235
2236/** Insert a new detailed-view metadata row in the same order as createModelItem (dir row, designer, source, parent, license, tags). */
2237function insertDetailedMetadataRowBefore(metadataContainer, el, selectorList) {
2238 for (const sel of selectorList) {
2239 const ref = metadataContainer.querySelector(sel);
2240 if (ref) {
2241 metadataContainer.insertBefore(el, ref);
2242 return;
2243 }
2244 }
2245 const dirRow = metadataContainer.querySelector('.dir-size-row');
2246 if (dirRow) {
2247 if (dirRow.nextSibling) {
2248 metadataContainer.insertBefore(el, dirRow.nextSibling);
2249 } else {
2250 metadataContainer.appendChild(el);
2251 }
2252 } else if (metadataContainer.firstChild) {
2253 metadataContainer.insertBefore(el, metadataContainer.firstChild);
2254 } else {
2255 metadataContainer.appendChild(el);
2256 }
2257}
2258
2259async function updateModelElement(filePath) {
2260 try {
2261 const model = await window.electron.getModel(filePath);
2262 if (!model) {
2263 console.warn('updateModelElement: Model not found for', filePath);
2264 return;
2265 }
2266 console.log('updateModelElement: Updating element for', filePath, 'with model data:', {
2267 designer: model.designer,
2268 source: model.source,
2269 parentModel: model.parentModel,
2270 license: model.license,
2271 tags: model.tags
2272 });
2273
2274 // Check current filter values
2275 const designer = document.getElementById('designer-select')?.value || '';
2276 const license = document.getElementById('license-select')?.value || '';
2277 const parentModel = document.getElementById('parent-select')?.value || '';
2278 const printStatus = document.getElementById('printed-select')?.value || 'all';
2279 const newStatus = document.getElementById('new-select')?.value || 'all';
2280 const favoriteStatus = document.getElementById('favorite-select')?.value || 'all';
2281 const ratingStatus = document.getElementById('rating-select')?.value || 'all';
2282 const ratingMinStatus = document.getElementById('rating-min-select')?.value || 'all';
2283 const fileType = document.getElementById('filetype-select')?.value || '';
2284 const searchTerm = document.getElementById('search-filter-input')?.value.trim() || '';
2285
2286 // Check if the model matches current filters
2287 let shouldBeVisible = true;
2288
2289 if (designer) {

Callers 1

showModelDetailsFunction · 0.85

Calls 1

parsePathFunction · 0.85

Tested by

no test coverage detected