|
290 | 290 | }
|
291 | 291 | #view_console_button.right-controls-button,
|
292 | 292 | #backend_toggle_button,
|
293 |
| - #button.right-controls-button { |
| 293 | + #button.right-controls-button, |
| 294 | + #expand_all_button, |
| 295 | + #collapse_all_button{ |
294 | 296 | height: 36px;
|
295 | 297 | background-color: #f8f8f8;
|
296 | 298 | border: #f8f8f8 solid 0.5px;
|
|
308 | 310 | background-color: white;
|
309 | 311 | border: #dadce0 solid 0.5px;
|
310 | 312 | }
|
| 313 | + #expand_collapse_all_text_bar { |
| 314 | + height: 36px; |
| 315 | + margin-left: 2px; |
| 316 | + align-items: center; |
| 317 | + text-align: center; |
| 318 | + padding-left: 25px; |
| 319 | + padding-right: 5px; |
| 320 | + padding-top: 2px; |
| 321 | + display: flex; |
| 322 | + justify-content: center; |
| 323 | + font-size: 14px; |
| 324 | + } |
311 | 325 | #dialog.right-controls-dialog {
|
312 | 326 | padding:0px;
|
313 | 327 | min-width:150px;
|
|
1286 | 1300 | }
|
1287 | 1301 | },
|
1288 | 1302 |
|
| 1303 | + // Expand or collapse all processes thread tracks |
| 1304 | + _expandOrCollapseAll: function(shouldExpand) { |
| 1305 | + const processes = document.getElementsByClassName('process-track-base'); |
| 1306 | + for(let i = 0; i < processes.length; ++i) |
| 1307 | + { |
| 1308 | + processes[i].expanded = shouldExpand; |
| 1309 | + } |
| 1310 | + }, |
| 1311 | + |
| 1312 | + _addExpandAndCollapseAllButtons: function() { |
| 1313 | + //Add text bar next to buttons |
| 1314 | + const textBar = document.createElement('div'); |
| 1315 | + textBar.textContent = 'Processes:'; |
| 1316 | + textBar.setAttribute('id', 'expand_collapse_all_text_bar'); |
| 1317 | + |
| 1318 | + var expandAllButton = document.createElement('tr-ui-b-toolbar-button'); |
| 1319 | + expandAllButton.textContent = 'Expand All'; |
| 1320 | + |
| 1321 | + var collapseAllButton = document.createElement('tr-ui-b-toolbar-button'); |
| 1322 | + collapseAllButton.textContent = 'Collapse All'; |
| 1323 | + |
| 1324 | + expandAllButton.setAttribute('id', 'expand_all_button'); |
| 1325 | + collapseAllButton.setAttribute('id', 'collapse_all_button'); |
| 1326 | + |
| 1327 | + // Add event listener to buttons |
| 1328 | + expandAllButton.addEventListener('click', () => this._expandOrCollapseAll(true)); |
| 1329 | + collapseAllButton.addEventListener('click', () => this._expandOrCollapseAll(false)); |
| 1330 | + // Append buttons to the DOM (inside the same parent element) |
| 1331 | + this._traceViewer.leftControls.appendChild(textBar); |
| 1332 | + this._traceViewer.leftControls.appendChild(expandAllButton); |
| 1333 | + this._traceViewer.leftControls.appendChild(collapseAllButton); |
| 1334 | + }, |
| 1335 | + |
1289 | 1336 | // Overwrite and fine tune the inherited catapult/tracing UI
|
1290 | 1337 | _adjustUI: function() {
|
1291 | 1338 | // 1. Adjust styles of the leftControl and its children
|
|
1294 | 1341 | const searchBar = document.getElementById('view_find_control');
|
1295 | 1342 | Polymer.dom(this._traceViewer.leftControls).appendChild(searchBar);
|
1296 | 1343 | const searchInput = document.getElementById('filter');
|
| 1344 | + |
| 1345 | + this._addExpandAndCollapseAllButtons(); |
| 1346 | + |
1297 | 1347 | searchInput.placeholder = 'Find Events...';
|
1298 | 1348 |
|
1299 | 1349 | // 2. Adjust styles of the rightControl and its children
|
|
0 commit comments