From 5ad0d5b5268418300c8c560c0ff745fe84bba4d4 Mon Sep 17 00:00:00 2001 From: jrobinso <933148+jrobinso@users.noreply.github.com> Date: Tue, 9 Dec 2025 11:11:45 -0800 Subject: [PATCH 1/2] allow grouped "track hub" style menu configuration from json --- js/widgets/trackSelectionListModal.js | 18 +++++----- js/widgets/trackSelectionModal.js | 32 +++++++++--------- js/widgets/trackWidgets.js | 23 +++++++------ resources/tracks/mm10_sample.json | 48 +++++++++++++++++++++++++++ 4 files changed, 86 insertions(+), 35 deletions(-) create mode 100644 resources/tracks/mm10_sample.json diff --git a/js/widgets/trackSelectionListModal.js b/js/widgets/trackSelectionListModal.js index a778e56..5820549 100644 --- a/js/widgets/trackSelectionListModal.js +++ b/js/widgets/trackSelectionListModal.js @@ -1,22 +1,22 @@ -export default function createTrackSelectionListModal({id, label = '', sections, description = '', okHandler}) { +export default function createTrackSelectionListModal({id, label = '', groups, description = '', okHandler}) { - // Flatten sections to get all tracks. + // Flatten groups to get all tracks. const tracks = [] const trackMap = new Map() - const flattenSections = (sections) => { - sections.forEach(section => { - if (section.tracks) { - section.tracks.forEach(track => { + const flattenGroups = (groups) => { + groups.forEach(group => { + if (group.tracks) { + group.tracks.forEach(track => { tracks.push(track) trackMap.set(track._id, track) }) } - if (section.children) { - flattenSections(section.children) + if (group.children) { + flattenGroups(group.children) } }) } - flattenSections(sections) + flattenGroups(groups) // Generate the HTML for the modal const renderTracks = (tracks) => { diff --git a/js/widgets/trackSelectionModal.js b/js/widgets/trackSelectionModal.js index cfe1e09..43e6547 100644 --- a/js/widgets/trackSelectionModal.js +++ b/js/widgets/trackSelectionModal.js @@ -1,4 +1,4 @@ -export default function createTrackSelectionModal({id, label = '', sections, description = '', okHandler}) { +export default function createTrackSelectionModal({id, label = '', groups, description = '', okHandler}) { const html = `