pms_md 1.0.0

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 (55) hide show
  1. package/README.md +93 -0
  2. package/node-monitor/ARCHITECTURE.md +341 -0
  3. package/node-monitor/CHANGELOG.md +105 -0
  4. package/node-monitor/CONTRIBUTING.md +96 -0
  5. package/node-monitor/DESIGN_IMPROVEMENTS.md +286 -0
  6. package/node-monitor/FILTER_BUTTONS_FIX.md +303 -0
  7. package/node-monitor/GETTING_STARTED.md +416 -0
  8. package/node-monitor/INSTALLATION.md +470 -0
  9. package/node-monitor/LICENSE +22 -0
  10. package/node-monitor/PUBLISHING_GUIDE.md +331 -0
  11. package/node-monitor/QUICK_REFERENCE.md +252 -0
  12. package/node-monitor/README.md +458 -0
  13. package/node-monitor/READY_TO_PUBLISH.md +272 -0
  14. package/node-monitor/SETUP_GUIDE.md +479 -0
  15. package/node-monitor/examples/EMAIL_SETUP_GUIDE.md +282 -0
  16. package/node-monitor/examples/ERROR_LOGGING_GUIDE.md +405 -0
  17. package/node-monitor/examples/GET_APP_PASSWORD.md +145 -0
  18. package/node-monitor/examples/LOG_FILES_REFERENCE.md +336 -0
  19. package/node-monitor/examples/QUICK_START_EMAIL.md +126 -0
  20. package/node-monitor/examples/express-app.js +499 -0
  21. package/node-monitor/examples/package-lock.json +1295 -0
  22. package/node-monitor/examples/package.json +18 -0
  23. package/node-monitor/examples/public/css/style.css +718 -0
  24. package/node-monitor/examples/public/js/dashboard.js +207 -0
  25. package/node-monitor/examples/public/js/health.js +114 -0
  26. package/node-monitor/examples/public/js/main.js +89 -0
  27. package/node-monitor/examples/public/js/metrics.js +225 -0
  28. package/node-monitor/examples/public/js/theme.js +138 -0
  29. package/node-monitor/examples/views/dashboard.ejs +20 -0
  30. package/node-monitor/examples/views/error-logs.ejs +1129 -0
  31. package/node-monitor/examples/views/health.ejs +21 -0
  32. package/node-monitor/examples/views/home.ejs +341 -0
  33. package/node-monitor/examples/views/layout.ejs +50 -0
  34. package/node-monitor/examples/views/metrics.ejs +16 -0
  35. package/node-monitor/examples/views/partials/footer.ejs +16 -0
  36. package/node-monitor/examples/views/partials/header.ejs +35 -0
  37. package/node-monitor/examples/views/partials/nav.ejs +23 -0
  38. package/node-monitor/examples/views/status.ejs +390 -0
  39. package/node-monitor/package-lock.json +4300 -0
  40. package/node-monitor/package.json +76 -0
  41. package/node-monitor/pre-publish-check.js +200 -0
  42. package/node-monitor/src/config/monitoringConfig.js +255 -0
  43. package/node-monitor/src/index.js +300 -0
  44. package/node-monitor/src/logger/errorLogger.js +297 -0
  45. package/node-monitor/src/monitors/apiErrorMonitor.js +156 -0
  46. package/node-monitor/src/monitors/dbConnectionMonitor.js +389 -0
  47. package/node-monitor/src/monitors/serverHealthMonitor.js +320 -0
  48. package/node-monitor/src/monitors/systemResourceMonitor.js +357 -0
  49. package/node-monitor/src/notifiers/emailNotifier.js +248 -0
  50. package/node-monitor/src/notifiers/notificationManager.js +96 -0
  51. package/node-monitor/src/notifiers/slackNotifier.js +209 -0
  52. package/node-monitor/src/views/dashboard.html +530 -0
  53. package/node-monitor/src/views/health.html +399 -0
  54. package/node-monitor/src/views/metrics.html +406 -0
  55. package/package.json +22 -0
@@ -0,0 +1,138 @@
1
+ /**
2
+ * Theme Toggle System
3
+ * Handles light/dark mode switching with localStorage persistence
4
+ */
5
+
6
+ // Apply theme immediately before page renders to prevent flash
7
+ (function() {
8
+ const savedTheme = localStorage.getItem('theme');
9
+ const prefersDark = window.matchMedia('(prefers-color-scheme: dark)').matches;
10
+ const theme = savedTheme || (prefersDark ? 'dark' : 'light');
11
+
12
+ if (theme === 'dark') {
13
+ document.documentElement.setAttribute('data-theme', 'dark');
14
+ }
15
+ })();
16
+
17
+ // Initialize theme on page load - multiple events to ensure it works
18
+ document.addEventListener('DOMContentLoaded', () => {
19
+ createThemeToggle();
20
+ });
21
+
22
+ // Fallback: create button when window loads
23
+ window.addEventListener('load', () => {
24
+ if (!document.querySelector('.theme-toggle')) {
25
+ createThemeToggle();
26
+ }
27
+ });
28
+
29
+ // Extra fallback: create button after a short delay
30
+ setTimeout(() => {
31
+ if (!document.querySelector('.theme-toggle')) {
32
+ createThemeToggle();
33
+ }
34
+ }, 100);
35
+
36
+ /**
37
+ * Set the theme
38
+ * @param {string} theme - 'light' or 'dark'
39
+ */
40
+ function setTheme(theme) {
41
+ // Add a class to disable transitions during theme change
42
+ document.documentElement.classList.add('theme-transitioning');
43
+
44
+ if (theme === 'dark') {
45
+ document.documentElement.setAttribute('data-theme', 'dark');
46
+ } else {
47
+ document.documentElement.removeAttribute('data-theme');
48
+ }
49
+ localStorage.setItem('theme', theme);
50
+ updateThemeToggleButton(theme);
51
+
52
+ // Remove the transitioning class after a brief moment
53
+ setTimeout(() => {
54
+ document.documentElement.classList.remove('theme-transitioning');
55
+ }, 50);
56
+ }
57
+
58
+ /**
59
+ * Toggle between light and dark themes
60
+ */
61
+ function toggleTheme() {
62
+ const currentTheme = localStorage.getItem('theme') || 'light';
63
+ const newTheme = currentTheme === 'light' ? 'dark' : 'light';
64
+ setTheme(newTheme);
65
+ }
66
+
67
+ /**
68
+ * Create the theme toggle button
69
+ */
70
+ function createThemeToggle() {
71
+ // Remove any existing button first
72
+ const existingButton = document.querySelector('.theme-toggle');
73
+ if (existingButton) {
74
+ existingButton.remove();
75
+ }
76
+
77
+ const button = document.createElement('button');
78
+ button.className = 'theme-toggle';
79
+ button.setAttribute('aria-label', 'Toggle theme');
80
+ button.setAttribute('title', 'Toggle light/dark mode');
81
+ button.onclick = toggleTheme;
82
+
83
+ // Force inline styles to ensure visibility
84
+ button.style.cssText = `
85
+ position: fixed !important;
86
+ top: 20px !important;
87
+ right: 20px !important;
88
+ z-index: 999999 !important;
89
+ display: flex !important;
90
+ align-items: center !important;
91
+ gap: 8px !important;
92
+ padding: 10px 20px !important;
93
+ background: var(--card-bg) !important;
94
+ color: var(--text-primary) !important;
95
+ border: 2px solid var(--border-color) !important;
96
+ border-radius: 25px !important;
97
+ cursor: pointer !important;
98
+ font-size: 0.9em !important;
99
+ font-weight: 600 !important;
100
+ box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3) !important;
101
+ white-space: nowrap !important;
102
+ opacity: 1 !important;
103
+ visibility: visible !important;
104
+ pointer-events: auto !important;
105
+ `;
106
+
107
+ // Append to body as the last element
108
+ document.body.appendChild(button);
109
+
110
+ const currentTheme = localStorage.getItem('theme') || 'light';
111
+ updateThemeToggleButton(currentTheme);
112
+
113
+ // Log for debugging
114
+ console.log('Theme toggle button created at position:', button.getBoundingClientRect());
115
+ }
116
+
117
+ /**
118
+ * Update the theme toggle button icon
119
+ * @param {string} theme - Current theme
120
+ */
121
+ function updateThemeToggleButton(theme) {
122
+ const button = document.querySelector('.theme-toggle');
123
+ if (button) {
124
+ if (theme === 'dark') {
125
+ button.innerHTML = '☀️ Light';
126
+ } else {
127
+ button.innerHTML = '🌙 Dark';
128
+ }
129
+ }
130
+ }
131
+
132
+ // Listen for system theme changes
133
+ window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', (e) => {
134
+ if (!localStorage.getItem('theme')) {
135
+ setTheme(e.matches ? 'dark' : 'light');
136
+ }
137
+ });
138
+
@@ -0,0 +1,20 @@
1
+ <%- include('partials/header') %>
2
+
3
+ <div class="status-header">
4
+ <span class="status-badge" id="overallStatus">
5
+ <span class="status-dot"></span>
6
+ <span id="statusText">Loading...</span>
7
+ </span>
8
+ <button class="refresh-btn" onclick="loadDashboard()">🔄 Refresh</button>
9
+ </div>
10
+
11
+ <div id="dashboardContent">
12
+ <div class="loading">
13
+ <div class="spinner"></div>
14
+ <p>Loading monitoring data...</p>
15
+ </div>
16
+ </div>
17
+
18
+ <div class="stats-summary" id="statsSummary"></div>
19
+
20
+ <%- include('partials/footer') %>