From fea8aa36931f265de557611624e4c740a1946084 Mon Sep 17 00:00:00 2001 From: Didi Hoffmann Date: Tue, 2 Dec 2025 21:05:19 +0100 Subject: [PATCH] saves the tab and sets it on phase change --- frontend/js/helpers/metric-boxes.js | 15 ++++++++++++++- frontend/js/stats.js | 16 ++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/frontend/js/helpers/metric-boxes.js b/frontend/js/helpers/metric-boxes.js index acb9c4987..c1fb1cffb 100644 --- a/frontend/js/helpers/metric-boxes.js +++ b/frontend/js/helpers/metric-boxes.js @@ -67,7 +67,20 @@ class PhaseMetrics extends HTMLElement { `; - $(this).find('.menu .item').tab(); + const $tabs = $(this).find('.menu .item'); + + $tabs.tab({ + context: $(this), + onVisible: (tab) => { + localStorage.setItem('activeMetricTab', tab); + } + }); + + const activeTab = localStorage.getItem('activeMetricTab'); + + if (activeTab) { + $tabs.tab('change tab', activeTab); + } } } diff --git a/frontend/js/stats.js b/frontend/js/stats.js index 3adf8d920..82fc5c612 100644 --- a/frontend/js/stats.js +++ b/frontend/js/stats.js @@ -635,6 +635,22 @@ const fetchAndFillPhaseStatsData = async (url_params) => { }) ); + document.querySelectorAll('#runtime-sub-phases .item').forEach(node => { node.addEventListener('click', event => { + const activeTab = localStorage.getItem('activeMetricTab'); + + const tabName = node.getAttribute('data-tab'); + const segment = document.querySelector('.ui.bottom.attached.tab.segment[data-tab="' + tabName + '"]'); + + if (!segment) return; + + const tabs = $(segment).find('#unit-tabs .item'); + + if (activeTab) { + tabs.tab('change tab', activeTab); + } + }); + }); + renderCompareChartsForPhase(phase_stats.data, getAndShowPhase()); displayTotalChart(...buildTotalChartData(phase_stats.data));