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

Function createListViewHeader

renderer.js:14990–15300  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

14988 const model = await window.electron.getModel(filePath);
14989 if (model && model.tags) {
14990 const tags = Array.isArray(model.tags) ? model.tags : [];
14991 // Remove the tag from the array
14992 const updatedTags = tags.filter(tag => tag !== tagToRemove);
14993 model.tags = updatedTags.sort();
14994 modelUpdates.push({ filePath, model });
14995 }
14996 } catch (error) {
14997 console.error(`Error loading model ${filePath} for tag removal:`, error);
14998 }
14999 }
15000
15001 // Save all updated models using autoSaveMultipleModels with replaceTags
15002 if (modelUpdates.length > 0) {
15003 // For each model, we need to save with its updated tags
15004 // We'll use the batch update approach
15005 const modelDataBatch = modelUpdates.map(({ model }) => model);
15006 try {
15007 await window.electron.updateModelsBatch(modelDataBatch);
15008 console.log(`Successfully removed tag '${tagToRemove}' from ${modelUpdates.length} models`);
15009 } catch (error) {
15010 console.error('Error in batch update for tag removal:', error);
15011 // Fallback to individual saves
15012 for (const { model } of modelUpdates) {
15013 await window.electron.saveModel(model).catch(err => {
15014 console.error(`Error saving model ${model.filePath}:`, err);
15015 });
15016 }
15017 }
15018
15019 // Update UI elements
15020 for (const { filePath } of modelUpdates) {
15021 await updateModelElement(filePath);
15022 }
15023 }
15024
15025 // Reset dropdown and refresh the remove tag list
15026 removeTagSelect.value = '';
15027 await populateRemoveTagSelect();
15028
15029 // Refresh the add tag dropdown to reflect any changes
15030 await populateTagSelect('multi-tag-select', 'multi-tags');
15031 } catch (error) {
15032 console.error('Error removing tag:', error);
15033 }
15034}
15035
15036async function parseSourceUrl(url) {
15037 try {
15038 if (!url.includes('thangs.com')) return null;
15039
15040 // Fetch the page content
15041 const pageData = await window.electron.fetchThangsPage(url);
15042 if (!pageData) return null;
15043
15044 const { modelTitle, designerName } = pageData;
15045
15046 console.log('Parsed page data:', { modelTitle, designerName });
15047 return {

Callers 1

renderVirtualGridFunction · 0.85

Calls 5

createSortableHeaderFunction · 0.85
createSVGIconFunction · 0.85

Tested by

no test coverage detected