refactor(tabs): centralize tab wiring in base Component.setupTabs with onChange hook; persist and restore NodeDetails active tab; reuse base tabs in ClusterMembersComponent
This commit is contained in:
@@ -570,7 +570,8 @@ class Component {
|
||||
}
|
||||
|
||||
// Tab helpers
|
||||
setupTabs(container = this.container) {
|
||||
setupTabs(container = this.container, options = {}) {
|
||||
const { onChange } = options;
|
||||
const tabButtons = container.querySelectorAll('.tab-button');
|
||||
const tabContents = container.querySelectorAll('.tab-content');
|
||||
tabButtons.forEach(button => {
|
||||
@@ -578,6 +579,9 @@ class Component {
|
||||
e.stopPropagation();
|
||||
const targetTab = button.dataset.tab;
|
||||
this.setActiveTab(targetTab, container);
|
||||
if (typeof onChange === 'function') {
|
||||
try { onChange(targetTab); } catch (_) {}
|
||||
}
|
||||
});
|
||||
});
|
||||
tabContents.forEach(content => {
|
||||
|
||||
Reference in New Issue
Block a user