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

Function parsePath

renderer.js:2165–2220  ·  view source on GitHub ↗
(filePath)

Source from the content-addressed store, hash-verified

2163
2164 // Check current filter values
2165 const designer = document.getElementById('designer-select')?.value || '';
2166 const license = document.getElementById('license-select')?.value || '';
2167 const parentModel = document.getElementById('parent-select')?.value || '';
2168 const printStatus = document.getElementById('printed-select')?.value || 'all';
2169 const newStatus = document.getElementById('new-select')?.value || 'all';
2170 const favoriteStatus = document.getElementById('favorite-select')?.value || 'all';
2171 const ratingStatus = document.getElementById('rating-select')?.value || 'all';
2172 const ratingMinStatus = document.getElementById('rating-min-select')?.value || 'all';
2173 const fileType = document.getElementById('filetype-select')?.value || '';
2174 const searchTerm = document.getElementById('search-filter-input')?.value.trim() || '';
2175
2176 // Check if the model matches current filters
2177 let shouldBeVisible = true;
2178
2179 if (designer) {
2180 if (designer === '__none__') {
2181 shouldBeVisible = !model.designer || model.designer.trim() === '';
2182 } else {
2183 shouldBeVisible = model.designer &&
2184 model.designer.trim().toLowerCase() === designer.trim().toLowerCase();
2185 }
2186 }
2187
2188 if (shouldBeVisible && license) {
2189 if (license === '__none__') {
2190 shouldBeVisible = !model.license || model.license.trim() === '';
2191 } else {
2192 shouldBeVisible = model.license === license;
2193 }
2194 }
2195
2196 if (shouldBeVisible && parentModel) {
2197 if (parentModel === '__none__') {
2198 shouldBeVisible = !model.parentModel || model.parentModel.trim() === '';
2199 } else {
2200 shouldBeVisible = model.parentModel === parentModel;
2201 }
2202 }
2203
2204 if (shouldBeVisible && printStatus && printStatus !== 'all') {
2205 shouldBeVisible = window.PrintHistory
2206 ? window.PrintHistory.modelMatchesPrintFilter(model, printStatus)
2207 : (printStatus === 'printed' ? !!model.printed : printStatus === 'not-printed' ? !model.printed : true);
2208 }
2209
2210 if (shouldBeVisible && newStatus === 'new') {
2211 shouldBeVisible = isModelNew(model);
2212 } else if (shouldBeVisible && newStatus === 'not-new') {
2213 shouldBeVisible = !isModelNew(model);
2214 }
2215
2216 if (shouldBeVisible && favoriteStatus === 'favorited') {
2217 shouldBeVisible = Boolean(model.favorite);
2218 } else if (shouldBeVisible && favoriteStatus === 'not-favorited') {
2219 shouldBeVisible = !model.favorite;
2220 }
2221
2222 const modelRating = normalizeModelRatingValue(model.rating);

Callers 1

renderPathTreeFunction · 0.85

Calls 1

normalizePathFunction · 0.70

Tested by

no test coverage detected