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

Function applyListViewColumnToElement

renderer.js:14680–14705  ·  view source on GitHub ↗
(el, colId)

Source from the content-addressed store, hash-verified

14678 // Fetch fresh tags directly from the database using getModelTags
14679 // This ensures we get the latest tags even if the model object is cached
14680 const tags = await window.electron.getModelTags(model.id);
14681
14682 if (tags && Array.isArray(tags) && tags.length > 0) {
14683 // Extract tag names (tags might be objects with .name property or just strings)
14684 const tagNames = tags.map(tag => typeof tag === 'string' ? tag : (tag.name || tag));
14685 tagNames.sort((a, b) => a.localeCompare(b)); // Sort tags alphabetically
14686 for (const tagName of tagNames) {
14687 await addTagToModel(tagName, 'model-tags', { skipSave: true });
14688 }
14689 }
14690 } catch (error) {
14691 console.error('Error loading model tags:', error);
14692 }
14693}
14694
14695/** Set tag filter dropdown and refresh the grid (same path as Filter menu; works with getModelsFiltered in Electron and server bridge). */
14696async function applyTagFilterFromModelClick(tagName) {
14697 const trimmed = (tagName && String(tagName).trim()) || '';
14698 if (!trimmed) return;
14699 if (window.dateAddedFilter) {
14700 window.dateAddedFilter = null;
14701 window._lastDateAddedFilter = null;
14702 }
14703 window.viewingEntireLibrary = false;
14704 if (typeof window.resetFilterSelectionAndDetails === 'function') {
14705 window.resetFilterSelectionAndDetails();
14706 }
14707 const tagSelect = document.getElementById('tag-filter');
14708 if (!tagSelect) return;

Callers 1

Calls 2

listViewColDisplayModeFunction · 0.85

Tested by

no test coverage detected