-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_response.html
More file actions
438 lines (383 loc) · 25 KB
/
test_response.html
File metadata and controls
438 lines (383 loc) · 25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
<!DOCTYPE html>
<html>
<head>
<title>LogHawk - Advanced Log Analysis Platform</title>
<style>
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
background: #f8f9fa; padding: 20px; margin: 0; color: #212529; }
h1 { color: #495057; margin-bottom: 30px; text-align: center; }
h2 { color: #495057; margin-top: 30px; border-bottom: 2px solid #dee2e6; padding-bottom: 10px; }
/* Main container */
.container { max-width: 1400px; margin: 0 auto; }
/* Form styles */
form { background: #fff; padding: 30px; border-radius: 10px; box-shadow: 0 4px 6px rgba(0,0,0,0.1); margin-bottom: 30px; }
/* Folder selection */
.folder-section { margin-bottom: 25px; }
label { display: block; margin-bottom: 8px; font-weight: 600; color: #495057; }
input[type=text], input[type=number], textarea {
width: 100%; padding: 10px; border: 2px solid #e9ecef; border-radius: 5px;
font-size: 14px; transition: border-color 0.3s; box-sizing: border-box;
}
input[type=text]:focus, input[type=number]:focus, textarea:focus {
border-color: #0d6efd; outline: none; box-shadow: 0 0 0 0.2rem rgba(13,110,253,0.25);
}
.folder-input-group { display: flex; gap: 10px; align-items: center; }
.folder-input-group input { flex: 1; margin-right: 10px; }
/* Button styles */
button {
padding: 10px 20px; border: none; border-radius: 5px; cursor: pointer;
font-weight: 600; transition: all 0.3s; font-size: 14px;
}
.scan-btn { background: #28a745; color: white; font-size: 16px; padding: 12px 30px; }
.scan-btn:hover { background: #218838; transform: translateY(-1px); }
.browse-btn { background: #6c757d; color: white; padding: 8px 15px; font-size: 12px; }
.browse-btn:hover { background: #545b62; }
.preset-btn { background: #17a2b8; color: white; margin: 5px; padding: 8px 15px; font-size: 13px; }
.preset-btn:hover { background: #138496; }
.preset-btn.active { background: #ffc107; color: #212529; }
/* Filter accordion */
.filter-section { margin: 25px 0; }
.filter-accordion { border: 1px solid #dee2e6; border-radius: 5px; margin-bottom: 15px; }
.filter-header {
background: #f8f9fa; padding: 15px; cursor: pointer; border-bottom: 1px solid #dee2e6;
display: flex; justify-content: space-between; align-items: center; font-weight: 600;
}
.filter-header:hover { background: #e9ecef; }
.filter-header.active { background: #e7f3ff; color: #0d6efd; }
.filter-content { padding: 15px; display: none; background: #fff; }
.filter-content.active { display: block; }
.filter-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.filter-item { display: flex; align-items: center; padding: 5px; }
.filter-item input[type=checkbox] { margin-right: 8px; }
.filter-item label { margin: 0; font-weight: normal; cursor: pointer; }
/* Quick presets */
.preset-section { margin: 20px 0; padding: 15px; background: #f8f9fa; border-radius: 5px; }
.preset-section h3 { margin-top: 0; color: #495057; }
/* Custom keywords */
.custom-section { margin: 20px 0; }
.custom-section textarea { height: 80px; font-family: monospace; }
.regex-option { margin-top: 10px; }
/* Folder browser */
.folder-browser {
background: #f8f9fa; border: 1px solid #dee2e6; border-radius: 5px;
padding: 15px; margin-top: 10px; max-height: 250px; overflow-y: auto; display: none;
}
.folder-item { cursor: pointer; padding: 8px; border-radius: 3px; margin: 2px 0; }
.folder-item:hover { background: #e9ecef; }
.folder-item.selected { background: #0d6efd; color: white; }
.folder-up { color: #6c757d; font-weight: bold; }
.folder-dir { color: #0d6efd; }
.folder-path { background: #dee2e6; padding: 8px; border-radius: 3px; margin-bottom: 10px; font-weight: bold; }
/* Log display */
textarea.log-display {
width: 100%; height: 400px; background: #1e1e1e; color: #00ff00;
padding: 15px; border: none; font-family: 'Consolas', 'Monaco', monospace;
border-radius: 5px; resize: vertical; font-size: 13px; line-height: 1.4;
}
/* Settings row */
.settings-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; margin: 20px 0; }
.settings-item { display: flex; flex-direction: column; }
/* Responsive */
@media (max-width: 768px) {
.settings-row { grid-template-columns: 1fr; }
.filter-grid { grid-template-columns: 1fr; }
.folder-input-group { flex-direction: column; align-items: stretch; }
}
</style>
</head>
<body>
<div class="container">
<h1>🦅 LogHawk</h1>
<p style="text-align: center; color: #6c757d; margin-top: -20px; margin-bottom: 30px; font-size: 16px;">Advanced Multi-Technology Log Analysis Platform</p>
<form method="post" id="logForm">
<!-- Folder Selection -->
<div class="folder-section">
<label>Backend Log Folder:</label>
<div class="folder-input-group">
<input type="text" name="backend" id="backend" value="./custom_logs" required>
<button type="button" class="browse-btn" onclick="toggleBrowser('backend')">Browse</button>
</div>
<div id="backend-browser" class="folder-browser"></div>
</div>
<div class="folder-section">
<label>Frontend Log Folder:</label>
<div class="folder-input-group">
<input type="text" name="frontend" id="frontend" value="./logs" required>
<button type="button" class="browse-btn" onclick="toggleBrowser('frontend')">Browse</button>
</div>
<div id="frontend-browser" class="folder-browser"></div>
</div>
<!-- Quick Presets -->
<div class="preset-section">
<h3>🚀 Quick Presets</h3>
<button type="button" class="preset-btn" onclick="applyPreset('debug_user_clicks')">Debug User Clicks</button>
<button type="button" class="preset-btn" onclick="applyPreset('react_debugging')">React Debugging</button>
<button type="button" class="preset-btn" onclick="applyPreset('api_testing')">API Testing</button>
<button type="button" class="preset-btn" onclick="applyPreset('full_stack_web')">Full Stack Web</button>
<button type="button" class="preset-btn" onclick="applyPreset('infrastructure_monitoring')">Infrastructure</button>
<button type="button" class="preset-btn" onclick="clearAllFilters()">Clear All</button>
<input type="hidden" name="preset" id="preset" value="">
<input type="hidden" name="selected_categories" id="selected_categories" value="">
</div>
<!-- Filter Categories -->
<div class="filter-section">
<h3>📂 Filter Categories</h3>
<div class="filter-accordion">
<div class="filter-header" onclick="toggleAccordion('core_levels')">
<span>🔴 Core Log Levels</span><span>▼</span>
</div>
<div id="core_levels-content" class="filter-content">
<div class="filter-grid" id="core_levels-grid"></div>
</div>
</div>
<div class="filter-accordion">
<div class="filter-header" onclick="toggleAccordion('user_interactions')">
<span>👆 User Interactions & Events</span><span>▼</span>
</div>
<div id="user_interactions-content" class="filter-content">
<div class="filter-grid" id="user_interactions-grid"></div>
</div>
</div>
<div class="filter-accordion">
<div class="filter-header" onclick="toggleAccordion('frontend_react')">
<span>⚛️ Frontend - React/JS/TS</span><span>▼</span>
</div>
<div id="frontend_react-content" class="filter-content">
<div class="filter-grid" id="frontend_react-grid"></div>
</div>
</div>
<div class="filter-accordion">
<div class="filter-header" onclick="toggleAccordion('backend_python')">
<span>🐍 Backend - Python</span><span>▼</span>
</div>
<div id="backend_python-content" class="filter-content">
<div class="filter-grid" id="backend_python-grid"></div>
</div>
</div>
<div class="filter-accordion">
<div class="filter-header" onclick="toggleAccordion('backend_java')">
<span>☕ Backend - Java/Spring</span><span>▼</span>
</div>
<div id="backend_java-content" class="filter-content">
<div class="filter-grid" id="backend_java-grid"></div>
</div>
</div>
<div class="filter-accordion">
<div class="filter-header" onclick="toggleAccordion('backend_nodejs')">
<span>🟢 Backend - Node.js</span><span>▼</span>
</div>
<div id="backend_nodejs-content" class="filter-content">
<div class="filter-grid" id="backend_nodejs-grid"></div>
</div>
</div>
<div class="filter-accordion">
<div class="filter-header" onclick="toggleAccordion('backend_other')">
<span>⚙️ Backend - Other Languages</span><span>▼</span>
</div>
<div id="backend_other-content" class="filter-content">
<div class="filter-grid" id="backend_other-grid"></div>
</div>
</div>
<div class="filter-accordion">
<div class="filter-header" onclick="toggleAccordion('infrastructure')">
<span>🏗️ Infrastructure & DevOps</span><span>▼</span>
</div>
<div id="infrastructure-content" class="filter-content">
<div class="filter-grid" id="infrastructure-grid"></div>
</div>
</div>
</div>
<!-- Custom Keywords -->
<div class="custom-section">
<label>🎯 Custom Keywords (comma-separated):</label>
<textarea name="custom_keywords" id="custom_keywords" placeholder="Enter custom keywords or patterns, separated by commas..."></textarea>
<div class="regex-option">
<input type="checkbox" name="use_regex" id="use_regex" value="1">
<label for="use_regex">Enable Regex Pattern Matching</label>
</div>
</div>
<!-- Settings -->
<div class="settings-row">
<div class="settings-item">
<label>Max Files per Folder:</label>
<input type="number" name="max_files" value="3" min="1" max="20">
</div>
<div class="settings-item">
<label>Max Lines (0 = unlimited):</label>
<input type="number" name="max_lines" value="500" min="0" max="50000">
</div>
<div class="settings-item">
<label> </label>
<button type="submit" class="scan-btn">🔍 Analyze Logs</button>
</div>
</div>
</form>
<h2>🖥️ Backend Logs</h2>
<textarea readonly class="log-display">[Folder not found: ./custom_logs]</textarea>
<h2>🌐 Frontend Logs</h2>
<textarea readonly class="log-display">
[Matched 0 entries using 13 filter keywords]</textarea>
</div>
<script>
// Filter categories data
const FILTER_CATEGORIES = {"core_levels": {"name": "Core Log Levels", "keywords": ["FATAL", "ERROR", "CRITICAL", "WARN", "WARNING", "INFO", "DEBUG", "TRACE", "EMERGENCY", "ALERT", "NOTICE"]}, "user_interactions": {"name": "User Interactions & Events", "keywords": ["click", "mousedown", "mouseup", "dblclick", "contextmenu", "button", "submit", "form", "input", "change", "focus", "blur", "keydown", "keyup", "keypress", "scroll", "resize", "load", "unload", "popstate", "hashchange", "beforeunload", "pagehide", "pageshow", "navigation", "router", "route", "navigate", "redirect", "history.push", "location.href", "window.location", "form submission", "validation", "input change", "field focus", "required field", "invalid", "valid", "pattern mismatch", "autocomplete", "dropdown", "select", "checkbox", "radio", "addEventListener", "removeEventListener", "dispatchEvent", "monitorEvents", "getEventListeners", "mutation observer", "intersection observer", "resize observer", "breadcrumb", "user journey", "session", "page view", "rage click", "dead click", "bounce", "engagement", "performance", "loading", "interactive", "complete"]}, "frontend_react": {"name": "Frontend - React/JS/TS", "keywords": ["componentDidCatch", "Error Boundary", "useEffect", "useState", "useCallback", "useMemo", "Hook", "render", "componentDidMount", "componentWillUnmount", "setState", "props", "state", "TypeError", "ReferenceError", "SyntaxError", "Promise", "async", "await", "catch", "throw", "undefined", "null", "NaN", "Infinity", "NetworkError", "CORS", "404", "500", "timeout", "fetch failed", "XMLHttpRequest", "AbortError", "userEvent", "fireEvent", "screen", "getByRole", "waitFor", "jest", "cypress", "playwright"]}, "backend_python": {"name": "Backend - Python", "keywords": ["Traceback", "Exception", "ImportError", "AttributeError", "KeyError", "ValueError", "TypeError", "IndexError", "NameError", "FileNotFoundError", "PermissionError", "ConnectionError", "TimeoutError", "django", "flask", "fastapi", "sqlalchemy", "pandas", "numpy"]}, "backend_java": {"name": "Backend - Java/Spring", "keywords": ["NullPointerException", "SQLException", "RuntimeException", "ClassNotFoundException", "IOException", "Bean", "Autowired", "Component", "Service", "Repository", "Controller", "SpringBoot", "Hibernate"]}, "backend_nodejs": {"name": "Backend - Node.js", "keywords": ["ECONNREFUSED", "ENOTFOUND", "EADDRINUSE", "EACCES", "UnhandledPromiseRejection", "process.exit", "express", "koa", "nest", "mongodb", "mysql", "redis", "npm", "yarn"]}, "backend_other": {"name": "Backend - Other Languages", "keywords": ["ArgumentException", "InvalidOperationException", "HttpRequestException", "NullReferenceException", "ParseError", "FatalError", "Notice", "Artisan", "Eloquent", "Blade", "panic", "defer", "goroutine", "channel closed", "nil pointer"]}, "infrastructure": {"name": "Infrastructure & DevOps", "keywords": ["slow query", "connection timeout", "deadlock", "constraint violation", "duplicate key", "index", "transaction", "rollback", "commit", "container", "image", "volume", "network", "exit code", "pod", "service", "deployment", "crash", "OOMKilled", "ImagePullBackOff", "CrashLoopBackOff", "MISCONF", "connection refused", "memory usage", "cache miss", "cache hit", "load balancer", "proxy", "ssl", "certificate", "dns", "firewall"]}};
const FILTER_PRESETS = {"debug_user_clicks": {"name": "Debug User Clicks", "categories": ["user_interactions"], "custom_keywords": ["click", "button", "form", "submit"]}, "react_debugging": {"name": "React Debugging", "categories": ["core_levels", "frontend_react"], "custom_keywords": ["Hook", "render", "state"]}, "api_testing": {"name": "API Testing", "categories": ["core_levels", "backend_python", "backend_nodejs"], "custom_keywords": ["fetch", "axios", "request", "response"]}, "full_stack_web": {"name": "Full Stack Web App", "categories": ["core_levels", "frontend_react", "backend_python", "user_interactions"], "custom_keywords": []}, "infrastructure_monitoring": {"name": "Infrastructure Monitoring", "categories": ["core_levels", "infrastructure"], "custom_keywords": ["memory", "cpu", "disk", "network"]}};
let currentBrowser = null;
let currentPath = {};
let currentPreset = '';
// Initialize filter categories on page load
document.addEventListener('DOMContentLoaded', function() {
initializeFilterCategories();
});
function initializeFilterCategories() {
Object.keys(FILTER_CATEGORIES).forEach(categoryId => {
const category = FILTER_CATEGORIES[categoryId];
const grid = document.getElementById(categoryId + '-grid');
if (grid) {
grid.innerHTML = '';
category.keywords.forEach(keyword => {
const item = document.createElement('div');
item.className = 'filter-item';
item.innerHTML = `
<input type="checkbox" id="filter_${categoryId}_${keyword.replace(/[^a-zA-Z0-9]/g, '_')}"
name="filter_keywords" value="${keyword}" onchange="updateSelectedCategories()">
<label for="filter_${categoryId}_${keyword.replace(/[^a-zA-Z0-9]/g, '_')}">${keyword}</label>
`;
grid.appendChild(item);
});
}
});
}
function toggleAccordion(categoryId) {
const content = document.getElementById(categoryId + '-content');
const header = content.previousElementSibling;
const arrow = header.querySelector('span:last-child');
if (content.classList.contains('active')) {
content.classList.remove('active');
header.classList.remove('active');
arrow.textContent = '▼';
} else {
content.classList.add('active');
header.classList.add('active');
arrow.textContent = '▲';
}
}
function applyPreset(presetId) {
// Clear all current selections
clearAllFilters();
if (presetId && FILTER_PRESETS[presetId]) {
const preset = FILTER_PRESETS[presetId];
currentPreset = presetId;
document.getElementById('preset').value = presetId;
// Mark preset button as active
document.querySelectorAll('.preset-btn').forEach(btn => btn.classList.remove('active'));
event.target.classList.add('active');
// Select categories
preset.categories.forEach(categoryId => {
if (FILTER_CATEGORIES[categoryId]) {
// Open accordion
const content = document.getElementById(categoryId + '-content');
const header = content.previousElementSibling;
const arrow = header.querySelector('span:last-child');
content.classList.add('active');
header.classList.add('active');
arrow.textContent = '▲';
// Check all checkboxes in category
const checkboxes = content.querySelectorAll('input[type=checkbox]');
checkboxes.forEach(cb => cb.checked = true);
}
});
// Add custom keywords
if (preset.custom_keywords.length > 0) {
document.getElementById('custom_keywords').value = preset.custom_keywords.join(', ');
}
updateSelectedCategories();
}
}
function clearAllFilters() {
document.querySelectorAll('input[type=checkbox][name=filter_keywords]').forEach(cb => cb.checked = false);
document.querySelectorAll('.preset-btn').forEach(btn => btn.classList.remove('active'));
document.getElementById('custom_keywords').value = '';
document.getElementById('use_regex').checked = false;
document.getElementById('preset').value = '';
currentPreset = '';
updateSelectedCategories();
}
function updateSelectedCategories() {
const selectedCategories = [];
Object.keys(FILTER_CATEGORIES).forEach(categoryId => {
const checkboxes = document.querySelectorAll(`#${categoryId}-grid input[type=checkbox]:checked`);
if (checkboxes.length > 0) {
selectedCategories.push(categoryId);
}
});
document.getElementById('selected_categories').value = selectedCategories.join(',');
}
async function toggleBrowser(inputId) {
const browser = document.getElementById(inputId + '-browser');
const input = document.getElementById(inputId);
if (browser.style.display === 'block') {
browser.style.display = 'none';
currentBrowser = null;
} else {
// Hide other browsers
document.querySelectorAll('.folder-browser').forEach(b => b.style.display = 'none');
browser.style.display = 'block';
currentBrowser = inputId;
// Initialize with current input value or current directory
const startPath = input.value || '.';
currentPath[inputId] = startPath;
await loadFolder(inputId, startPath);
}
}
async function loadFolder(browserId, path) {
try {
const response = await fetch('/api/browse?path=' + encodeURIComponent(path));
const data = await response.json();
const browser = document.getElementById(browserId + '-browser');
browser.innerHTML = '';
// Show current path
const pathDiv = document.createElement('div');
pathDiv.className = 'folder-path';
pathDiv.textContent = 'Path: ' + data.current_path;
browser.appendChild(pathDiv);
// Add parent directory option (except for root)
if (data.parent_path) {
const parentItem = document.createElement('div');
parentItem.className = 'folder-item folder-up';
parentItem.textContent = '📁 .. (parent directory)';
parentItem.onclick = () => loadFolder(browserId, data.parent_path);
browser.appendChild(parentItem);
}
// Add directories
data.directories.forEach(dir => {
const item = document.createElement('div');
item.className = 'folder-item folder-dir';
item.textContent = '📁 ' + dir;
item.onclick = () => {
const newPath = data.current_path + '/' + dir;
loadFolder(browserId, newPath);
};
browser.appendChild(item);
});
// Add "Select this folder" button
const selectBtn = document.createElement('button');
selectBtn.type = 'button';
selectBtn.className = 'scan-btn';
selectBtn.textContent = 'Select This Folder';
selectBtn.style.marginTop = '10px';
selectBtn.onclick = () => {
document.getElementById(browserId).value = data.current_path;
browser.style.display = 'none';
};
browser.appendChild(selectBtn);
currentPath[browserId] = data.current_path;
} catch (error) {
console.error('Error loading folder:', error);
const browser = document.getElementById(browserId + '-browser');
browser.innerHTML = '<div style="color: red;">Error loading folder: ' + error.message + '</div>';
}
}
</script>
</body>
</html>