Spaces:
Running
Running
File size: 30,113 Bytes
6a0e573 e59728f 6a0e573 e59728f 6a0e573 e59728f 6a0e573 0672088 e59728f 0672088 6a0e573 0672088 6a0e573 e59728f 0672088 e59728f 0672088 e59728f 6a0e573 | 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 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 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 | <!DOCTYPE html>
<html lang="en" class="dark">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Admin Panel | CodeForge-AI</title>
<link rel="icon" type="image/x-icon" href="/static/favicon.ico">
<script src="https://cdn.tailwindcss.com"></script>
<script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
<script src="https://unpkg.com/feather-icons"></script>
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
</head>
<body class="bg-gray-900 text-white">
<!-- Navigation -->
<nav class="bg-gray-800 border-b border-purple-500/20 sticky top-0 z-50">
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
<div class="flex justify-between items-center h-16">
<div class="flex items-center space-x-4">
<div class="flex items-center space-x-2">
<div class="w-8 h-8 bg-purple-500 rounded-lg flex items-center justify-center">
<i data-feather="shield" class="w-4 h-4"></i>
</div>
<span class="text-xl font-bold text-white">CodeForge-AI Admin</span>
</div>
<div class="hidden md:flex space-x-6">
<a href="index.html" class="text-gray-300 hover:text-white transition-colors">Home</a>
<a href="dashboard.html" class="text-gray-300 hover:text-white transition-colors">Dashboard</a>
<a href="installation.html" class="text-gray-300 hover:text-white transition-colors">Installation</a>
</div>
</div>
<div class="flex items-center space-x-4">
<div class="text-sm text-gray-300">
Welcome, <span class="text-purple-400 font-semibold">Supreme Admin</span>
</div>
<div class="w-8 h-8 bg-purple-500 rounded-full flex items-center justify-center">
<i data-feather="user" class="w-4 h-4"></i>
</div>
</div>
</div>
</div>
</nav>
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8">
<!-- Admin Stats -->
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6 mb-8">
<div class="bg-gray-800 rounded-2xl p-6 border border-purple-500/20">
<div class="flex items-center justify-between">
<div>
<p class="text-gray-400 text-sm">Total Users</p>
<p class="text-2xl font-bold text-white">1,247</p>
</div>
<div class="w-12 h-12 bg-purple-500/20 rounded-xl flex items-center justify-center">
<i data-feather="users" class="w-6 h-6 text-purple-400"></i>
</div>
</div>
</div>
<div class="bg-gray-800 rounded-2xl p-6 border border-purple-500/20">
<div class="flex items-center justify-between">
<div>
<p class="text-gray-400 text-sm">Active Workspaces</p>
<p class="text-2xl font-bold text-white">892</p>
</div>
<div class="w-12 h-12 bg-purple-500/20 rounded-xl flex items-center justify-center">
<i data-feather="cpu" class="w-6 h-6 text-purple-400"></i>
</div>
</div>
</div>
<div class="bg-gray-800 rounded-2xl p-6 border border-purple-500/20">
<div class="flex items-center justify-between">
<div>
<p class="text-gray-400 text-sm">System Health</p>
<p class="text-2xl font-bold text-green-400">99.9%</p>
</div>
<div class="w-12 h-12 bg-purple-500/20 rounded-xl flex items-center justify-center">
<i data-feather="activity" class="w-6 h-6 text-purple-400"></i>
</div>
</div>
</div>
<div class="bg-gray-800 rounded-2xl p-6 border border-purple-500/20">
<div class="flex items-center justify-between">
<div>
<p class="text-gray-400 text-sm">Total Revenue</p>
<p class="text-2xl font-bold text-white">$42.8K</p>
</div>
<div class="w-12 h-12 bg-purple-500/20 rounded-xl flex items-center justify-center">
<i data-feather="dollar-sign" class="w-6 h-6 text-purple-400"></i>
</div>
</div>
</div>
</div>
<div class="grid grid-cols-1 lg:grid-cols-3 gap-8">
<!-- System Overview -->
<div class="lg:col-span-2">
<!-- User Management -->
<div class="bg-gray-800 rounded-2xl p-6 border border-purple-500/20 mb-8">
<div class="flex justify-between items-center mb-6">
<h2 class="text-xl font-bold text-white">User Management</h2>
<button class="bg-purple-500 hover:bg-purple-600 px-4 py-2 rounded-lg text-white text-sm font-medium transition-colors">
<i data-feather="plus" class="w-4 h-4 inline mr-2"></i>
Add User
</button>
</div>
<div class="overflow-x-auto">
<table class="w-full">
<thead>
<tr class="border-b border-gray-700">
<th class="text-left py-3 text-gray-400 font-semibold">User</th>
<th class="text-left py-3 text-gray-400 font-semibold">Plan</th>
<th class="text-left py-3 text-gray-400 font-semibold">Status</th>
<th class="text-left py-3 text-gray-400 font-semibold">Joined</th>
<th class="text-left py-3 text-gray-400 font-semibold">Actions</th>
</tr>
</thead>
<tbody>
<tr class="border-b border-gray-700/50">
<td class="py-3">
<div class="flex items-center space-x-3">
<div class="w-8 h-8 bg-blue-500 rounded-full flex items-center justify-center">
<i data-feather="user" class="w-4 h-4"></i>
</div>
<div>
<p class="font-semibold text-white">John Developer</p>
<p class="text-gray-400 text-sm">john@example.com</p>
</div>
</div>
</td>
<td class="py-3">
<span class="bg-green-500/20 text-green-400 text-xs px-2 py-1 rounded-full">Pro</span>
</td>
<td class="py-3">
<span class="text-green-400 text-sm">Active</span>
</td>
<td class="py-3 text-gray-300 text-sm">2024-01-15</td>
<td class="py-3">
<div class="flex space-x-2">
<button class="text-blue-400 hover:text-blue-300 transition-colors">
<i data-feather="edit" class="w-4 h-4"></i>
</button>
<button class="text-red-400 hover:text-red-300 transition-colors">
<i data-feather="trash-2" class="w-4 h-4"></i>
</button>
</div>
</td>
</tr>
<tr class="border-b border-gray-700/50">
<td class="py-3">
<div class="flex items-center space-x-3">
<div class="w-8 h-8 bg-green-500 rounded-full flex items-center justify-center">
<i data-feather="user" class="w-4 h-4"></i>
</div>
<div>
<p class="font-semibold text-white">Sarah Coder</p>
<p class="text-gray-400 text-sm">sarah@example.com</p>
</div>
</div>
</td>
<td class="py-3">
<span class="bg-yellow-500/20 text-yellow-400 text-xs px-2 py-1 rounded-full">Starter</span>
</td>
<td class="py-3">
<span class="text-green-400 text-sm">Active</span>
</td>
<td class="py-3 text-gray-300 text-sm">2024-02-03</td>
<td class="py-3">
<div class="flex space-x-2">
<button class="text-blue-400 hover:text-blue-300 transition-colors">
<i data-feather="edit" class="w-4 h-4"></i>
</button>
<button class="text-red-400 hover:text-red-300 transition-colors">
<i data-feather="trash-2" class="w-4 h-4"></i>
</button>
</div>
</td>
</tr>
<tr>
<td class="py-3">
<div class="flex items-center space-x-3">
<div class="w-8 h-8 bg-purple-500 rounded-full flex items-center justify-center">
<i data-feather="user" class="w-4 h-4"></i>
</div>
<div>
<p class="font-semibold text-white">Mike Engineer</p>
<p class="text-gray-400 text-sm">mike@example.com</p>
</div>
</div>
</td>
<td class="py-3">
<span class="bg-gray-500/20 text-gray-400 text-xs px-2 py-1 rounded-full">Free</span>
</td>
<td class="py-3">
<span class="text-red-400 text-sm">Inactive</span>
</td>
<td class="py-3 text-gray-300 text-sm">2024-03-10</td>
<td class="py-3">
<div class="flex space-x-2">
<button class="text-blue-400 hover:text-blue-300 transition-colors">
<i data-feather="edit" class="w-4 h-4"></i>
</button>
<button class="text-red-400 hover:text-red-300 transition-colors">
<i data-feather="trash-2" class="w-4 h-4"></i>
</button>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<!-- System Metrics -->
<div class="bg-gray-800 rounded-2xl p-6 border border-purple-500/20">
<h2 class="text-xl font-bold text-white mb-6">System Performance</h2>
<div class="h-64">
<canvas id="systemChart"></canvas>
</div>
</div>
</div>
<!-- Admin Actions -->
<div class="space-y-8">
<!-- Supreme Admin Controls -->
<div class="bg-gray-800 rounded-2xl p-6 border border-purple-500/20">
<div class="flex items-center space-x-3 mb-4">
<div class="w-10 h-10 bg-purple-500 rounded-xl flex items-center justify-center">
<i data-feather="star" class="w-5 h-5"></i>
</div>
<div>
<h2 class="text-xl font-bold text-white">Supreme Admin</h2>
<p class="text-gray-400 text-sm">Unlimited Access</p>
</div>
</div>
<div class="space-y-4 mb-6">
<div class="bg-purple-500/10 border border-purple-500/30 rounded-xl p-4">
<div class="flex items-center justify-between mb-2">
<span class="text-purple-400 font-semibold">AI Usage</span>
<span class="text-white font-bold">Unlimited</span>
</div>
<div class="w-full bg-gray-700 rounded-full h-2">
<div class="bg-purple-500 h-2 rounded-full" style="width: 15%"></div>
</div>
</div>
<div class="bg-purple-500/10 border border-purple-500/30 rounded-xl p-4">
<div class="flex items-center justify-between mb-2">
<span class="text-purple-400 font-semibold">Workspace Limit</span>
<span class="text-white font-bold">Unlimited</span>
</div>
<div class="w-full bg-gray-700 rounded-full h-2">
<div class="bg-purple-500 h-2 rounded-full" style="width: 8%"></div>
</div>
</div>
<div class="bg-purple-500/10 border border-purple-500/30 rounded-xl p-4">
<div class="flex items-center justify-between mb-2">
<span class="text-purple-400 font-semibold">Deployments</span>
<span class="text-white font-bold">Unlimited</span>
</div>
<div class="w-full bg-gray-700 rounded-full h-2">
<div class="bg-purple-500 h-2 rounded-full" style="width: 12%"></div>
</div>
</div>
</div>
<div class="space-y-3">
<button class="w-full bg-purple-500 hover:bg-purple-600 text-white py-3 rounded-xl font-semibold transition-colors flex items-center justify-center">
<i data-feather="settings" class="w-5 h-5 mr-2"></i>
System Settings
</button>
<button class="w-full bg-red-500 hover:bg-red-600 text-white py-3 rounded-xl font-semibold transition-colors flex items-center justify-center">
<i data-feather="alert-triangle" class="w-5 h-5 mr-2"></i>
Emergency Shutdown
</button>
</div>
</div>
<!-- Recent System Logs -->
<div class="bg-gray-800 rounded-2xl p-6 border border-purple-500/20">
<h2 class="text-xl font-bold text-white mb-4">System Logs</h2>
<div class="space-y-4">
<div class="flex items-start space-x-3">
<div class="w-8 h-8 bg-green-500/20 rounded-full flex items-center justify-center">
<i data-feather="check-circle" class="w-4 h-4 text-green-400"></i>
</div>
<div>
<p class="text-white text-sm">System backup completed successfully</p>
<p class="text-gray-400 text-xs">2 minutes ago</p>
</div>
</div>
<div class="flex items-start space-x-3">
<div class="w-8 h-8 bg-blue-500/20 rounded-full flex items-center justify-center">
<i data-feather="user-plus" class="w-4 h-4 text-blue-400"></i>
</div>
<div>
<p class="text-white text-sm">New user registered: alex@example.com</p>
<p class="text-gray-400 text-xs">15 minutes ago</p>
</div>
</div>
<div class="flex items-start space-x-3">
<div class="w-8 h-8 bg-yellow-500/20 rounded-full flex items-center justify-center">
<i data-feather="alert-triangle" class="w-4 h-4 text-yellow-400"></i>
</div>
<div>
<p class="text-white text-sm">High CPU usage detected on node-3</p>
<p class="text-gray-400 text-xs">1 hour ago</p>
</div>
</div>
<div class="flex items-start space-x-3">
<div class="w-8 h-8 bg-purple-500/20 rounded-full flex items-center justify-center">
<i data-feather="zap" class="w-4 h-4 text-purple-400"></i>
</div>
<div>
<p class="text-white text-sm">AI model training completed</p>
<p class="text-gray-400 text-xs">3 hours ago</p>
</div>
</div>
</div>
</div>
<!-- Quick Stats -->
<div class="bg-gray-800 rounded-2xl p-6 border border-purple-500/20">
<h2 class="text-xl font-bold text-white mb-4">Quick Stats</h2>
<div class="space-y-4">
<div class="flex justify-between items-center">
<span class="text-gray-400">Active Sessions</span>
<span class="text-white font-semibold">347</span>
</div>
<div class="flex justify-between items-center">
<span class="text-gray-400">API Requests</span>
<span class="text-white font-semibold">12.4K</span>
</div>
<div class="flex justify-between items-center">
<span class="text-gray-400">Storage Used</span>
<span class="text-white font-semibold">1.2TB</span>
</div>
<div class="flex justify-between items-center">
<span class="text-gray-400">Error Rate</span>
<span class="text-green-400 font-semibold">0.02%</span>
</div>
</div>
</div>
</div>
</div>
</div>
<script>
// Check if user is logged in as admin
function checkAdminAuth() {
const adminUsername = localStorage.getItem('adminUsername');
const adminPassword = localStorage.getItem('adminPassword');
if (adminUsername !== 'urbanzulu19' || adminPassword !== 'Urbanzulu25') {
window.location.href = 'admin-login.html';
return false;
}
return true;
}
// Initialize Feather Icons
feather.replace();
// Check authentication on page load
if (!checkAdminAuth()) {
// Redirect to login page
window.location.href = 'admin-login.html';
}
// Initialize System Chart
const systemCtx = document.getElementById('systemChart').getContext('2d');
new Chart(systemCtx, {
type: 'line',
data: {
labels: ['00:00', '04:00', '08:00', '12:00', '16:00', '20:00', '24:00'],
datasets: [{
label: 'CPU Usage (%)',
data: [45, 38, 52, 48, 65, 72, 58],
borderColor: '#ef4444',
backgroundColor: 'rgba(239, 68, 68, 0.1)',
tension: 0.4,
fill: true
}, {
label: 'Memory Usage (GB)',
data: [12, 15, 18, 14, 22, 25, 20],
borderColor: '#8b5cf6',
backgroundColor: 'rgba(139, 92, 246, 0.1)',
tension: 0.4,
fill: true
}, {
label: 'Network (MB/s)',
data: [120, 145, 180, 165, 210, 195, 175],
borderColor: '#06b6d4',
backgroundColor: 'rgba(6, 182, 212, 0.1)',
tension: 0.4,
fill: true
}]
},
options: {
responsive: true,
maintainAspectRatio: false,
plugins: {
legend: {
labels: {
color: '#9ca3af'
}
}
},
scales: {
x: {
grid: {
color: '#374151'
},
ticks: {
color: '#9ca3af'
}
},
y: {
grid: {
color: '#374151'
},
ticks: {
color: '#9ca3af'
}
}
}
}
});
// Add User Modal
const addUserModal = document.createElement('div');
addUserModal.className = 'fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 hidden';
addUserModal.innerHTML = `
<div class="bg-gray-800 rounded-2xl p-6 w-full max-w-md border border-purple-500/20">
<div class="flex justify-between items-center mb-4">
<h3 class="text-xl font-bold text-white">Add New User</h3>
<button onclick="closeAddUserModal()" class="text-gray-400 hover:text-white">
<i data-feather="x" class="w-5 h-5"></i>
</button>
</div>
<form id="addUserForm" class="space-y-4">
<div>
<label class="block text-gray-300 text-sm mb-2">Name</label>
<input type="text" id="userName" class="w-full bg-gray-700 border border-gray-600 rounded-lg px-4 py-2 text-white focus:outline-none focus:border-purple-500" required>
</div>
<div>
<label class="block text-gray-300 text-sm mb-2">Email</label>
<input type="email" id="userEmail" class="w-full bg-gray-700 border border-gray-600 rounded-lg px-4 py-2 text-white focus:outline-none focus:border-purple-500" required>
</div>
<div>
<label class="block text-gray-300 text-sm mb-2">Plan</label>
<select id="userPlan" class="w-full bg-gray-700 border border-gray-600 rounded-lg px-4 py-2 text-white focus:outline-none focus:border-purple-500">
<option value="free">Free</option>
<option value="starter">Starter</option>
<option value="pro">Pro</option>
</select>
</div>
<div class="flex justify-end space-x-3 pt-4">
<button type="button" onclick="closeAddUserModal()" class="px-4 py-2 text-gray-300 hover:text-white transition-colors">Cancel</button>
<button type="submit" class="bg-purple-500 hover:bg-purple-600 px-4 py-2 rounded-lg text-white font-medium transition-colors">Add User</button>
</div>
</form>
</div>
`;
document.body.appendChild(addUserModal);
function openAddUserModal() {
addUserModal.classList.remove('hidden');
}
function closeAddUserModal() {
addUserModal.classList.add('hidden');
}
// Handle add user form submission
document.getElementById('addUserForm').addEventListener('submit', function(e) {
e.preventDefault();
const name = document.getElementById('userName').value;
const email = document.getElementById('userEmail').value;
const plan = document.getElementById('userPlan').value;
// In a real app, you would send this to your backend
console.log('Adding user:', { name, email, plan });
// Show success message
alert(`User ${name} added successfully!`);
closeAddUserModal();
// Reset form
document.getElementById('addUserForm').reset();
});
// Logout functionality
document.addEventListener('DOMContentLoaded', function() {
// Add logout button to navigation
const userDiv = document.querySelector('.flex.items-center.space-x-4');
if (userDiv) {
const logoutBtn = document.createElement('button');
logoutBtn.className = 'text-gray-300 hover:text-white transition-colors';
logoutBtn.innerHTML = '<i data-feather="log-out" class="w-5 h-5"></i>';
logoutBtn.title = 'Logout';
logoutBtn.onclick = function() {
localStorage.removeItem('adminUsername');
localStorage.removeItem('adminPassword');
window.location.href = 'admin-login.html';
};
userDiv.appendChild(logoutBtn);
feather.replace();
}
// Add click handler for Add User button
const addUserBtn = document.querySelector('button.bg-purple-500');
if (addUserBtn) {
addUserBtn.onclick = openAddUserModal;
}
// Add edit and delete functionality to user table
const userTable = document.querySelector('table');
if (userTable) {
userTable.addEventListener('click', function(e) {
const target = e.target.closest('button');
if (!target) return;
const row = target.closest('tr');
const userName = row.querySelector('.font-semibold').textContent;
if (target.querySelector('i[data-feather="edit"]')) {
alert(`Edit user: ${userName}`);
} else if (target.querySelector('i[data-feather="trash-2"]')) {
if (confirm(`Are you sure you want to delete ${userName}?`)) {
row.remove();
alert(`User ${userName} deleted successfully!`);
}
}
});
}
// Add functionality to admin action buttons
const systemSettingsBtn = document.querySelector('button:contains("System Settings")');
const emergencyShutdownBtn = document.querySelector('button:contains("Emergency Shutdown")');
if (systemSettingsBtn) {
systemSettingsBtn.onclick = function() {
alert('System settings modal would open here');
};
}
if (emergencyShutdownBtn) {
emergencyShutdownBtn.onclick = function() {
if (confirm('Are you sure you want to perform emergency shutdown? This will affect all users.')) {
alert('Emergency shutdown initiated!');
}
};
}
});
</script>
</body>
</html> |