peerpigeon 0.1.1 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. package/README.md +141 -1365
  2. package/cli.js +1382 -0
  3. package/dist/peerpigeon-browser.js +12450 -0
  4. package/dist/peerpigeon-browser.js.map +7 -0
  5. package/docs/API_DOCUMENTATION.md +1976 -0
  6. package/docs/BOOTSTRAP_HUBS.md +319 -0
  7. package/docs/CLI_README.md +371 -0
  8. package/docs/CUSTOM_HUB_NAMESPACES.md +182 -0
  9. package/docs/CUSTOM_NAMESPACE_IMPLEMENTATION.md +187 -0
  10. package/docs/DOCUMENTATION_REORGANIZATION.md +172 -0
  11. package/docs/HUB_QUICK_REF.md +108 -0
  12. package/docs/HUB_SCRIPTS.md +341 -0
  13. package/docs/HUB_SYSTEM.md +599 -0
  14. package/docs/MIGRATION_COMPLETE.md +93 -0
  15. package/docs/NETWORK_NAMESPACES.md +212 -0
  16. package/docs/PIGEONRTC_MIGRATION.md +280 -0
  17. package/docs/README.md +108 -0
  18. package/docs/SELECTIVE_STREAMING_GUIDE.md +427 -0
  19. package/docs/TEST_CLEANUP_COMPLETE.md +80 -0
  20. package/examples/bootstrap-hub-example.js +292 -0
  21. package/examples/browser/README.md +278 -0
  22. package/examples/browser/app.js +2426 -49
  23. package/examples/browser/index.html +481 -630
  24. package/examples/browser/minimal/README.md +55 -0
  25. package/examples/browser/minimal/index.html +75 -0
  26. package/examples/browser/minimal/minimal.js +234 -0
  27. package/examples/browser/styles.css +687 -1425
  28. package/examples/browser/test-bundle.html +35 -0
  29. package/examples/browser-2/index.html +30 -0
  30. package/examples/browser-2/package.json +21 -0
  31. package/examples/browser-2/src/App-simple.vue +21 -0
  32. package/examples/browser-2/src/App.vue +420 -0
  33. package/examples/browser-2/src/components/CryptoView.vue +1661 -0
  34. package/examples/browser-2/src/components/DHTView.vue +1281 -0
  35. package/examples/browser-2/src/components/DebugView.vue +1773 -0
  36. package/examples/browser-2/src/components/MediaView.vue +1048 -0
  37. package/examples/browser-2/src/components/MessagingView.vue +775 -0
  38. package/examples/browser-2/src/components/NetworkView.vue +930 -0
  39. package/examples/browser-2/src/components/StorageView.vue +1376 -0
  40. package/examples/browser-2/src/main.js +5 -0
  41. package/examples/browser-2/src/stores/peerpigeon.js +895 -0
  42. package/examples/browser-2/vite.config.js +6 -0
  43. package/examples/hub-example.js +189 -0
  44. package/examples/multi-hub-test.js +186 -0
  45. package/examples/node/README.md +2 -2
  46. package/examples/programmatic-namespace-example.js +108 -0
  47. package/examples/selective-streaming-demo.html +698 -0
  48. package/examples/standard-events-demo.js +126 -0
  49. package/index.js +7 -1
  50. package/package.json +34 -16
  51. package/server/index.js +1058 -98
  52. package/server/start.js +52 -0
  53. package/src/ConnectionManager.js +239 -225
  54. package/src/CryptoManager.js +147 -18
  55. package/src/DebugLogger.js +0 -7
  56. package/src/DistributedStorageManager.js +224 -205
  57. package/src/EnvironmentDetector.js +88 -4
  58. package/src/EventEmitter.js +79 -1
  59. package/src/EvictionManager.js +10 -9
  60. package/src/GossipManager.js +163 -11
  61. package/src/MediaManager.js +12 -2
  62. package/src/PeerConnection.js +343 -311
  63. package/src/PeerPigeonMesh.js +576 -135
  64. package/src/PigeonRTC-browser.js +247 -0
  65. package/src/SignalingClient.js +14 -243
  66. package/src/SignalingHandler.js +31 -10
  67. package/src/StorageManager.js +0 -39
  68. package/src/WebDHT-Simple.js +389 -0
  69. package/src/WebDHT.js +363 -1165
  70. package/src/browser-entry.js +58 -0
  71. package/examples/browser/assets/images/favicon.png +0 -0
  72. package/examples/browser/assets/images/pigeon.png +0 -0
  73. package/examples/browser/crypto-test.html +0 -427
  74. package/examples/browser/ui-old.js +0 -1926
  75. package/examples/browser/ui.js +0 -3391
  76. package/websocket-server/README.md +0 -247
  77. package/websocket-server/server.js +0 -391
@@ -0,0 +1,1773 @@
1
+ <template>
2
+ <div class="debug-view">
3
+ <div class="section-header">
4
+ <h2>🔍 Debug & Monitoring</h2>
5
+ <p>System diagnostics, logging, performance monitoring, and debugging tools</p>
6
+ </div>
7
+
8
+ <!-- Debug Controls -->
9
+ <div class="debug-controls">
10
+ <h3>🎛️ Debug Controls</h3>
11
+
12
+ <div class="control-tabs">
13
+ <button
14
+ @click="activeTab = 'logging'"
15
+ :class="['tab-btn', { active: activeTab === 'logging' }]"
16
+ >
17
+ LOGGING
18
+ </button>
19
+ <button
20
+ @click="activeTab = 'monitoring'"
21
+ :class="['tab-btn', { active: activeTab === 'monitoring' }]"
22
+ >
23
+ MONITORING
24
+ </button>
25
+ <button
26
+ @click="activeTab = 'performance'"
27
+ :class="['tab-btn', { active: activeTab === 'performance' }]"
28
+ >
29
+ PERFORMANCE
30
+ </button>
31
+ <button
32
+ @click="activeTab = 'diagnostics'"
33
+ :class="['tab-btn', { active: activeTab === 'diagnostics' }]"
34
+ >
35
+ DIAGNOSTICS
36
+ </button>
37
+ </div>
38
+
39
+ <!-- LOGGING Controls -->
40
+ <div v-if="activeTab === 'logging'" class="control-panel">
41
+ <h4>📝 Logging Configuration</h4>
42
+ <p class="panel-description">
43
+ Configure debug logging levels and modules. Control what information is captured and displayed.
44
+ </p>
45
+
46
+ <div class="logging-config">
47
+ <div class="form-group">
48
+ <label>Global Log Level:</label>
49
+ <select v-model="logConfig.globalLevel" @change="updateLogLevel" class="form-select">
50
+ <option value="error">Error</option>
51
+ <option value="warning">Warning</option>
52
+ <option value="info">Info</option>
53
+ <option value="debug">Debug</option>
54
+ <option value="verbose">Verbose</option>
55
+ </select>
56
+ </div>
57
+
58
+ <div class="module-controls">
59
+ <h5>Module-Specific Logging:</h5>
60
+ <div class="module-grid">
61
+ <div v-for="module in debugModules" :key="module.name" class="module-item">
62
+ <div class="module-header">
63
+ <span class="module-name">{{ module.name }}</span>
64
+ <span class="module-status" :class="{ enabled: module.enabled }">
65
+ {{ module.enabled ? 'ON' : 'OFF' }}
66
+ </span>
67
+ </div>
68
+
69
+ <div class="module-controls">
70
+ <label class="toggle-label">
71
+ <input
72
+ type="checkbox"
73
+ v-model="module.enabled"
74
+ @change="toggleModule(module.name, module.enabled)"
75
+ >
76
+ Enable
77
+ </label>
78
+
79
+ <select
80
+ v-model="module.level"
81
+ @change="setModuleLevel(module.name, module.level)"
82
+ :disabled="!module.enabled"
83
+ class="form-select-sm"
84
+ >
85
+ <option value="error">Error</option>
86
+ <option value="warning">Warning</option>
87
+ <option value="info">Info</option>
88
+ <option value="debug">Debug</option>
89
+ <option value="verbose">Verbose</option>
90
+ </select>
91
+ </div>
92
+ </div>
93
+ </div>
94
+ </div>
95
+
96
+ <div class="logging-actions">
97
+ <button @click="enableAllModules" class="btn btn-primary">
98
+ <span class="btn-icon">✅</span>
99
+ Enable All
100
+ </button>
101
+ <button @click="disableAllModules" class="btn btn-secondary">
102
+ <span class="btn-icon">❌</span>
103
+ Disable All
104
+ </button>
105
+ <button @click="resetLoggingConfig" class="btn btn-secondary">
106
+ <span class="btn-icon">🔄</span>
107
+ Reset Config
108
+ </button>
109
+ </div>
110
+ </div>
111
+ </div>
112
+
113
+ <!-- MONITORING Controls -->
114
+ <div v-if="activeTab === 'monitoring'" class="control-panel">
115
+ <h4>📊 System Monitoring</h4>
116
+ <p class="panel-description">
117
+ Monitor system performance, network activity, and resource usage in real-time.
118
+ </p>
119
+
120
+ <div class="monitoring-config">
121
+ <div class="form-group">
122
+ <label>Monitoring Interval:</label>
123
+ <select v-model="monitoringConfig.interval" @change="updateMonitoringInterval" class="form-select">
124
+ <option value="1000">1 second</option>
125
+ <option value="5000">5 seconds</option>
126
+ <option value="10000">10 seconds</option>
127
+ <option value="30000">30 seconds</option>
128
+ </select>
129
+ </div>
130
+
131
+ <div class="monitoring-toggles">
132
+ <label class="checkbox-label">
133
+ <input
134
+ type="checkbox"
135
+ v-model="monitoringConfig.networkActivity"
136
+ @change="toggleNetworkMonitoring"
137
+ >
138
+ Network Activity Monitoring
139
+ </label>
140
+
141
+ <label class="checkbox-label">
142
+ <input
143
+ type="checkbox"
144
+ v-model="monitoringConfig.memoryUsage"
145
+ @change="toggleMemoryMonitoring"
146
+ >
147
+ Memory Usage Tracking
148
+ </label>
149
+
150
+ <label class="checkbox-label">
151
+ <input
152
+ type="checkbox"
153
+ v-model="monitoringConfig.peerMetrics"
154
+ @change="togglePeerMetrics"
155
+ >
156
+ Peer Connection Metrics
157
+ </label>
158
+
159
+ <label class="checkbox-label">
160
+ <input
161
+ type="checkbox"
162
+ v-model="monitoringConfig.eventTracking"
163
+ @change="toggleEventTracking"
164
+ >
165
+ Event Tracking
166
+ </label>
167
+ </div>
168
+
169
+ <div class="monitoring-actions">
170
+ <button
171
+ @click="startMonitoring"
172
+ :disabled="isMonitoring"
173
+ class="btn btn-success"
174
+ >
175
+ <span class="btn-icon">▶️</span>
176
+ Start Monitoring
177
+ </button>
178
+ <button
179
+ @click="stopMonitoring"
180
+ :disabled="!isMonitoring"
181
+ class="btn btn-danger"
182
+ >
183
+ <span class="btn-icon">⏹️</span>
184
+ Stop Monitoring
185
+ </button>
186
+ <button @click="clearMonitoringData" class="btn btn-secondary">
187
+ <span class="btn-icon">🗑️</span>
188
+ Clear Data
189
+ </button>
190
+ </div>
191
+ </div>
192
+ </div>
193
+
194
+ <!-- PERFORMANCE Controls -->
195
+ <div v-if="activeTab === 'performance'" class="control-panel">
196
+ <h4>⚡ Performance Analysis</h4>
197
+ <p class="panel-description">
198
+ Analyze performance bottlenecks, measure operation timing, and optimize system performance.
199
+ </p>
200
+
201
+ <div class="performance-config">
202
+ <div class="profiling-controls">
203
+ <h5>Performance Profiling:</h5>
204
+ <div class="profiling-actions">
205
+ <button
206
+ @click="startProfiling"
207
+ :disabled="isProfiling"
208
+ class="btn btn-primary"
209
+ >
210
+ <span class="btn-icon">🎯</span>
211
+ Start Profiling
212
+ </button>
213
+ <button
214
+ @click="stopProfiling"
215
+ :disabled="!isProfiling"
216
+ class="btn btn-danger"
217
+ >
218
+ <span class="btn-icon">⏹️</span>
219
+ Stop Profiling
220
+ </button>
221
+ <button @click="generatePerformanceReport" class="btn btn-info">
222
+ <span class="btn-icon">📊</span>
223
+ Generate Report
224
+ </button>
225
+ </div>
226
+ </div>
227
+
228
+ <div class="benchmark-controls">
229
+ <h5>System Benchmarks:</h5>
230
+ <div class="benchmark-actions">
231
+ <button @click="runNetworkBenchmark" class="btn btn-secondary">
232
+ <span class="btn-icon">🌐</span>
233
+ Network Benchmark
234
+ </button>
235
+ <button @click="runCryptoBenchmark" class="btn btn-secondary">
236
+ <span class="btn-icon">🔒</span>
237
+ Crypto Benchmark
238
+ </button>
239
+ <button @click="runStorageBenchmark" class="btn btn-secondary">
240
+ <span class="btn-icon">💾</span>
241
+ Storage Benchmark
242
+ </button>
243
+ <button @click="runFullBenchmarkSuite" class="btn btn-primary">
244
+ <span class="btn-icon">🚀</span>
245
+ Full Benchmark Suite
246
+ </button>
247
+ </div>
248
+ </div>
249
+ </div>
250
+ </div>
251
+
252
+ <!-- DIAGNOSTICS Controls -->
253
+ <div v-if="activeTab === 'diagnostics'" class="control-panel">
254
+ <h4>🔧 System Diagnostics</h4>
255
+ <p class="panel-description">
256
+ Run diagnostic tests, validate system health, and troubleshoot issues.
257
+ </p>
258
+
259
+ <div class="diagnostics-config">
260
+ <div class="health-check">
261
+ <h5>System Health Check:</h5>
262
+ <div class="health-actions">
263
+ <button @click="runHealthCheck" class="btn btn-primary">
264
+ <span class="btn-icon">❤️</span>
265
+ Run Health Check
266
+ </button>
267
+ <button @click="validateConfiguration" class="btn btn-secondary">
268
+ <span class="btn-icon">✅</span>
269
+ Validate Config
270
+ </button>
271
+ <button @click="testConnectivity" class="btn btn-secondary">
272
+ <span class="btn-icon">🌐</span>
273
+ Test Connectivity
274
+ </button>
275
+ </div>
276
+ </div>
277
+
278
+ <div class="troubleshooting">
279
+ <h5>Troubleshooting Tools:</h5>
280
+ <div class="trouble-actions">
281
+ <button @click="generateDiagnosticReport" class="btn btn-info">
282
+ <span class="btn-icon">📋</span>
283
+ Diagnostic Report
284
+ </button>
285
+ <button @click="exportDebugLogs" class="btn btn-secondary">
286
+ <span class="btn-icon">📤</span>
287
+ Export Debug Logs
288
+ </button>
289
+ <button @click="resetSystem" class="btn btn-warning">
290
+ <span class="btn-icon">🔄</span>
291
+ Reset System
292
+ </button>
293
+ </div>
294
+ </div>
295
+ </div>
296
+ </div>
297
+ </div>
298
+
299
+ <!-- Debug Log Display -->
300
+ <div class="debug-logs">
301
+ <div class="section-title">
302
+ <h3>📜 Debug Logs ({{ debugLogs.length }})</h3>
303
+ <div class="log-controls">
304
+ <div class="log-filters">
305
+ <select v-model="logFilter" class="form-select-sm">
306
+ <option value="all">All Levels</option>
307
+ <option value="error">Errors Only</option>
308
+ <option value="warning">Warnings+</option>
309
+ <option value="info">Info+</option>
310
+ <option value="debug">Debug+</option>
311
+ <option value="verbose">Verbose</option>
312
+ </select>
313
+
314
+ <input
315
+ v-model="logSearch"
316
+ placeholder="Search logs..."
317
+ class="form-input-sm"
318
+ >
319
+ </div>
320
+
321
+ <div class="log-actions">
322
+ <button @click="toggleAutoScroll" :class="['btn', 'btn-sm', autoScroll ? 'btn-primary' : 'btn-secondary']">
323
+ <span class="btn-icon">{{ autoScroll ? '📌' : '📌' }}</span>
324
+ Auto-scroll
325
+ </button>
326
+ <button @click="clearLogs" class="btn btn-sm btn-danger">
327
+ <span class="btn-icon">🗑️</span>
328
+ Clear
329
+ </button>
330
+ <button @click="exportLogs" class="btn btn-sm btn-secondary">
331
+ <span class="btn-icon">📤</span>
332
+ Export
333
+ </button>
334
+ </div>
335
+ </div>
336
+ </div>
337
+
338
+ <div class="log-display" ref="logDisplay">
339
+ <div v-if="filteredLogs.length === 0" class="empty-logs">
340
+ <div class="empty-icon">📭</div>
341
+ <p>No logs to display</p>
342
+ <p class="empty-meta">
343
+ {{ logFilter === 'all' ? 'No debug logs yet' : `No logs matching filter: ${logFilter}` }}
344
+ </p>
345
+ </div>
346
+
347
+ <div v-else class="log-entries">
348
+ <div
349
+ v-for="log in filteredLogs"
350
+ :key="log.id"
351
+ :class="['log-entry', `log-${log.level}`]"
352
+ >
353
+ <div class="log-header">
354
+ <span class="log-timestamp">{{ formatLogTime(log.timestamp) }}</span>
355
+ <span class="log-level">{{ log.level.toUpperCase() }}</span>
356
+ <span v-if="log.module" class="log-module">{{ log.module }}</span>
357
+ </div>
358
+
359
+ <div class="log-message">{{ log.message }}</div>
360
+
361
+ <div v-if="log.data" class="log-data">
362
+ <details>
363
+ <summary>Additional Data</summary>
364
+ <pre>{{ JSON.stringify(log.data, null, 2) }}</pre>
365
+ </details>
366
+ </div>
367
+ </div>
368
+ </div>
369
+ </div>
370
+ </div>
371
+
372
+ <!-- System Status Dashboard -->
373
+ <div class="system-dashboard">
374
+ <h3>📊 System Status Dashboard</h3>
375
+
376
+ <div class="dashboard-grid">
377
+ <div class="status-card">
378
+ <div class="status-icon">🖥️</div>
379
+ <div class="status-content">
380
+ <h4>System Status</h4>
381
+ <div class="status-value" :class="systemStatus.overall">{{ systemStatus.overall }}</div>
382
+ <div class="status-meta">Last checked: {{ formatTime(systemStatus.lastCheck) }}</div>
383
+ </div>
384
+ </div>
385
+
386
+ <div class="status-card">
387
+ <div class="status-icon">🌐</div>
388
+ <div class="status-content">
389
+ <h4>Network Health</h4>
390
+ <div class="status-value" :class="networkHealth.status">{{ networkHealth.status }}</div>
391
+ <div class="status-meta">{{ networkHealth.connectedPeers }} peers connected</div>
392
+ </div>
393
+ </div>
394
+
395
+ <div class="status-card">
396
+ <div class="status-icon">💾</div>
397
+ <div class="status-content">
398
+ <h4>Memory Usage</h4>
399
+ <div class="status-value">{{ memoryUsage.used }}MB</div>
400
+ <div class="status-meta">{{ memoryUsage.percentage }}% of {{ memoryUsage.total }}MB</div>
401
+ </div>
402
+ </div>
403
+
404
+ <div class="status-card">
405
+ <div class="status-icon">⚡</div>
406
+ <div class="status-content">
407
+ <h4>Performance</h4>
408
+ <div class="status-value" :class="performance.status">{{ performance.averageLatency }}ms</div>
409
+ <div class="status-meta">Average latency</div>
410
+ </div>
411
+ </div>
412
+ </div>
413
+
414
+ <div v-if="monitoringData.length > 0" class="monitoring-charts">
415
+ <h4>Performance Charts</h4>
416
+ <div class="chart-placeholder">
417
+ <div class="chart-info">
418
+ <p>📈 Real-time performance data visualization would be displayed here</p>
419
+ <p>Data points: {{ monitoringData.length }}</p>
420
+ <p>Monitoring since: {{ formatTime(monitoringStartTime) }}</p>
421
+ </div>
422
+ </div>
423
+ </div>
424
+ </div>
425
+
426
+ <!-- Quick Debug Actions -->
427
+ <div class="quick-debug-actions">
428
+ <h3>⚡ Quick Debug Actions</h3>
429
+ <div class="action-buttons">
430
+ <button @click="logTestMessages" class="btn btn-secondary">
431
+ <span class="btn-icon">📝</span>
432
+ Generate Test Logs
433
+ </button>
434
+
435
+ <button @click="simulateError" class="btn btn-warning">
436
+ <span class="btn-icon">⚠️</span>
437
+ Simulate Error
438
+ </button>
439
+
440
+ <button @click="stressTestSystem" class="btn btn-danger">
441
+ <span class="btn-icon">🔥</span>
442
+ Stress Test
443
+ </button>
444
+
445
+ <button @click="generatePerformanceProfile" class="btn btn-info">
446
+ <span class="btn-icon">📊</span>
447
+ Performance Profile
448
+ </button>
449
+
450
+ <button @click="enableVerboseLogging" class="btn btn-primary">
451
+ <span class="btn-icon">🔍</span>
452
+ Enable Verbose Logging
453
+ </button>
454
+
455
+ <button @click="captureSystemSnapshot" class="btn btn-secondary">
456
+ <span class="btn-icon">📸</span>
457
+ System Snapshot
458
+ </button>
459
+ </div>
460
+ </div>
461
+ </div>
462
+ </template>
463
+
464
+ <script setup>
465
+ import { ref, computed, onMounted, onUnmounted, nextTick, watch } from 'vue';
466
+ import { usePeerPigeonStore } from '../stores/peerpigeon.js';
467
+
468
+ const store = usePeerPigeonStore();
469
+
470
+ // Local reactive state
471
+ const activeTab = ref('logging');
472
+ const logDisplay = ref(null);
473
+ const autoScroll = ref(true);
474
+ const logFilter = ref('all');
475
+ const logSearch = ref('');
476
+
477
+ // Monitoring state
478
+ const isMonitoring = ref(false);
479
+ const isProfiling = ref(false);
480
+ const monitoringInterval = ref(null);
481
+ const monitoringStartTime = ref(null);
482
+ const monitoringData = ref([]);
483
+
484
+ // Debug configuration
485
+ const logConfig = ref({
486
+ globalLevel: 'info'
487
+ });
488
+
489
+ const monitoringConfig = ref({
490
+ interval: 5000,
491
+ networkActivity: true,
492
+ memoryUsage: true,
493
+ peerMetrics: true,
494
+ eventTracking: true
495
+ });
496
+
497
+ // Debug modules configuration
498
+ const debugModules = ref([
499
+ { name: 'Network', enabled: true, level: 'info' },
500
+ { name: 'Storage', enabled: true, level: 'info' },
501
+ { name: 'Crypto', enabled: true, level: 'info' },
502
+ { name: 'DHT', enabled: true, level: 'info' },
503
+ { name: 'Messaging', enabled: true, level: 'info' },
504
+ { name: 'Media', enabled: true, level: 'info' },
505
+ { name: 'WebRTC', enabled: false, level: 'debug' },
506
+ { name: 'SignalingClient', enabled: false, level: 'debug' },
507
+ { name: 'PeerConnection', enabled: false, level: 'debug' },
508
+ { name: 'EventEmitter', enabled: false, level: 'verbose' }
509
+ ]);
510
+
511
+ // System status
512
+ const systemStatus = ref({
513
+ overall: 'healthy',
514
+ lastCheck: Date.now()
515
+ });
516
+
517
+ const networkHealth = ref({
518
+ status: 'good',
519
+ connectedPeers: 0
520
+ });
521
+
522
+ const memoryUsage = ref({
523
+ used: 0,
524
+ total: 0,
525
+ percentage: 0
526
+ });
527
+
528
+ const performance = ref({
529
+ status: 'good',
530
+ averageLatency: 0
531
+ });
532
+
533
+ // Computed properties
534
+ const debugLogs = computed(() => store.debugLogs);
535
+
536
+ const filteredLogs = computed(() => {
537
+ let logs = debugLogs.value;
538
+
539
+ // Filter by level
540
+ if (logFilter.value !== 'all') {
541
+ const levelPriority = {
542
+ 'error': 0,
543
+ 'warning': 1,
544
+ 'info': 2,
545
+ 'debug': 3,
546
+ 'verbose': 4
547
+ };
548
+
549
+ const filterPriority = levelPriority[logFilter.value];
550
+ logs = logs.filter(log => levelPriority[log.level] <= filterPriority);
551
+ }
552
+
553
+ // Filter by search
554
+ if (logSearch.value) {
555
+ const search = logSearch.value.toLowerCase();
556
+ logs = logs.filter(log =>
557
+ log.message.toLowerCase().includes(search) ||
558
+ (log.module && log.module.toLowerCase().includes(search))
559
+ );
560
+ }
561
+
562
+ return logs;
563
+ });
564
+
565
+ // Methods
566
+ const updateLogLevel = () => {
567
+ if (store.mesh?.debugLogger) {
568
+ store.mesh.debugLogger.setGlobalLevel(logConfig.value.globalLevel);
569
+ }
570
+ store.addDebugLog(`Global log level set to: ${logConfig.value.globalLevel}`, 'info');
571
+ };
572
+
573
+ const toggleModule = (moduleName, enabled) => {
574
+ if (store.mesh?.debugLogger) {
575
+ if (enabled) {
576
+ store.mesh.debugLogger.enableModule(moduleName);
577
+ } else {
578
+ store.mesh.debugLogger.disableModule(moduleName);
579
+ }
580
+ }
581
+ store.addDebugLog(`Module ${moduleName}: ${enabled ? 'enabled' : 'disabled'}`, 'info');
582
+ };
583
+
584
+ const setModuleLevel = (moduleName, level) => {
585
+ if (store.mesh?.debugLogger) {
586
+ store.mesh.debugLogger.setModuleLevel(moduleName, level);
587
+ }
588
+ store.addDebugLog(`Module ${moduleName} level set to: ${level}`, 'info');
589
+ };
590
+
591
+ const enableAllModules = () => {
592
+ debugModules.value.forEach(module => {
593
+ module.enabled = true;
594
+ toggleModule(module.name, true);
595
+ });
596
+ };
597
+
598
+ const disableAllModules = () => {
599
+ debugModules.value.forEach(module => {
600
+ module.enabled = false;
601
+ toggleModule(module.name, false);
602
+ });
603
+ };
604
+
605
+ const resetLoggingConfig = () => {
606
+ logConfig.value.globalLevel = 'info';
607
+ debugModules.value.forEach(module => {
608
+ module.enabled = ['Network', 'Storage', 'Crypto', 'DHT', 'Messaging', 'Media'].includes(module.name);
609
+ module.level = 'info';
610
+ });
611
+ updateLogLevel();
612
+ store.addDebugLog('Logging configuration reset to defaults', 'info');
613
+ };
614
+
615
+ const updateMonitoringInterval = () => {
616
+ if (isMonitoring.value) {
617
+ stopMonitoring();
618
+ startMonitoring();
619
+ }
620
+ };
621
+
622
+ const toggleNetworkMonitoring = () => {
623
+ store.addDebugLog(`Network monitoring: ${monitoringConfig.value.networkActivity ? 'enabled' : 'disabled'}`, 'info');
624
+ };
625
+
626
+ const toggleMemoryMonitoring = () => {
627
+ store.addDebugLog(`Memory monitoring: ${monitoringConfig.value.memoryUsage ? 'enabled' : 'disabled'}`, 'info');
628
+ };
629
+
630
+ const togglePeerMetrics = () => {
631
+ store.addDebugLog(`Peer metrics: ${monitoringConfig.value.peerMetrics ? 'enabled' : 'disabled'}`, 'info');
632
+ };
633
+
634
+ const toggleEventTracking = () => {
635
+ store.addDebugLog(`Event tracking: ${monitoringConfig.value.eventTracking ? 'enabled' : 'disabled'}`, 'info');
636
+ };
637
+
638
+ const startMonitoring = () => {
639
+ isMonitoring.value = true;
640
+ monitoringStartTime.value = Date.now();
641
+
642
+ monitoringInterval.value = setInterval(() => {
643
+ collectMonitoringData();
644
+ }, monitoringConfig.value.interval);
645
+
646
+ store.addDebugLog('System monitoring started', 'success');
647
+ };
648
+
649
+ const stopMonitoring = () => {
650
+ isMonitoring.value = false;
651
+
652
+ if (monitoringInterval.value) {
653
+ clearInterval(monitoringInterval.value);
654
+ monitoringInterval.value = null;
655
+ }
656
+
657
+ store.addDebugLog('System monitoring stopped', 'info');
658
+ };
659
+
660
+ const clearMonitoringData = () => {
661
+ monitoringData.value = [];
662
+ store.addDebugLog('Monitoring data cleared', 'info');
663
+ };
664
+
665
+ const collectMonitoringData = () => {
666
+ const dataPoint = {
667
+ timestamp: Date.now(),
668
+ memoryUsage: performance.memory ? {
669
+ used: Math.round(performance.memory.usedJSHeapSize / 1024 / 1024),
670
+ total: Math.round(performance.memory.totalJSHeapSize / 1024 / 1024)
671
+ } : { used: 0, total: 0 },
672
+ connectedPeers: store.connectedPeersList.length,
673
+ networkLatency: Math.random() * 100 + 20, // Simulated
674
+ cpuUsage: Math.random() * 50 + 10 // Simulated
675
+ };
676
+
677
+ monitoringData.value.push(dataPoint);
678
+
679
+ // Keep only last 100 data points
680
+ if (monitoringData.value.length > 100) {
681
+ monitoringData.value.shift();
682
+ }
683
+
684
+ // Update dashboard values
685
+ updateSystemStatus(dataPoint);
686
+ };
687
+
688
+ const updateSystemStatus = (dataPoint) => {
689
+ // Update memory usage
690
+ memoryUsage.value = {
691
+ used: dataPoint.memoryUsage.used,
692
+ total: dataPoint.memoryUsage.total,
693
+ percentage: dataPoint.memoryUsage.total > 0 ?
694
+ Math.round((dataPoint.memoryUsage.used / dataPoint.memoryUsage.total) * 100) : 0
695
+ };
696
+
697
+ // Update network health
698
+ networkHealth.value = {
699
+ status: dataPoint.connectedPeers > 0 ? 'good' : 'warning',
700
+ connectedPeers: dataPoint.connectedPeers
701
+ };
702
+
703
+ // Update performance
704
+ performance.value = {
705
+ status: dataPoint.networkLatency < 100 ? 'good' : 'warning',
706
+ averageLatency: Math.round(dataPoint.networkLatency)
707
+ };
708
+
709
+ // Update overall system status
710
+ systemStatus.value = {
711
+ overall: (networkHealth.value.status === 'good' && performance.value.status === 'good') ? 'healthy' : 'warning',
712
+ lastCheck: Date.now()
713
+ };
714
+ };
715
+
716
+ const startProfiling = () => {
717
+ isProfiling.value = true;
718
+ store.addDebugLog('Performance profiling started', 'info');
719
+
720
+ // Enable verbose logging for performance analysis
721
+ debugModules.value.forEach(module => {
722
+ if (['Network', 'WebRTC', 'PeerConnection'].includes(module.name)) {
723
+ module.enabled = true;
724
+ module.level = 'debug';
725
+ toggleModule(module.name, true);
726
+ setModuleLevel(module.name, 'debug');
727
+ }
728
+ });
729
+ };
730
+
731
+ const stopProfiling = () => {
732
+ isProfiling.value = false;
733
+ store.addDebugLog('Performance profiling stopped', 'info');
734
+ };
735
+
736
+ const generatePerformanceReport = () => {
737
+ const report = {
738
+ timestamp: Date.now(),
739
+ monitoringData: monitoringData.value.slice(-20), // Last 20 data points
740
+ systemStatus: systemStatus.value,
741
+ memoryUsage: memoryUsage.value,
742
+ networkHealth: networkHealth.value,
743
+ performance: performance.value,
744
+ logSummary: {
745
+ total: debugLogs.value.length,
746
+ errors: debugLogs.value.filter(log => log.level === 'error').length,
747
+ warnings: debugLogs.value.filter(log => log.level === 'warning').length
748
+ }
749
+ };
750
+
751
+ const reportStr = JSON.stringify(report, null, 2);
752
+ const reportBlob = new Blob([reportStr], { type: 'application/json' });
753
+ const url = URL.createObjectURL(reportBlob);
754
+
755
+ const a = document.createElement('a');
756
+ a.href = url;
757
+ a.download = `peerpigeon-performance-report-${Date.now()}.json`;
758
+ document.body.appendChild(a);
759
+ a.click();
760
+ document.body.removeChild(a);
761
+ URL.revokeObjectURL(url);
762
+
763
+ store.addDebugLog('Performance report generated and downloaded', 'success');
764
+ };
765
+
766
+ const runNetworkBenchmark = async () => {
767
+ store.addDebugLog('Running network benchmark...', 'info');
768
+
769
+ const startTime = performance.now();
770
+
771
+ // Simulate network operations
772
+ for (let i = 0; i < 10; i++) {
773
+ await new Promise(resolve => setTimeout(resolve, 10));
774
+ if (store.connectedPeersList.length > 0) {
775
+ // Simulate sending messages
776
+ store.addDebugLog(`Benchmark message ${i + 1}/10`, 'debug');
777
+ }
778
+ }
779
+
780
+ const endTime = performance.now();
781
+ const duration = Math.round(endTime - startTime);
782
+
783
+ store.addDebugLog(`Network benchmark completed in ${duration}ms`, 'success');
784
+ };
785
+
786
+ const runCryptoBenchmark = async () => {
787
+ store.addDebugLog('Running crypto benchmark...', 'info');
788
+
789
+ const startTime = performance.now();
790
+
791
+ // Simulate crypto operations
792
+ for (let i = 0; i < 5; i++) {
793
+ await new Promise(resolve => setTimeout(resolve, 20));
794
+ store.addDebugLog(`Crypto operation ${i + 1}/5`, 'debug');
795
+ }
796
+
797
+ const endTime = performance.now();
798
+ const duration = Math.round(endTime - startTime);
799
+
800
+ store.addDebugLog(`Crypto benchmark completed in ${duration}ms`, 'success');
801
+ };
802
+
803
+ const runStorageBenchmark = async () => {
804
+ store.addDebugLog('Running storage benchmark...', 'info');
805
+
806
+ const startTime = performance.now();
807
+
808
+ // Simulate storage operations
809
+ for (let i = 0; i < 15; i++) {
810
+ await store.storageStore(`benchmark:test-${i}`, { data: `test-data-${i}`, timestamp: Date.now() });
811
+ await new Promise(resolve => setTimeout(resolve, 5));
812
+ }
813
+
814
+ const endTime = performance.now();
815
+ const duration = Math.round(endTime - startTime);
816
+
817
+ store.addDebugLog(`Storage benchmark completed in ${duration}ms`, 'success');
818
+ };
819
+
820
+ const runFullBenchmarkSuite = async () => {
821
+ store.addDebugLog('Running full benchmark suite...', 'info');
822
+
823
+ await runNetworkBenchmark();
824
+ await runCryptoBenchmark();
825
+ await runStorageBenchmark();
826
+
827
+ store.addDebugLog('Full benchmark suite completed', 'success');
828
+ };
829
+
830
+ const runHealthCheck = async () => {
831
+ store.addDebugLog('Running system health check...', 'info');
832
+
833
+ const checks = [
834
+ { name: 'Mesh Connection', status: store.isConnected ? 'pass' : 'fail' },
835
+ { name: 'WebRTC Support', status: window.RTCPeerConnection ? 'pass' : 'fail' },
836
+ { name: 'WebSocket Support', status: window.WebSocket ? 'pass' : 'fail' },
837
+ { name: 'Crypto API', status: window.crypto && window.crypto.subtle ? 'pass' : 'fail' },
838
+ { name: 'Storage Manager', status: store.mesh?.distributedStorage ? 'pass' : 'fail' },
839
+ { name: 'Debug Logger', status: store.mesh?.debugLogger ? 'pass' : 'fail' }
840
+ ];
841
+
842
+ checks.forEach(check => {
843
+ const level = check.status === 'pass' ? 'success' : 'error';
844
+ store.addDebugLog(`Health Check - ${check.name}: ${check.status.toUpperCase()}`, level);
845
+ });
846
+
847
+ const passedChecks = checks.filter(c => c.status === 'pass').length;
848
+ store.addDebugLog(`Health check completed: ${passedChecks}/${checks.length} checks passed`,
849
+ passedChecks === checks.length ? 'success' : 'warning');
850
+ };
851
+
852
+ const validateConfiguration = () => {
853
+ store.addDebugLog('Validating system configuration...', 'info');
854
+
855
+ const config = {
856
+ mesh: !!store.mesh,
857
+ peerId: !!store.peerId,
858
+ signalingServer: store.signalingServer || 'default',
859
+ debugLogging: !!store.mesh?.debugLogger
860
+ };
861
+
862
+ store.addDebugLog(`Configuration validation:\n${JSON.stringify(config, null, 2)}`, 'info');
863
+ };
864
+
865
+ const testConnectivity = async () => {
866
+ store.addDebugLog('Testing connectivity...', 'info');
867
+
868
+ try {
869
+ // Test signaling server connection
870
+ if (store.mesh?.signalingClient) {
871
+ store.addDebugLog('Signaling server: Connected', 'success');
872
+ } else {
873
+ store.addDebugLog('Signaling server: Not connected', 'warning');
874
+ }
875
+
876
+ // Test peer connections
877
+ const peerCount = store.connectedPeersList.length;
878
+ store.addDebugLog(`Peer connections: ${peerCount} active`, peerCount > 0 ? 'success' : 'warning');
879
+
880
+ store.addDebugLog('Connectivity test completed', 'info');
881
+ } catch (error) {
882
+ store.addDebugLog(`Connectivity test failed: ${error.message}`, 'error');
883
+ }
884
+ };
885
+
886
+ const generateDiagnosticReport = () => {
887
+ const report = {
888
+ timestamp: Date.now(),
889
+ system: {
890
+ userAgent: navigator.userAgent,
891
+ platform: navigator.platform,
892
+ language: navigator.language,
893
+ onLine: navigator.onLine
894
+ },
895
+ peerpigeon: {
896
+ version: '1.0.0',
897
+ peerId: store.peerId,
898
+ isConnected: store.isConnected,
899
+ connectedPeers: store.connectedPeersList.length,
900
+ storageItems: store.storageData.size,
901
+ cryptoKeys: store.cryptoKeys.length
902
+ },
903
+ logs: {
904
+ total: debugLogs.value.length,
905
+ recent: debugLogs.value.slice(-50) // Last 50 logs
906
+ },
907
+ monitoring: {
908
+ isActive: isMonitoring.value,
909
+ dataPoints: monitoringData.value.length,
910
+ systemStatus: systemStatus.value
911
+ }
912
+ };
913
+
914
+ const reportStr = JSON.stringify(report, null, 2);
915
+ const reportBlob = new Blob([reportStr], { type: 'application/json' });
916
+ const url = URL.createObjectURL(reportBlob);
917
+
918
+ const a = document.createElement('a');
919
+ a.href = url;
920
+ a.download = `peerpigeon-diagnostic-report-${Date.now()}.json`;
921
+ document.body.appendChild(a);
922
+ a.click();
923
+ document.body.removeChild(a);
924
+ URL.revokeObjectURL(url);
925
+
926
+ store.addDebugLog('Diagnostic report generated and downloaded', 'success');
927
+ };
928
+
929
+ const exportDebugLogs = () => {
930
+ const logsData = {
931
+ exported: Date.now(),
932
+ totalLogs: debugLogs.value.length,
933
+ logs: debugLogs.value
934
+ };
935
+
936
+ const logsStr = JSON.stringify(logsData, null, 2);
937
+ const logsBlob = new Blob([logsStr], { type: 'application/json' });
938
+ const url = URL.createObjectURL(logsBlob);
939
+
940
+ const a = document.createElement('a');
941
+ a.href = url;
942
+ a.download = `peerpigeon-debug-logs-${Date.now()}.json`;
943
+ document.body.appendChild(a);
944
+ a.click();
945
+ document.body.removeChild(a);
946
+ URL.revokeObjectURL(url);
947
+
948
+ store.addDebugLog('Debug logs exported', 'success');
949
+ };
950
+
951
+ const resetSystem = () => {
952
+ if (confirm('Are you sure you want to reset the system? This will clear all data and restart.')) {
953
+ store.addDebugLog('System reset initiated...', 'warning');
954
+
955
+ // Stop monitoring
956
+ stopMonitoring();
957
+
958
+ // Clear all data
959
+ store.debugLogs.splice(0);
960
+ store.storageData.clear();
961
+ store.cryptoKeys.splice(0);
962
+ monitoringData.value = [];
963
+
964
+ // Reset configurations
965
+ resetLoggingConfig();
966
+
967
+ store.addDebugLog('System reset completed', 'info');
968
+ }
969
+ };
970
+
971
+ const toggleAutoScroll = () => {
972
+ autoScroll.value = !autoScroll.value;
973
+ if (autoScroll.value) {
974
+ scrollToBottom();
975
+ }
976
+ };
977
+
978
+ const clearLogs = () => {
979
+ store.debugLogs.splice(0);
980
+ store.addDebugLog('Debug logs cleared', 'info');
981
+ };
982
+
983
+ const exportLogs = () => {
984
+ exportDebugLogs();
985
+ };
986
+
987
+ const scrollToBottom = () => {
988
+ nextTick(() => {
989
+ if (logDisplay.value) {
990
+ logDisplay.value.scrollTop = logDisplay.value.scrollHeight;
991
+ }
992
+ });
993
+ };
994
+
995
+ const formatLogTime = (timestamp) => {
996
+ return new Date(timestamp).toLocaleTimeString();
997
+ };
998
+
999
+ const formatTime = (timestamp) => {
1000
+ return new Date(timestamp).toLocaleTimeString();
1001
+ };
1002
+
1003
+ // Quick Actions
1004
+ const logTestMessages = () => {
1005
+ const levels = ['error', 'warning', 'info', 'debug', 'verbose'];
1006
+ const modules = ['Network', 'Storage', 'Crypto', 'DHT'];
1007
+
1008
+ levels.forEach((level, index) => {
1009
+ setTimeout(() => {
1010
+ const module = modules[index % modules.length];
1011
+ store.addDebugLog(`Test ${level} message from ${module}`, level, module);
1012
+ }, index * 200);
1013
+ });
1014
+ };
1015
+
1016
+ const simulateError = () => {
1017
+ store.addDebugLog('Simulated error: Connection timeout', 'error', 'Network');
1018
+ store.addDebugLog('Retrying connection...', 'warning', 'Network');
1019
+ setTimeout(() => {
1020
+ store.addDebugLog('Connection retry successful', 'success', 'Network');
1021
+ }, 1000);
1022
+ };
1023
+
1024
+ const stressTestSystem = async () => {
1025
+ store.addDebugLog('Starting stress test...', 'warning');
1026
+
1027
+ for (let i = 0; i < 50; i++) {
1028
+ setTimeout(() => {
1029
+ store.addDebugLog(`Stress test operation ${i + 1}/50`, 'debug');
1030
+ }, i * 50);
1031
+ }
1032
+
1033
+ setTimeout(() => {
1034
+ store.addDebugLog('Stress test completed', 'success');
1035
+ }, 50 * 50 + 100);
1036
+ };
1037
+
1038
+ const generatePerformanceProfile = () => {
1039
+ generatePerformanceReport();
1040
+ };
1041
+
1042
+ const enableVerboseLogging = () => {
1043
+ logConfig.value.globalLevel = 'verbose';
1044
+ updateLogLevel();
1045
+
1046
+ debugModules.value.forEach(module => {
1047
+ module.enabled = true;
1048
+ module.level = 'verbose';
1049
+ toggleModule(module.name, true);
1050
+ setModuleLevel(module.name, 'verbose');
1051
+ });
1052
+
1053
+ store.addDebugLog('Verbose logging enabled for all modules', 'info');
1054
+ };
1055
+
1056
+ const captureSystemSnapshot = () => {
1057
+ const snapshot = {
1058
+ timestamp: Date.now(),
1059
+ mesh: {
1060
+ isConnected: store.isConnected,
1061
+ peerId: store.peerId,
1062
+ connectedPeers: store.connectedPeersList.length
1063
+ },
1064
+ storage: {
1065
+ itemCount: store.storageData.size,
1066
+ keys: Array.from(store.storageData.keys())
1067
+ },
1068
+ crypto: {
1069
+ keyCount: store.cryptoKeys.length
1070
+ },
1071
+ system: {
1072
+ memoryUsage: memoryUsage.value,
1073
+ performance: performance.value,
1074
+ networkHealth: networkHealth.value
1075
+ },
1076
+ debug: {
1077
+ logCount: debugLogs.value.length,
1078
+ isMonitoring: isMonitoring.value,
1079
+ moduleStates: debugModules.value
1080
+ }
1081
+ };
1082
+
1083
+ store.addDebugLog(`System Snapshot:\n${JSON.stringify(snapshot, null, 2)}`, 'info');
1084
+ };
1085
+
1086
+ // Watch for new logs to auto-scroll
1087
+ watch(debugLogs, () => {
1088
+ if (autoScroll.value) {
1089
+ scrollToBottom();
1090
+ }
1091
+ }, { deep: true });
1092
+
1093
+ onMounted(() => {
1094
+ // Start initial system monitoring
1095
+ if (monitoringConfig.value.networkActivity || monitoringConfig.value.memoryUsage) {
1096
+ startMonitoring();
1097
+ }
1098
+
1099
+ // Initialize system status
1100
+ collectMonitoringData();
1101
+
1102
+ store.addDebugLog('Debug view initialized', 'info');
1103
+ });
1104
+
1105
+ onUnmounted(() => {
1106
+ if (monitoringInterval.value) {
1107
+ clearInterval(monitoringInterval.value);
1108
+ }
1109
+ });
1110
+ </script>
1111
+
1112
+ <style scoped>
1113
+ /* Same base styles as other views with debug-specific styling */
1114
+ .debug-view {
1115
+ max-width: 1400px;
1116
+ margin: 0 auto;
1117
+ }
1118
+
1119
+ .section-header {
1120
+ text-align: center;
1121
+ margin-bottom: 30px;
1122
+ }
1123
+
1124
+ .section-header h2 {
1125
+ font-size: 28px;
1126
+ color: #333;
1127
+ margin-bottom: 8px;
1128
+ }
1129
+
1130
+ .section-header p {
1131
+ color: #666;
1132
+ font-size: 16px;
1133
+ }
1134
+
1135
+ .debug-controls {
1136
+ background: white;
1137
+ border-radius: 12px;
1138
+ padding: 24px;
1139
+ margin-bottom: 30px;
1140
+ box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
1141
+ }
1142
+
1143
+ .debug-controls h3 {
1144
+ margin: 0 0 20px 0;
1145
+ color: #333;
1146
+ }
1147
+
1148
+ .control-tabs {
1149
+ display: flex;
1150
+ gap: 2px;
1151
+ margin-bottom: 20px;
1152
+ border-bottom: 1px solid #eee;
1153
+ overflow-x: auto;
1154
+ }
1155
+
1156
+ .tab-btn {
1157
+ padding: 12px 20px;
1158
+ border: none;
1159
+ background: none;
1160
+ color: #666;
1161
+ cursor: pointer;
1162
+ border-bottom: 3px solid transparent;
1163
+ transition: all 0.2s;
1164
+ font-weight: 500;
1165
+ white-space: nowrap;
1166
+ }
1167
+
1168
+ .tab-btn:hover {
1169
+ color: #3b82f6;
1170
+ background: rgba(59, 130, 246, 0.05);
1171
+ }
1172
+
1173
+ .tab-btn.active {
1174
+ color: #3b82f6;
1175
+ border-bottom-color: #3b82f6;
1176
+ }
1177
+
1178
+ .control-panel {
1179
+ padding: 20px;
1180
+ border: 1px solid #eee;
1181
+ border-radius: 8px;
1182
+ background: #fafafa;
1183
+ }
1184
+
1185
+ .control-panel h4 {
1186
+ margin: 0 0 8px 0;
1187
+ color: #333;
1188
+ }
1189
+
1190
+ .panel-description {
1191
+ color: #666;
1192
+ font-size: 14px;
1193
+ margin-bottom: 20px;
1194
+ line-height: 1.5;
1195
+ }
1196
+
1197
+ .logging-config,
1198
+ .monitoring-config,
1199
+ .performance-config,
1200
+ .diagnostics-config {
1201
+ display: grid;
1202
+ gap: 20px;
1203
+ }
1204
+
1205
+ .module-controls h5 {
1206
+ margin: 0 0 12px 0;
1207
+ color: #333;
1208
+ }
1209
+
1210
+ .module-grid {
1211
+ display: grid;
1212
+ grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
1213
+ gap: 12px;
1214
+ margin-bottom: 16px;
1215
+ }
1216
+
1217
+ .module-item {
1218
+ border: 1px solid #ddd;
1219
+ border-radius: 6px;
1220
+ padding: 12px;
1221
+ background: white;
1222
+ }
1223
+
1224
+ .module-header {
1225
+ display: flex;
1226
+ justify-content: space-between;
1227
+ align-items: center;
1228
+ margin-bottom: 8px;
1229
+ }
1230
+
1231
+ .module-name {
1232
+ font-weight: 500;
1233
+ color: #333;
1234
+ }
1235
+
1236
+ .module-status {
1237
+ padding: 2px 6px;
1238
+ border-radius: 3px;
1239
+ font-size: 10px;
1240
+ text-transform: uppercase;
1241
+ font-weight: 500;
1242
+ background: #dc2626;
1243
+ color: white;
1244
+ }
1245
+
1246
+ .module-status.enabled {
1247
+ background: #10b981;
1248
+ }
1249
+
1250
+ .module-controls {
1251
+ display: flex;
1252
+ justify-content: space-between;
1253
+ align-items: center;
1254
+ gap: 8px;
1255
+ }
1256
+
1257
+ .toggle-label {
1258
+ display: flex;
1259
+ align-items: center;
1260
+ gap: 4px;
1261
+ font-size: 12px;
1262
+ cursor: pointer;
1263
+ }
1264
+
1265
+ .checkbox-label {
1266
+ display: flex;
1267
+ align-items: center;
1268
+ gap: 8px;
1269
+ font-size: 14px;
1270
+ cursor: pointer;
1271
+ margin-bottom: 8px;
1272
+ }
1273
+
1274
+ .checkbox-label input[type="checkbox"] {
1275
+ width: auto;
1276
+ margin: 0;
1277
+ }
1278
+
1279
+ .monitoring-toggles {
1280
+ display: flex;
1281
+ flex-direction: column;
1282
+ gap: 8px;
1283
+ }
1284
+
1285
+ .form-group {
1286
+ margin-bottom: 16px;
1287
+ }
1288
+
1289
+ .form-group label {
1290
+ display: block;
1291
+ margin-bottom: 6px;
1292
+ font-weight: 500;
1293
+ color: #333;
1294
+ font-size: 14px;
1295
+ }
1296
+
1297
+ .form-select,
1298
+ .form-select-sm {
1299
+ padding: 8px 12px;
1300
+ border: 1px solid #ddd;
1301
+ border-radius: 6px;
1302
+ font-size: 14px;
1303
+ font-family: inherit;
1304
+ background: white;
1305
+ }
1306
+
1307
+ .form-select-sm {
1308
+ padding: 4px 8px;
1309
+ font-size: 12px;
1310
+ }
1311
+
1312
+ .form-input-sm {
1313
+ padding: 4px 8px;
1314
+ border: 1px solid #ddd;
1315
+ border-radius: 4px;
1316
+ font-size: 12px;
1317
+ font-family: inherit;
1318
+ }
1319
+
1320
+ .logging-actions,
1321
+ .monitoring-actions,
1322
+ .profiling-actions,
1323
+ .benchmark-actions,
1324
+ .health-actions,
1325
+ .trouble-actions {
1326
+ display: flex;
1327
+ flex-wrap: wrap;
1328
+ gap: 8px;
1329
+ }
1330
+
1331
+ .profiling-controls,
1332
+ .benchmark-controls,
1333
+ .health-check,
1334
+ .troubleshooting {
1335
+ border-top: 1px solid #eee;
1336
+ padding-top: 16px;
1337
+ }
1338
+
1339
+ .profiling-controls h5,
1340
+ .benchmark-controls h5,
1341
+ .health-check h5,
1342
+ .troubleshooting h5 {
1343
+ margin: 0 0 12px 0;
1344
+ color: #333;
1345
+ }
1346
+
1347
+ .btn {
1348
+ padding: 8px 16px;
1349
+ border: none;
1350
+ border-radius: 6px;
1351
+ font-size: 14px;
1352
+ font-weight: 500;
1353
+ cursor: pointer;
1354
+ transition: all 0.2s;
1355
+ display: inline-flex;
1356
+ align-items: center;
1357
+ gap: 6px;
1358
+ }
1359
+
1360
+ .btn:disabled {
1361
+ opacity: 0.6;
1362
+ cursor: not-allowed;
1363
+ }
1364
+
1365
+ .btn-primary {
1366
+ background: #3b82f6;
1367
+ color: white;
1368
+ }
1369
+
1370
+ .btn-primary:hover:not(:disabled) {
1371
+ background: #2563eb;
1372
+ }
1373
+
1374
+ .btn-secondary {
1375
+ background: #6b7280;
1376
+ color: white;
1377
+ }
1378
+
1379
+ .btn-secondary:hover:not(:disabled) {
1380
+ background: #4b5563;
1381
+ }
1382
+
1383
+ .btn-success {
1384
+ background: #10b981;
1385
+ color: white;
1386
+ }
1387
+
1388
+ .btn-success:hover:not(:disabled) {
1389
+ background: #059669;
1390
+ }
1391
+
1392
+ .btn-danger {
1393
+ background: #ef4444;
1394
+ color: white;
1395
+ }
1396
+
1397
+ .btn-danger:hover:not(:disabled) {
1398
+ background: #dc2626;
1399
+ }
1400
+
1401
+ .btn-warning {
1402
+ background: #f59e0b;
1403
+ color: white;
1404
+ }
1405
+
1406
+ .btn-warning:hover:not(:disabled) {
1407
+ background: #d97706;
1408
+ }
1409
+
1410
+ .btn-info {
1411
+ background: #06b6d4;
1412
+ color: white;
1413
+ }
1414
+
1415
+ .btn-info:hover:not(:disabled) {
1416
+ background: #0891b2;
1417
+ }
1418
+
1419
+ .btn-sm {
1420
+ padding: 4px 8px;
1421
+ font-size: 12px;
1422
+ }
1423
+
1424
+ .btn-icon {
1425
+ font-size: 14px;
1426
+ }
1427
+
1428
+ .debug-logs {
1429
+ background: white;
1430
+ border-radius: 12px;
1431
+ padding: 24px;
1432
+ margin-bottom: 30px;
1433
+ box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
1434
+ }
1435
+
1436
+ .section-title {
1437
+ display: flex;
1438
+ justify-content: space-between;
1439
+ align-items: center;
1440
+ margin-bottom: 20px;
1441
+ flex-wrap: wrap;
1442
+ gap: 16px;
1443
+ }
1444
+
1445
+ .section-title h3 {
1446
+ margin: 0;
1447
+ color: #333;
1448
+ }
1449
+
1450
+ .log-controls {
1451
+ display: flex;
1452
+ gap: 16px;
1453
+ align-items: center;
1454
+ flex-wrap: wrap;
1455
+ }
1456
+
1457
+ .log-filters {
1458
+ display: flex;
1459
+ gap: 8px;
1460
+ align-items: center;
1461
+ }
1462
+
1463
+ .log-actions {
1464
+ display: flex;
1465
+ gap: 8px;
1466
+ }
1467
+
1468
+ .log-display {
1469
+ max-height: 400px;
1470
+ overflow-y: auto;
1471
+ border: 1px solid #eee;
1472
+ border-radius: 6px;
1473
+ background: #fafafa;
1474
+ }
1475
+
1476
+ .empty-logs {
1477
+ text-align: center;
1478
+ padding: 60px 20px;
1479
+ color: #666;
1480
+ }
1481
+
1482
+ .empty-icon {
1483
+ font-size: 48px;
1484
+ margin-bottom: 16px;
1485
+ }
1486
+
1487
+ .empty-logs p {
1488
+ margin: 0 0 8px 0;
1489
+ }
1490
+
1491
+ .empty-meta {
1492
+ font-size: 14px;
1493
+ color: #999;
1494
+ }
1495
+
1496
+ .log-entries {
1497
+ padding: 16px;
1498
+ }
1499
+
1500
+ .log-entry {
1501
+ margin-bottom: 12px;
1502
+ padding: 8px 12px;
1503
+ border-radius: 4px;
1504
+ border-left: 3px solid #ddd;
1505
+ background: white;
1506
+ }
1507
+
1508
+ .log-entry.log-error {
1509
+ border-left-color: #ef4444;
1510
+ background: #fef2f2;
1511
+ }
1512
+
1513
+ .log-entry.log-warning {
1514
+ border-left-color: #f59e0b;
1515
+ background: #fffbeb;
1516
+ }
1517
+
1518
+ .log-entry.log-info {
1519
+ border-left-color: #3b82f6;
1520
+ background: #eff6ff;
1521
+ }
1522
+
1523
+ .log-entry.log-debug {
1524
+ border-left-color: #8b5cf6;
1525
+ background: #f5f3ff;
1526
+ }
1527
+
1528
+ .log-entry.log-verbose {
1529
+ border-left-color: #6b7280;
1530
+ background: #f9fafb;
1531
+ }
1532
+
1533
+ .log-entry.log-success {
1534
+ border-left-color: #10b981;
1535
+ background: #f0fdf4;
1536
+ }
1537
+
1538
+ .log-header {
1539
+ display: flex;
1540
+ gap: 12px;
1541
+ align-items: center;
1542
+ margin-bottom: 4px;
1543
+ font-size: 12px;
1544
+ }
1545
+
1546
+ .log-timestamp {
1547
+ color: #666;
1548
+ font-family: monospace;
1549
+ }
1550
+
1551
+ .log-level {
1552
+ padding: 1px 4px;
1553
+ border-radius: 2px;
1554
+ font-weight: 500;
1555
+ font-size: 10px;
1556
+ }
1557
+
1558
+ .log-entry.log-error .log-level {
1559
+ background: #ef4444;
1560
+ color: white;
1561
+ }
1562
+
1563
+ .log-entry.log-warning .log-level {
1564
+ background: #f59e0b;
1565
+ color: white;
1566
+ }
1567
+
1568
+ .log-entry.log-info .log-level {
1569
+ background: #3b82f6;
1570
+ color: white;
1571
+ }
1572
+
1573
+ .log-entry.log-debug .log-level {
1574
+ background: #8b5cf6;
1575
+ color: white;
1576
+ }
1577
+
1578
+ .log-entry.log-verbose .log-level {
1579
+ background: #6b7280;
1580
+ color: white;
1581
+ }
1582
+
1583
+ .log-entry.log-success .log-level {
1584
+ background: #10b981;
1585
+ color: white;
1586
+ }
1587
+
1588
+ .log-module {
1589
+ background: #e5e7eb;
1590
+ color: #374151;
1591
+ padding: 1px 4px;
1592
+ border-radius: 2px;
1593
+ font-size: 10px;
1594
+ }
1595
+
1596
+ .log-message {
1597
+ color: #333;
1598
+ font-size: 13px;
1599
+ line-height: 1.4;
1600
+ }
1601
+
1602
+ .log-data {
1603
+ margin-top: 8px;
1604
+ }
1605
+
1606
+ .log-data details {
1607
+ cursor: pointer;
1608
+ }
1609
+
1610
+ .log-data summary {
1611
+ color: #666;
1612
+ font-size: 12px;
1613
+ margin-bottom: 4px;
1614
+ }
1615
+
1616
+ .log-data pre {
1617
+ margin: 0;
1618
+ padding: 8px;
1619
+ background: #f8f9fa;
1620
+ border: 1px solid #e5e7eb;
1621
+ border-radius: 3px;
1622
+ font-size: 11px;
1623
+ overflow-x: auto;
1624
+ }
1625
+
1626
+ .system-dashboard {
1627
+ background: white;
1628
+ border-radius: 12px;
1629
+ padding: 24px;
1630
+ margin-bottom: 30px;
1631
+ box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
1632
+ }
1633
+
1634
+ .system-dashboard h3 {
1635
+ margin: 0 0 20px 0;
1636
+ color: #333;
1637
+ }
1638
+
1639
+ .dashboard-grid {
1640
+ display: grid;
1641
+ grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
1642
+ gap: 16px;
1643
+ margin-bottom: 24px;
1644
+ }
1645
+
1646
+ .status-card {
1647
+ display: flex;
1648
+ align-items: center;
1649
+ gap: 16px;
1650
+ padding: 16px;
1651
+ background: #f8f9fa;
1652
+ border-radius: 8px;
1653
+ border: 1px solid #eee;
1654
+ }
1655
+
1656
+ .status-icon {
1657
+ font-size: 24px;
1658
+ opacity: 0.8;
1659
+ }
1660
+
1661
+ .status-content h4 {
1662
+ margin: 0 0 4px 0;
1663
+ font-size: 13px;
1664
+ color: #666;
1665
+ text-transform: uppercase;
1666
+ letter-spacing: 0.5px;
1667
+ }
1668
+
1669
+ .status-value {
1670
+ font-size: 18px;
1671
+ font-weight: 600;
1672
+ margin-bottom: 2px;
1673
+ }
1674
+
1675
+ .status-value.healthy,
1676
+ .status-value.good {
1677
+ color: #10b981;
1678
+ }
1679
+
1680
+ .status-value.warning {
1681
+ color: #f59e0b;
1682
+ }
1683
+
1684
+ .status-value.error {
1685
+ color: #ef4444;
1686
+ }
1687
+
1688
+ .status-meta {
1689
+ font-size: 11px;
1690
+ color: #999;
1691
+ }
1692
+
1693
+ .monitoring-charts {
1694
+ border-top: 1px solid #eee;
1695
+ padding-top: 20px;
1696
+ }
1697
+
1698
+ .monitoring-charts h4 {
1699
+ margin: 0 0 16px 0;
1700
+ color: #333;
1701
+ }
1702
+
1703
+ .chart-placeholder {
1704
+ height: 200px;
1705
+ background: #f8f9fa;
1706
+ border: 2px dashed #ddd;
1707
+ border-radius: 6px;
1708
+ display: flex;
1709
+ align-items: center;
1710
+ justify-content: center;
1711
+ text-align: center;
1712
+ }
1713
+
1714
+ .chart-info {
1715
+ color: #666;
1716
+ }
1717
+
1718
+ .chart-info p {
1719
+ margin: 0 0 4px 0;
1720
+ }
1721
+
1722
+ .quick-debug-actions {
1723
+ background: white;
1724
+ border-radius: 12px;
1725
+ padding: 24px;
1726
+ box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
1727
+ }
1728
+
1729
+ .quick-debug-actions h3 {
1730
+ margin: 0 0 20px 0;
1731
+ color: #333;
1732
+ }
1733
+
1734
+ .action-buttons {
1735
+ display: flex;
1736
+ flex-wrap: wrap;
1737
+ gap: 12px;
1738
+ }
1739
+
1740
+ /* Responsive design */
1741
+ @media (max-width: 768px) {
1742
+ .control-tabs {
1743
+ flex-wrap: wrap;
1744
+ }
1745
+
1746
+ .tab-btn {
1747
+ flex: 1;
1748
+ min-width: 120px;
1749
+ }
1750
+
1751
+ .section-title {
1752
+ flex-direction: column;
1753
+ align-items: flex-start;
1754
+ }
1755
+
1756
+ .log-controls {
1757
+ flex-direction: column;
1758
+ align-items: flex-start;
1759
+ }
1760
+
1761
+ .module-grid {
1762
+ grid-template-columns: 1fr;
1763
+ }
1764
+
1765
+ .dashboard-grid {
1766
+ grid-template-columns: 1fr;
1767
+ }
1768
+
1769
+ .action-buttons {
1770
+ flex-direction: column;
1771
+ }
1772
+ }
1773
+ </style>