Tree fixes

This commit is contained in:
2026-03-16 10:23:43 -05:00
parent 8b5f6f173b
commit d92e82cea0
5 changed files with 278 additions and 10 deletions
+1 -1
View File
@@ -110,4 +110,4 @@
"addressed": [],
"known": []
}
}
}
+23
View File
@@ -115,6 +115,11 @@ function createTreeNode(name, value, path) {
childrenContainer.appendChild(childNode);
});
if (shouldStartCollapsed(name, value)) {
childrenContainer.classList.add('collapsed');
toggle.textContent = '▶';
}
toggle.addEventListener('click', event => {
event.stopPropagation();
childrenContainer.classList.toggle('collapsed');
@@ -138,6 +143,24 @@ function createTreeNode(name, value, path) {
return container;
}
function shouldStartCollapsed(name, value) {
if (!value || typeof value !== 'object') {
return false;
}
const childKeys = Object.keys(value);
if (childKeys.length === 0) {
return false;
}
const hotfixChildren = childKeys.filter(key => {
const match = key.match(/^(.*)-h\d+$/i);
return match && match[1] === name;
});
return hotfixChildren.length > 0;
}
function createCheckbox(path, value) {
const checkbox = document.createElement('input');
checkbox.type = 'checkbox';
+44 -8
View File
@@ -56,25 +56,25 @@ function transformNode(node) {
};
}
const grouped = {};
const groupedByPrefix = {};
addressed.forEach(fileName => {
const prefix = getFilePrefix(fileName);
if (!grouped[prefix]) {
grouped[prefix] = { addressed: [], known: [] };
if (!groupedByPrefix[prefix]) {
groupedByPrefix[prefix] = { addressed: [], known: [] };
}
grouped[prefix].addressed.push(fileName);
groupedByPrefix[prefix].addressed.push(fileName);
});
known.forEach(fileName => {
const prefix = getFilePrefix(fileName);
if (!grouped[prefix]) {
grouped[prefix] = { addressed: [], known: [] };
if (!groupedByPrefix[prefix]) {
groupedByPrefix[prefix] = { addressed: [], known: [] };
}
grouped[prefix].known.push(fileName);
groupedByPrefix[prefix].known.push(fileName);
});
return grouped;
return groupHotfixPrefixes(groupedByPrefix);
}
const transformed = {};
@@ -84,6 +84,42 @@ function transformNode(node) {
return transformed;
}
function groupHotfixPrefixes(groupedByPrefix) {
const byFamily = {};
Object.keys(groupedByPrefix).forEach(prefix => {
const family = getReleaseFamily(prefix);
if (!byFamily[family]) {
byFamily[family] = [];
}
byFamily[family].push(prefix);
});
const result = {};
Object.keys(byFamily).forEach(family => {
const members = byFamily[family];
const hasHotfixes = members.length > 1 || members.some(member => member !== family);
if (!hasHotfixes && members[0] === family) {
result[family] = groupedByPrefix[family];
return;
}
const branch = {};
members.forEach(member => {
branch[member] = groupedByPrefix[member];
});
result[family] = branch;
});
return result;
}
function getReleaseFamily(prefix) {
return String(prefix || '').replace(/-h\d+$/i, '');
}
function getFilePrefix(fileName) {
const baseName = String(fileName || '');
const underscoreIndex = baseName.indexOf('_');
+1 -1
View File
@@ -32,7 +32,7 @@ h2 {
}
.sidebar {
flex: 0 0 250px;
flex: 0 0 350px;
background-color: #f8f9fa;
border: 1px solid #ddd;
border-radius: 4px;