From 5f37dc9b6f6b79da04da70ae0c33ec8d02998587 Mon Sep 17 00:00:00 2001 From: historia <[not public]> Date: Wed, 1 Jul 2026 02:21:42 -0400 Subject: feat: qol improvements to items crud in admin gui --- internal/admin/static/editor.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'internal/admin/static/editor.js') diff --git a/internal/admin/static/editor.js b/internal/admin/static/editor.js index 1ed0653..37bc797 100644 --- a/internal/admin/static/editor.js +++ b/internal/admin/static/editor.js @@ -59,7 +59,7 @@ function renderDirGroup(name, ids, filter) { displayIds = ids.filter(function(id) { return String(id).toLowerCase().indexOf(filter) >= 0; }); if (displayIds.length === 0) return ''; } - var expanded = isFiltering ? true : (collapsedDirs[name] === false || (!name && collapsedDirs[''] === undefined)); + var expanded = isFiltering ? true : (collapsedDirs[name] === true); var displayName = name || editorType.charAt(0).toUpperCase() + editorType.slice(1); var h = '
'; if (name) { @@ -79,7 +79,7 @@ function renderDirGroup(name, ids, filter) { } function toggleDir(name) { - collapsedDirs[name] = collapsedDirs[name] === false ? true : false; + collapsedDirs[name] = collapsedDirs[name] !== true; renderList(''); } @@ -206,6 +206,13 @@ function switchTab(e, tab) { tabs.forEach(function(t) { t.style.display = 'none'; }); var target = document.getElementById('tab' + tab.charAt(0).toUpperCase() + tab.slice(1)); if (target) target.style.display = 'block'; + + if (tab === 'yaml' && currentID) { + API.get('/api/' + editorType + '/' + encodeURIComponent(currentID)).then(function(data) { + var pre = document.querySelector('#tabYaml pre'); + if (pre) pre.textContent = data._raw || JSON.stringify(data, null, 2); + }); + } } function getNested(obj, path) { -- cgit v1.2.3