|
104 | 104 |
|
105 | 105 |
|
106 | 106 | import { TableExplorer } from "./rl-tools/static/extrack_ui/TableExplorer.js"; |
107 | | - const tableExplorer = new TableExplorer(idx, {"verbose": true}) |
108 | | - const explorerContainer = document.getElementById('explorer-container'); |
109 | | - explorerContainer.appendChild(tableExplorer.getContainer()); |
110 | | - |
111 | 107 | import { Zoo } from "./rl-tools/static/extrack_ui/Zoo.js"; |
112 | | - const zoo = new Zoo(idx, {"verbose": true}) |
113 | | - const zooContainer = document.getElementById('zoo-container'); |
114 | | - zooContainer.appendChild(zoo.getContainer()); |
| 108 | + |
| 109 | + // Wait for index to load before creating components |
| 110 | + idx_promise.then(() => { |
| 111 | + // Create Zoo first with empty selection |
| 112 | + const zoo = new Zoo([]); |
| 113 | + const zooContainer = document.getElementById('zoo-container'); |
| 114 | + zooContainer.appendChild(zoo.getContainer()); |
| 115 | + |
| 116 | + // Create TableExplorer with callback to update Zoo |
| 117 | + const tableExplorer = new TableExplorer(idx, { |
| 118 | + onSelectionChange: (selectedRuns) => { |
| 119 | + zoo.updateRuns(selectedRuns); |
| 120 | + } |
| 121 | + }); |
| 122 | + const explorerContainer = document.getElementById('explorer-container'); |
| 123 | + explorerContainer.appendChild(tableExplorer.getContainer()); |
| 124 | + |
| 125 | + // Wait for table to initialize and set default selections |
| 126 | + tableExplorer.initialized.then(() => { |
| 127 | + // Select last curated run and last 3 CI runs |
| 128 | + const allRuns = tableExplorer.runs; |
| 129 | + const curatedRuns = allRuns.filter(r => r.source === 'curated'); |
| 130 | + const ciRuns = allRuns.filter(r => r.source === 'ci'); |
| 131 | + |
| 132 | + const defaultSelections = [ |
| 133 | + ...(curatedRuns.length > 0 ? [curatedRuns[0]] : []), |
| 134 | + ...ciRuns.slice(0, 3) |
| 135 | + ]; |
| 136 | + |
| 137 | + if (defaultSelections.length > 0) { |
| 138 | + tableExplorer.setSelectedRuns(defaultSelections); |
| 139 | + } |
| 140 | + }); |
| 141 | + }); |
115 | 142 |
|
116 | 143 |
|
117 | 144 | fetch("./last_updated.txt") |
|
0 commit comments