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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
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>RedisRadar - Real-time Redis Monitoring</title>
    <script src="https://cdn.tailwindcss.com"></script>
    <script src="https://unpkg.com/feather-icons"></script>
    <script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/vanta@latest/dist/vanta.net.min.js"></script>
    <script>
        tailwind.config = {
            theme: {
                extend: {
                    colors: {
                        primary: '#d82c20', // Redis red
                        secondary: '#4f5b66' // Dark slate
                    }
                }
            }
        }
    </script>
    <style>
        .dashboard-card {
            transition: all 0.3s ease;
        }
        .dashboard-card:hover {
            transform: translateY(-5px);
            box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
        }
        #vanta-background {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            z-index: -1;
            opacity: 0.15;
        }
    </style>
</head>
<body class="bg-gray-50 min-h-screen">
    <div id="vanta-background"></div>

    <!-- Navigation -->
    <nav class="bg-white shadow-sm">
        <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
            <div class="flex justify-between h-16">
                <div class="flex items-center">
                    <div class="flex-shrink-0 flex items-center">
                        <i data-feather="database" class="text-primary h-6 w-6"></i>
                        <span class="ml-2 text-xl font-bold text-primary">RedisRadar</span>
                    </div>
                    <div class="hidden sm:ml-6 sm:flex sm:space-x-8">
                        <a href="#" class="border-primary text-gray-900 inline-flex items-center px-1 pt-1 border-b-2 text-sm font-medium">
                            Dashboard
                        </a>
                        <a href="#" class="border-transparent text-gray-500 hover:border-gray-300 hover:text-gray-700 inline-flex items-center px-1 pt-1 border-b-2 text-sm font-medium">
                            Keys
                        </a>
                        <a href="#" class="border-transparent text-gray-500 hover:border-gray-300 hover:text-gray-700 inline-flex items-center px-1 pt-1 border-b-2 text-sm font-medium">
                            Performance
                        </a>
                        <a href="#" class="border-transparent text-gray-500 hover:border-gray-300 hover:text-gray-700 inline-flex items-center px-1 pt-1 border-b-2 text-sm font-medium">
                            Configuration
                        </a>
                    </div>
                </div>
                <div class="hidden sm:ml-6 sm:flex sm:items-center">
                    <button type="button" class="bg-white p-1 rounded-full text-gray-400 hover:text-gray-500 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary">
                        <i data-feather="bell" class="h-6 w-6"></i>
                    </button>
                    <div class="ml-3 relative">
                        <div>
                            <button type="button" class="bg-white rounded-full flex text-sm focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary" id="user-menu-button" aria-expanded="false" aria-haspopup="true">
                                <img class="h-8 w-8 rounded-full" src="http://static.photos/technology/200x200/42" alt="">
                            </button>
                        </div>
                    </div>
                </div>
                <div class="-mr-2 flex items-center sm:hidden">
                    <button type="button" class="inline-flex items-center justify-center p-2 rounded-md text-gray-400 hover:text-gray-500 hover:bg-gray-100 focus:outline-none focus:ring-2 focus:ring-inset focus:ring-primary" aria-controls="mobile-menu" aria-expanded="false">
                        <i data-feather="menu" class="block h-6 w-6"></i>
                        <i data-feather="x" class="hidden h-6 w-6"></i>
                    </button>
                </div>
            </div>
        </div>

        <!-- Mobile menu, show/hide based on menu state. -->
        <div class="sm:hidden hidden" id="mobile-menu">
            <div class="pt-2 pb-3 space-y-1">
                <a href="#" class="bg-primary-50 border-primary text-primary block pl-3 pr-4 py-2 border-l-4 text-base font-medium">Dashboard</a>
                <a href="#" class="border-transparent text-gray-500 hover:bg-gray-50 hover:border-gray-300 hover:text-gray-700 block pl-3 pr-4 py-2 border-l-4 text-base font-medium">Keys</a>
                <a href="#" class="border-transparent text-gray-500 hover:bg-gray-50 hover:border-gray-300 hover:text-gray-700 block pl-3 pr-4 py-2 border-l-4 text-base font-medium">Performance</a>
                <a href="#" class="border-transparent text-gray-500 hover:bg-gray-50 hover:border-gray-300 hover:text-gray-700 block pl-3 pr-4 py-2 border-l-4 text-base font-medium">Configuration</a>
            </div>
            <div class="pt-4 pb-3 border-t border-gray-200">
                <div class="flex items-center px-4">
                    <div class="flex-shrink-0">
                        <img class="h-10 w-10 rounded-full" src="http://static.photos/technology/200x200/42" alt="">
                    </div>
                    <div class="ml-3">
                        <div class="text-base font-medium text-gray-800">Admin User</div>
                        <div class="text-sm font-medium text-gray-500">admin@example.com</div>
                    </div>
                    <button type="button" class="ml-auto bg-white flex-shrink-0 p-1 rounded-full text-gray-400 hover:text-gray-500 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary">
                        <i data-feather="bell" class="h-6 w-6"></i>
                    </button>
                </div>
            </div>
        </div>
    </nav>

    <!-- Main Content -->
    <div class="py-6">
        <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
            <h1 class="text-2xl font-semibold text-gray-900">Redis Dashboard</h1>
            <div class="py-4">
                <div class="border-b border-gray-200">
                    <nav class="-mb-px flex space-x-8">
                        <a href="#" class="border-primary text-primary whitespace-nowrap py-4 px-1 border-b-2 font-medium text-sm">
                            Overview
                        </a>
                        <a href="#" class="border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300 whitespace-nowrap py-4 px-1 border-b-2 font-medium text-sm">
                            Memory
                        </a>
                        <a href="#" class="border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300 whitespace-nowrap py-4 px-1 border-b-2 font-medium text-sm">
                            Clients
                        </a>
                        <a href="#" class="border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300 whitespace-nowrap py-4 px-1 border-b-2 font-medium text-sm">
                            Persistence
                        </a>
                        <a href="#" class="border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300 whitespace-nowrap py-4 px-1 border-b-2 font-medium text-sm">
                            Stats
                        </a>
                    </nav>
                </div>
            </div>

            <!-- Stats Cards -->
            <div class="grid grid-cols-1 gap-5 sm:grid-cols-2 lg:grid-cols-4 mb-6">
                <div class="bg-white overflow-hidden shadow rounded-lg dashboard-card">
                    <div class="px-4 py-5 sm:p-6">
                        <div class="flex items-center">
                            <div class="flex-shrink-0 bg-primary-100 p-3 rounded-md">
                                <i data-feather="activity" class="text-primary h-6 w-6"></i>
                            </div>
                            <div class="ml-5 w-0 flex-1">
                                <dl>
                                    <dt class="text-sm font-medium text-gray-500 truncate">Connected Clients</dt>
                                    <dd>
                                        <div class="text-lg font-medium text-gray-900">127</div>
                                    </dd>
                                </dl>
                            </div>
                        </div>
                    </div>
                    <div class="bg-gray-50 px-4 py-4 sm:px-6">
                        <div class="text-sm">
                            <a href="#" class="font-medium text-primary hover:text-primary-700"> View all<span class="sr-only"> Connected Clients stats</span></a>
                        </div>
                    </div>
                </div>

                <div class="bg-white overflow-hidden shadow rounded-lg dashboard-card">
                    <div class="px-4 py-5 sm:p-6">
                        <div class="flex items-center">
                            <div class="flex-shrink-0 bg-blue-100 p-3 rounded-md">
                                <i data-feather="database" class="text-blue-600 h-6 w-6"></i>
                            </div>
                            <div class="ml-5 w-0 flex-1">
                                <dl>
                                    <dt class="text-sm font-medium text-gray-500 truncate">Total Keys</dt>
                                    <dd>
                                        <div class="text-lg font-medium text-gray-900">8,947</div>
                                    </dd>
                                </dl>
                            </div>
                        </div>
                    </div>
                    <div class="bg-gray-50 px-4 py-4 sm:px-6">
                        <div class="text-sm">
                            <a href="#" class="font-medium text-blue-600 hover:text-blue-500"> View all<span class="sr-only"> Total Keys stats</span></a>
                        </div>
                    </div>
                </div>

                <div class="bg-white overflow-hidden shadow rounded-lg dashboard-card">
                    <div class="px-4 py-5 sm:p-6">
                        <div class="flex items-center">
                            <div class="flex-shrink-0 bg-green-100 p-3 rounded-md">
                                <i data-feather="cpu" class="text-green-600 h-6 w-6"></i>
                            </div>
                            <div class="ml-5 w-0 flex-1">
                                <dl>
                                    <dt class="text-sm font-medium text-gray-500 truncate">Memory Usage</dt>
                                    <dd>
                                        <div class="text-lg font-medium text-gray-900">1.2GB</div>
                                    </dd>
                                </dl>
                            </div>
                        </div>
                    </div>
                    <div class="bg-gray-50 px-4 py-4 sm:px-6">
                        <div class="text-sm">
                            <a href="#" class="font-medium text-green-600 hover:text-green-500"> View details<span class="sr-only"> Memory Usage stats</span></a>
                        </div>
                    </div>
                </div>

                <div class="bg-white overflow-hidden shadow rounded-lg dashboard-card">
                    <div class="px-4 py-5 sm:p-6">
                        <div class="flex items-center">
                            <div class="flex-shrink-0 bg-purple-100 p-3 rounded-md">
                                <i data-feather="zap" class="text-purple-600 h-6 w-6"></i>
                            </div>
                            <div class="ml-5 w-0 flex-1">
                                <dl>
                                    <dt class="text-sm font-medium text-gray-500 truncate">Ops/sec</dt>
                                    <dd>
                                        <div class="text-lg font-medium text-gray-900">2,349</div>
                                    </dd>
                                </dl>
                            </div>
                        </div>
                    </div>
                    <div class="bg-gray-50 px-4 py-4 sm:px-6">
                        <div class="text-sm">
                            <a href="#" class="font-medium text-purple-600 hover:text-purple-500"> View performance<span class="sr-only"> Ops/sec stats</span></a>
                        </div>
                    </div>
                </div>
            </div>

            <!-- Charts Section -->
            <div class="grid grid-cols-1 lg:grid-cols-2 gap-6 mb-6">
                <!-- Memory Usage Chart -->
                <div class="bg-white shadow rounded-lg p-6 dashboard-card">
                    <h2 class="text-lg leading-6 font-medium text-gray-900 mb-4">Memory Usage</h2>
                    <div class="h-64">
                        <canvas id="memoryChart"></canvas>
                    </div>
                </div>

                <!-- Commands Per Second Chart -->
                <div class="bg-white shadow rounded-lg p-6 dashboard-card">
                    <h2 class="text-lg leading-6 font-medium text-gray-900 mb-4">Commands Per Second</h2>
                    <div class="h-64">
                        <canvas id="commandsChart"></canvas>
                    </div>
                </div>
            </div>

            <!-- Recent Activity -->
            <div class="bg-white shadow rounded-lg overflow-hidden dashboard-card">
                <div class="px-4 py-5 sm:px-6 border-b border-gray-200">
                    <h3 class="text-lg leading-6 font-medium text-gray-900">Recent Activity</h3>
                </div>
                <div class="bg-white overflow-hidden">
                    <ul class="divide-y divide-gray-200">
                        <li class="px-6 py-4">
                            <div class="flex items-center">
                                <div class="flex-shrink-0">
                                    <i data-feather="activity" class="h-5 w-5 text-green-500"></i>
                                </div>
                                <div class="ml-4">
                                    <p class="text-sm font-medium text-gray-900">New client connected</p>
                                    <p class="text-sm text-gray-500">Client ID: 128 from 192.168.1.42</p>
                                </div>
                                <div class="ml-auto text-sm text-gray-500">
                                    2m ago
                                </div>
                            </div>
                        </li>
                        <li class="px-6 py-4">
                            <div class="flex items-center">
                                <div class="flex-shrink-0">
                                    <i data-feather="database" class="h-5 w-5 text-blue-500"></i>
                                </div>
                                <div class="ml-4">
                                    <p class="text-sm font-medium text-gray-900">Key expiration</p>
                                    <p class="text-sm text-gray-500">Key: user:session:42 expired</p>
                                </div>
                                <div class="ml-auto text-sm text-gray-500">
                                    5m ago
                                </div>
                            </div>
                        </li>
                        <li class="px-6 py-4">
                            <div class="flex items-center">
                                <div class="flex-shrink-0">
                                    <i data-feather="alert-triangle" class="h-5 w-5 text-yellow-500"></i>
                                </div>
                                <div class="ml-4">
                                    <p class="text-sm font-medium text-gray-900">Memory threshold reached</p>
                                    <p class="text-sm text-gray-500">85% of maxmemory used</p>
                                </div>
                                <div class="ml-auto text-sm text-gray-500">
                                    12m ago
                                </div>
                            </div>
                        </li>
                        <li class="px-6 py-4">
                            <div class="flex items-center">
                                <div class="flex-shrink-0">
                                    <i data-feather="zap" class="h-5 w-5 text-purple-500"></i>
                                </div>
                                <div class="ml-4">
                                    <p class="text-sm font-medium text-gray-900">Performance spike</p>
                                    <p class="text-sm text-gray-500">5,231 ops/sec detected</p>
                                </div>
                                <div class="ml-auto text-sm text-gray-500">
                                    23m ago
                                </div>
                            </div>
                        </li>
                    </ul>
                </div>
            </div>
        </div>
    </div>

    <script>
        // Initialize Vanta.js background
        VANTA.NET({
            el: "#vanta-background",
            mouseControls: true,
            touchControls: true,
            gyroControls: false,
            minHeight: 200.00,
            minWidth: 200.00,
            scale: 1.00,
            scaleMobile: 1.00,
            color: 0xd82c20,
            backgroundColor: 0xf8fafc,
            points: 10.00,
            maxDistance: 20.00,
            spacing: 15.00
        });

        // Initialize charts
        document.addEventListener('DOMContentLoaded', function() {
            feather.replace();
            
            // Memory Usage Chart
            const memoryCtx = document.getElementById('memoryChart').getContext('2d');
            const memoryChart = new Chart(memoryCtx, {
                type: 'line',
                data: {
                    labels: ['00:00', '03:00', '06:00', '09:00', '12:00', '15:00', '18:00', '21:00'],
                    datasets: [{
                        label: 'Used Memory',
                        data: [645, 892, 1123, 1456, 1234, 1567, 1890, 2100],
                        backgroundColor: 'rgba(216, 44, 32, 0.1)',
                        borderColor: '#d82c20',
                        borderWidth: 2,
                        tension: 0.1,
                        fill: true
                    }, {
                        label: 'Max Memory',
                        data: [2500, 2500, 2500, 2500, 2500, 2500, 2500, 2500],
                        backgroundColor: 'rgba(75, 85, 99, 0.05)',
                        borderColor: 'rgba(75, 85, 99, 0.5)',
                        borderWidth: 1,
                        borderDash: [5, 5],
                        fill: true
                    }]
                },
                options: {
                    responsive: true,
                    maintainAspectRatio: false,
                    plugins: {
                        legend: {
                            position: 'top',
                        },
                        tooltip: {
                            mode: 'index',
                            intersect: false,
                        }
                    },
                    scales: {
                        y: {
                            beginAtZero: true,
                            title: {
                                display: true,
                                text: 'Memory (MB)'
                            }
                        }
                    }
                }
            });

            // Commands Per Second Chart
            const commandsCtx = document.getElementById('commandsChart').getContext('2d');
            const commandsChart = new Chart(commandsCtx, {
                type: 'bar',
                data: {
                    labels: ['GET', 'SET', 'DEL', 'INCR', 'DECR', 'LPUSH', 'RPUSH', 'LPOP', 'RPOP'],
                    datasets: [{
                        label: 'Commands Per Second',
                        data: [1200, 800, 200, 150, 100, 300, 250, 180, 160],
                        backgroundColor: [
                            'rgba(216, 44, 32, 0.7)',
                            'rgba(216, 44, 32, 0.6)',
                            'rgba(216, 44, 32, 0.5)',
                            'rgba(216, 44, 32, 0.4)',
                            'rgba(216, 44, 32, 0.3)',
                            'rgba(216, 44, 32, 0.4)',
                            'rgba(216, 44, 32, 0.5)',
                            'rgba(216, 44, 32, 0.6)',
                            'rgba(216, 44, 32, 0.7)'
                        ],
                        borderColor: [
                            'rgba(216, 44, 32, 1)',
                            'rgba(216, 44, 32, 1)',
                            'rgba(216, 44, 32, 1)',
                            'rgba(216, 44, 32, 1)',
                            'rgba(216, 44, 32, 1)',
                            'rgba(216, 44, 32, 1)',
                            'rgba(216, 44, 32, 1)',
                            'rgba(216, 44, 32, 1)',
                            'rgba(216, 44, 32, 1)'
                        ],
                        borderWidth: 1
                    }]
                },
                options: {
                    responsive: true,
                    maintainAspectRatio: false,
                    plugins: {
                        legend: {
                            display: false
                        },
                        tooltip: {
                            mode: 'index',
                            intersect: false,
                        }
                    },
                    scales: {
                        y: {
                            beginAtZero: true,
                            title: {
                                display: true,
                                text: 'Commands/sec'
                            }
                        }
                    }
                }
            });

            // Mobile menu toggle
            const mobileMenuButton = document.querySelector('[aria-controls="mobile-menu"]');
            const mobileMenu = document.getElementById('mobile-menu');
            
            mobileMenuButton.addEventListener('click', function() {
                const expanded = this.getAttribute('aria-expanded') === 'true';
                this.setAttribute('aria-expanded', !expanded);
                mobileMenu.classList.toggle('hidden');
                
                // Toggle menu icons
                const menuIcon = this.querySelector('i:first-child');
                const closeIcon = this.querySelector('i:last-child');
                menuIcon.classList.toggle('hidden');
                closeIcon.classList.toggle('hidden');
            });
        });
    </script>
</body>
</html>