Skip to content

Commit

Permalink
log cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
acharneski committed Jan 12, 2025
1 parent 23726b9 commit 7682be3
Show file tree
Hide file tree
Showing 11 changed files with 8 additions and 1,561 deletions.
103 changes: 0 additions & 103 deletions webapp/src/utils/tabHandling.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,20 +145,6 @@ export function setActiveTab(button: Element, container: Element) {
const previousTab = getActiveTab(container.id);
const forTab = button.getAttribute('data-for-tab');
if (!forTab) return;
console.debug('[TabSystem] Tab Change Initiated', {
operation: 'setActiveTab',
tab: forTab,
previousTab: previousTab,
button: button,
containerId: container.id,
timestamp: new Date().toISOString(),
stack: new Error().stack,
buttonClasses: button.classList.toString(),
containerChildren: container.children.length,
navigationTiming: performance.getEntriesByType('navigation')[0],
documentReadyState: document.readyState
});

setActiveTabState(container.id, forTab);
saveTabState(container.id, forTab);

Expand All @@ -169,36 +155,13 @@ export function setActiveTab(button: Element, container: Element) {
} else {
btn.classList.remove('active');
}
console.debug('[TabSystem] Button State Change', {
operation: 'updateButtonState',
buttonId: btn.id,
forTab: btn.getAttribute('data-for-tab'),
previousState: prevState,
newState: btn.classList.contains('active'),
timestamp: new Date().toISOString()
});
});

container.querySelectorAll(':scope > .tab-content').forEach(content => {
const prevDisplay = (content as HTMLElement).style.display;
if (content.getAttribute('data-tab') === forTab) {
content.classList.add('active');
(content as HTMLElement).style.display = 'block';
console.debug('[TabSystem] Tab Content State Change', {
operation: 'activateContent',
tab: forTab,
containerId: container.id,
contentId: content.id,
timestamp: new Date().toISOString(),
previousDisplay: prevDisplay,
newDisplay: 'block',
contentChildren: content.children.length,
contentSize: {
width: (content as HTMLElement).offsetWidth,
height: (content as HTMLElement).offsetHeight
},
visibilityState: document.visibilityState
});
updateNestedTabs(content as HTMLElement);
} else {
content.classList.remove('active');
Expand Down Expand Up @@ -226,74 +189,26 @@ export function setActiveTab(button: Element, container: Element) {
}
}
});
console.debug('[TabSystem] Tab Change Completed', {
operation: 'setActiveTab',
containerId: container.id,
activeTab: forTab,
previousTab: previousTab,
timestamp: new Date().toISOString(),
performance: {
timing: performance.now(),
navigation: performance.getEntriesByType('navigation')[0],
resourceTiming: performance.getEntriesByType('resource'),
},
documentState: {
readyState: document.readyState,
visibilityState: document.visibilityState,
activeElement: document.activeElement?.tagName
},
browserInfo: {
userAgent: navigator.userAgent,
platform: navigator.platform,
language: navigator.language
}
});
}

function restoreTabState(container: Element) {
try {
diagnostics.restoreCount++;
const containerId = container.id;
console.debug(`[TabSystem] Restoring Tab State`, {
operation: 'restoreTabState',
containerId: containerId,
timestamp: new Date().toISOString(),
diagnostics: { ...diagnostics }
});

const savedTab = getActiveTab(containerId) ||
tabStates.get(containerId)?.activeTab;
if (savedTab) {
const tabsContainer = container.querySelector(':scope > .tabs');
const button = tabsContainer?.querySelector(`:scope > .tab-button[data-for-tab="${savedTab}"]`) as HTMLElement;
if (button) {
console.debug(`[TabSystem] Found Saved Tab`, {
operation: 'restoreTabState',
containerId: containerId,
savedTab: savedTab,
buttonFound: true,
stack: new Error().stack
});
setActiveTab(button, container);
diagnostics.restoreSuccess++;
} else {
diagnostics.restoreFail++;
console.warn(`[TabSystem] Tab Restore Failed - No Matching Button`, {
operation: 'restoreTabState',
containerId,
savedTab,
failCount: diagnostics.restoreFail,
stack: new Error().stack
});
}
} else {
diagnostics.restoreFail++;
console.debug(`[TabSystem] No Saved Tab Found - Using First Button`, {
operation: 'restoreTabState',
containerId: containerId,
fallback: 'firstButton',
diagnostics: { ...diagnostics }
});
const firstButton = container.querySelector('.tab-button') as HTMLElement;
if (firstButton) {
setActiveTab(firstButton, container);
Expand Down Expand Up @@ -321,19 +236,13 @@ export function resetTabState() {

export const updateTabs = debounce(() => {
if (isMutating) {
console.debug(`Skipping update during mutation`);
return;
}
try {
const currentStates = getAllTabStates();
const processed = new Set<string>();
const tabsContainers = Array.from(document.querySelectorAll('.tabs-container'));
isMutating = true;
console.debug(`Starting tab update`, {
containersCount: document.querySelectorAll('.tabs-container').length,
existingStates: currentStates.size,
tabsContainers: tabsContainers.map(c => c.id)
});
tabsContainers.forEach(container => {
if (processed.has(container.id)) {
return;
Expand Down Expand Up @@ -385,11 +294,6 @@ export const updateTabs = debounce(() => {
}
}

console.debug(`Updating tabs`, {
containerId: container.id,
activeTab: activeTab
});

let activeCount = 0;
let inactiveCount = 0;
// Handle both direct and anchor-wrapped tabs
Expand All @@ -411,13 +315,6 @@ export const updateTabs = debounce(() => {
(content as HTMLElement).style.display = 'none';
}
});
if (VERBOSE_LOGGING) console.debug(`${`Synchronized ${activeCount + inactiveCount} buttons`}`, {
activeTab,
activeCount,
inactiveCount,
containerId: container.id,
container,
})
}
});
isMutating = false;
Expand Down
6 changes: 3 additions & 3 deletions webui/src/main/resources/application/asset-manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"files": {
"main.css": "/static/css/main.387caf0e.css",
"main.js": "/static/js/main.da33f828.js",
"main.js": "/static/js/main.a4da29b6.js",
"static/js/9017.98ad007d.chunk.js": "/static/js/9017.98ad007d.chunk.js",
"static/js/5536.9c75127e.chunk.js": "/static/js/5536.9c75127e.chunk.js",
"static/js/7035.2bce51c5.chunk.js": "/static/js/7035.2bce51c5.chunk.js",
Expand Down Expand Up @@ -72,7 +72,7 @@
"static/js/5195.756798f5.chunk.js": "/static/js/5195.756798f5.chunk.js",
"index.html": "/index.html",
"main.387caf0e.css.map": "/static/css/main.387caf0e.css.map",
"main.da33f828.js.map": "/static/js/main.da33f828.js.map",
"main.a4da29b6.js.map": "/static/js/main.a4da29b6.js.map",
"9017.98ad007d.chunk.js.map": "/static/js/9017.98ad007d.chunk.js.map",
"5536.9c75127e.chunk.js.map": "/static/js/5536.9c75127e.chunk.js.map",
"7035.2bce51c5.chunk.js.map": "/static/js/7035.2bce51c5.chunk.js.map",
Expand Down Expand Up @@ -139,6 +139,6 @@
},
"entrypoints": [
"static/css/main.387caf0e.css",
"static/js/main.da33f828.js"
"static/js/main.a4da29b6.js"
]
}
2 changes: 1 addition & 1 deletion webui/src/main/resources/application/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<link rel="apple-touch-icon" href="logo192.png"/>
<link rel="manifest" href="manifest.json"/>
<title>React App</title>
<script defer="defer" src="static/js/main.da33f828.js"></script>
<script defer="defer" src="static/js/main.a4da29b6.js"></script>
<link href="static/css/main.387caf0e.css" rel="stylesheet">
</head>
<body>
Expand Down

This file was deleted.

This file was deleted.

1,374 changes: 0 additions & 1,374 deletions webui/src/main/resources/application/static/js/main.6d732246.js

This file was deleted.

This file was deleted.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

This file was deleted.

0 comments on commit 7682be3

Please sign in to comment.