diff --git a/nodejs/views/directory.ejs b/nodejs/views/directory.ejs index d7f5003..c1b17aa 100644 --- a/nodejs/views/directory.ejs +++ b/nodejs/views/directory.ejs @@ -15,12 +15,6 @@ -
- - - - -
@@ -49,7 +43,12 @@ {{{indentHtml}}} {{kind}}{{#metadata.subType}} ({{metadata.subType}}){{/metadata.subType}} - {{name}}
{{slug}} + + + {{name}} + +
{{slug}} + {{#metadata.isProduction}}Prod{{/metadata.isProduction}} {{^metadata.isProduction}}Dev{{/metadata.isProduction}} @@ -376,8 +375,7 @@ function renderTable() { const filter = $('#search-filter').val().toLowerCase(); const sort = $('#sort-by').val(); - const viewMode = $('input[name="viewMode"]:checked').val(); - + let filtered = rawResources.filter(r => { if (!filter) return true; return (r.name || '').toLowerCase().includes(filter) || @@ -402,42 +400,38 @@ let finalRenderList = []; - if (viewMode === 'tree') { - const map = {}; - const roots = []; - filtered.forEach(r => { map[r.id] = { ...r, children: [] }; }); - - filtered.forEach(r => { - const node = map[r.id]; - if (node.parentId && map[node.parentId]) { - map[node.parentId].children.push(node); - } else { - roots.push(node); - } - }); - - const flatten = (nodes, depth) => { - nodes.forEach(n => { - let indentHtml = ''; - for(let i = 0; i < depth; i++) { - indentHtml += ''; - } - if (depth > 0) { - indentHtml += ''; - } - n.indentHtml = indentHtml; - finalRenderList.push(n); - if (n.children.length > 0) { - flatten(n.children, depth + 1); - } - }); - }; - - flatten(roots, 0); - } else { - finalRenderList = filtered.map(r => ({ ...r, indentHtml: '' })); - } - + const map = {}; + const roots = []; + filtered.forEach(r => { map[r.id] = { ...r, children: [] }; }); + + filtered.forEach(r => { + const node = map[r.id]; + if (node.parentId && map[node.parentId]) { + map[node.parentId].children.push(node); + } else { + roots.push(node); + } + }); + + const flatten = (nodes, depth) => { + nodes.forEach(n => { + let indentHtml = ''; + for(let i = 0; i < depth; i++) { + indentHtml += ''; + } + if (depth > 0) { + indentHtml += ''; + } + n.indentHtml = indentHtml; + finalRenderList.push(n); + if (n.children.length > 0) { + flatten(n.children, depth + 1); + } + }); + }; + + flatten(roots, 0); + $.scope.resources.empty(); for (const r of finalRenderList) { $.scope.resources.push(r);