Spaces:
Running
Running
File size: 58,681 Bytes
eac692d 082cc8b eac692d bcd6226 eac692d bcd6226 082cc8b bcd6226 eac692d bcd6226 082cc8b bcd6226 eac692d bcd6226 eac692d bcd6226 eac692d | 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 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 | <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>REST API Manager for PostgreSQL</title>
<script src="https://cdn.tailwindcss.com"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<script>
tailwind.config = {
theme: {
extend: {
colors: {
primary: '#4361ee',
secondary: '#3f37c9',
dark: '#1e293b',
success: '#10b981',
warning: '#f59e0b',
danger: '#ef4444',
info: '#3b82f6'
}
}
}
}
</script>
<style>
:root {
--sidebar-width: 250px;
}
.sidebar {
width: var(--sidebar-width);
transition: all 0.3s;
}
.main-content {
margin-left: var(--sidebar-width);
transition: all 0.3s;
}
.collapsed .sidebar {
width: 60px;
}
.collapsed .main-content {
margin-left: 60px;
}
.table-view {
max-height: calc(100vh - 200px);
overflow-y: auto;
}
.api-method {
width: 80px;
}
.draggable-item {
cursor: move;
}
.swagger-ui {
max-height: calc(100vh - 150px);
overflow-y: auto;
}
@media (max-width: 768px) {
.sidebar {
width: 60px;
}
.main-content {
margin-left: 60px;
}
.collapsed .sidebar {
width: 0;
}
.collapsed .main-content {
margin-left: 0;
}
}
</style>
</head>
<body class="bg-gray-100">
<div id="app" class="min-h-screen flex">
<!-- Sidebar -->
<div class="sidebar bg-dark text-white fixed h-screen overflow-y-auto z-30">
<div class="p-4 border-b border-gray-700 flex items-center">
<i class="fas fa-database text-xl mr-3 text-primary"></i>
<span class="font-bold text-lg">API Manager</span>
</div>
<ul class="mt-5">
<li class="py-3 px-4 hover:bg-gray-700 cursor-pointer flex items-center active">
<i class="fas fa-tachometer-alt mr-3"></i>
<span>Dashboard</span>
</li>
<li class="py-3 px-4 hover:bg-gray-700 cursor-pointer flex items-center">
<i class="fas fa-table mr-3"></i>
<span>Database Tables</span>
</li>
<li class="py-3 px-4 hover:bg-gray-700 cursor-pointer flex items-center">
<i class="fas fa-wrench mr-3"></i>
<span>API Configuration</span>
</li>
<li class="py-3 px-4 hover:bg-gray-700 cursor-pointer flex items-center">
<i class="fas fa-shield-alt mr-3"></i>
<span>Authentication</span>
</li>
<li class="py-3 px-4 hover:bg-gray-700 cursor-pointer flex items-center">
<i class="fas fa-book mr-3"></i>
<span>API Documentation</span>
</li>
<li class="py-3 px-4 hover:bg-gray-700 cursor-pointer flex items-center">
<i class="fas fa-history mr-3"></i>
<span>Request Logs</span>
</li>
<li class="py-3 px-4 hover:bg-gray-700 cursor-pointer flex items-center">
<i class="fas fa-key mr-3"></i>
<span>API Keys</span>
</li>
<li class="py-3 px-4 hover:bg-gray-700 cursor-pointer flex items-center">
<i class="fas fa-users mr-3"></i>
<span>Users</span>
</li>
<li class="py-3 px-4 hover:bg-gray-700 cursor-pointer flex items-center">
<i class="fas fa-database mr-3"></i>
<span>Database Connections</span>
</li>
<li class="py-3 px-4 hover:bg-gray-700 cursor-pointer flex items-center">
<i class="fas fa-cog mr-3"></i>
<span>Settings</span>
</li>
</ul>
</div>
<!-- Main Content -->
<div class="main-content flex-1">
<!-- Header -->
<header class="bg-white shadow py-4 px-6 flex justify-between items-center">
<div>
<button class="p-2 rounded-md hover:bg-gray-200 text-dark">
<i class="fas fa-bars text-xl"></i>
</button>
</div>
<div class="flex items-center">
<div class="relative mr-4">
<i class="fas fa-bell text-xl text-gray-600"></i>
<span class="absolute -top-1 -right-1 bg-danger text-white rounded-full text-xs w-5 h-5 flex items-center justify-center">3</span>
</div>
<div class="flex items-center">
<img src="https://ui-avatars.com/api/?name=Admin&background=4361ee&color=fff" alt="Admin" class="w-8 h-8 rounded-full mr-2">
<span class="hidden md:block">Admin</span>
</div>
</div>
</header>
<!-- Tab Content Container -->
<div id="tab-content" class="p-6">
<!-- Dashboard Content -->
<div id="dashboard-content">
<!-- Status Cards -->
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6 mb-8">
<div class="bg-white p-6 rounded-lg shadow">
<div class="flex justify-between">
<div>
<p class="text-gray-500">Active APIs</p>
<p class="text-2xl font-bold mt-2">14</p>
</div>
<div class="bg-blue-100 w-12 h-12 rounded-full flex items-center justify-center">
<i class="fas fa-plug text-blue-600 text-xl"></i>
</div>
</div>
</div>
<div class="bg-white p-6 rounded-lg shadow">
<div class="flex justify-between">
<div>
<p class="text-gray-500">Monthly Requests</p>
<p class="text-2xl font-bold mt-2">48.2K</p>
</div>
<div class="bg-green-100 w-12 h-12 rounded-full flex items-center justify-center">
<i class="fas fa-chart-line text-green-600 text-xl"></i>
</div>
</div>
</div>
<div class="bg-white p-6 rounded-lg shadow">
<div class="flex justify-between">
<div>
<p class="text-gray-500">API Users</p>
<p class="text-2xl font-bold mt-2">26</p>
</div>
<div class="bg-purple-100 w-12 h-12 rounded-full flex items-center justify-center">
<i class="fas fa-users text-purple-600 text-xl"></i>
</div>
</div>
</div>
<div class="bg-white p-6 rounded-lg shadow">
<div class="flex justify-between">
<div>
<p class="text-gray-500">Errors</p>
<p class="text-2xl font-bold mt-2">12</p>
</div>
<div class="bg-red-100 w-12 h-12 rounded-full flex items-center justify-center">
<i class="fas fa-exclamation-triangle text-red-600 text-xl"></i>
</div>
</div>
</div>
</div>
<!-- API Endpoints -->
<div class="bg-white rounded-lg shadow mb-8">
<div class="p-4 border-b">
<h2 class="text-lg font-semibold">API Endpoints</h2>
</div>
<div class="p-4">
<div class="mb-4">
<input type="text" placeholder="Search endpoints..." class="w-full p-3 border rounded-lg">
</div>
<div class="overflow-x-auto">
<table class="min-w-full">
<thead class="bg-gray-50">
<tr>
<th class="py-3 px-4 text-left">Method</th>
<th class="py-3 px-4 text-left">Endpoint</th>
<th class="py-3 px-4 text-left">Description</th>
<th class="py-3 px-4 text-left">Status</th>
<th class="py-3 px-4 text-left">Actions</th>
</tr>
</thead>
<tbody class="divide-y">
<tr>
<td class="py-3 px-4">
<span class="api-method bg-green-100 text-green-800 py-1 px-2 rounded text-sm">GET</span>
</td>
<td class="py-3 px-4 font-mono">/api/users</td>
<td class="py-3 px-4">Retrieve all users</td>
<td class="py-3 px-4">
<span class="bg-green-100 text-green-800 py-1 px-2 rounded-full text-xs">Active</span>
</td>
<td class="py-3 px-4">
<button class="p-1 text-blue-500 hover:text-blue-700">
<i class="fas fa-edit"></i>
</button>
<button class="p-1 text-red-500 hover:text-red-700">
<i class="fas fa-trash"></i>
</button>
</td>
</tr>
<tr>
<td class="py-3 px-4">
<span class="api-method bg-green-100 text-green-800 py-1 px-2 rounded text-sm">GET</span>
</td>
<td class="py-3 px-4 font-mono">/api/products</td>
<td class="py-3 px-4">Retrieve all products</td>
<td class="py-3 px-4">
<span class="bg-green-100 text-green-800 py-1 px-2 rounded-full text-xs">Active</span>
</td>
<td class="py-3 px-4">
<button class="p-1 text-blue-500 hover:text-blue-700">
<i class="fas fa-edit"></i>
</button>
<button class="p-1 text-red-500 hover:text-red-700">
<i class="fas fa-trash"></i>
</button>
</td>
</tr>
<tr>
<td class="py-3 px-4">
<span class="api-method bg-green-100 text-green-800 py-1 px-2 rounded text-sm">GET</span>
</td>
<td class="py-3 px-4 font-mono">/api/orders</td>
<td class="py-3 px-4">Retrieve all orders</td>
<td class="py-3 px-4">
<span class="bg-green-100 text-green-800 py-1 px-2 rounded-full text-xs">Active</span>
</td>
<td class="py-3 px-4">
<button class="p-1 text-blue-500 hover:text-blue-700">
<i class="fas fa-edit"></i>
</button>
<button class="p-1 text-red-500 hover:text-red-700">
<i class="fas fa-trash"></i>
</button>
</td>
</tr>
<tr>
<td class="py-3 px-4">
<span class="api-method bg-blue-100 text-blue-800 py-1 px-2 rounded text-sm">GET</span>
</td>
<td class="py-3 px-4 font-mono">/api/orders/{id}</td>
<td class="py-3 px-4">Retrieve order details</td>
<td class="py-3 px-4">
<span class="bg-yellow-100 text-yellow-800 py-1 px-2 rounded-full text-xs">Draft</span>
</td>
<td class="py-3 px-4">
<button class="p-1 text-blue-500 hover:text-blue-700">
<i class="fas fa-edit"></i>
</button>
<button class="p-1 text-red-500 hover:text-red-700">
<i class="fas fa-trash"></i>
</button>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<!-- Recent Activity -->
<div class="grid grid-cols-1 lg:grid-cols-2 gap-6">
<div class="bg-white rounded-lg shadow">
<div class="p-4 border-b">
<h2 class="text-lg font-semibold">Recent Activity</h2>
</div>
<div class="p-4">
<div class="space-y-4">
<div class="flex items-start">
<div class="bg-blue-100 p-2 rounded-full mr-3">
<i class="fas fa-plus text-blue-600"></i>
</div>
<div class="flex-1">
<p class="font-medium">New endpoint created</p>
<p class="text-gray-600 text-sm">/api/products endpoint was added</p>
<p class="text-gray-400 text-xs">2 hours ago</p>
</div>
</div>
<div class="flex items-start">
<div class="bg-green-100 p-2 rounded-full mr-3">
<i class="fas fa-check text-green-600"></i>
</div>
<div class="flex-1">
<p class="font-medium">Endpoint activated</p>
<p class="text-gray-600 text-sm">/api/users endpoint is now active</p>
<p class="text-gray-400 text-xs">5 hours ago</p>
</div>
</div>
<div class="flex items-start">
<div class="bg-red-100 p-2 rounded-full mr-3">
<i class="fas fa-exclamation text-red-600"></i>
</div>
<div class="flex-1">
<p class="font-medium">High traffic detected</p>
<p class="text-gray-600 text-sm">/api/orders received 1240 requests in last hour</p>
<p class="text-gray-400 text-xs">Yesterday</p>
</div>
</div>
<div class="flex items-start">
<div class="bg-yellow-100 p-2 rounded-full mr-3">
<i class="fas fa-cog text-yellow-600"></i>
</div>
<div class="flex-1">
<p class="font-medium">Configuration updated</p>
<p class="text-gray-600 text-sm">Caching settings for products were modified</p>
<p class="text-gray-400 text-xs">2 days ago</p>
</div>
</div>
</div>
</div>
</div>
<!-- API Performance -->
<div class="bg-white rounded-lg shadow">
<div class="p-4 border-b">
<h2 class="text-lg font-semibold">API Performance</h2>
</div>
<div class="p-4">
<div class="flex items-center justify-between mb-4">
<p>Response Times (ms)</p>
<div class="flex">
<button class="text-xs px-2 py-1 bg-gray-100 rounded-l">24h</button>
<button class="text-xs px-2 py-1 bg-primary text-white rounded-r">7d</button>
</div>
</div>
<div class="h-48 bg-gray-100 rounded flex items-center justify-center mb-4">
<div class="text-center">
<i class="fas fa-chart-bar text-4xl text-gray-300 mb-2"></i>
<p class="text-gray-500">Performance chart</p>
</div>
</div>
<div class="space-y-2">
<div class="flex justify-between">
<div>
<span class="inline-block w-3 h-3 bg-primary rounded-full mr-2"></span>
<span>Average Response</span>
</div>
<span>142 ms</span>
</div>
<div class="flex justify-between">
<div>
<span class="inline-block w-3 h-3 bg-success rounded-full mr-2"></span>
<span>Success Rate</span>
</div>
<span>98.4%</span>
</div>
<div class="flex justify-between">
<div>
<span class="inline-block w-3 h-3 bg-danger rounded-full mr-2"></span>
<span>Error Rate</span>
</div>
<span>1.6%</span>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Database Tables Content -->
<div id="tables-content" class="hidden">
<div class="p-6">
<div class="flex justify-between items-center mb-6">
<h1 class="text-2xl font-bold">Database Tables</h1>
<button class="px-4 py-2 bg-primary text-white rounded-md hover:bg-secondary">
Create New Table
</button>
</div>
<div class="bg-white rounded-lg shadow overflow-hidden mb-8">
<div class="p-4 border-b flex justify-between items-center">
<h2 class="text-lg font-semibold">Available Tables</h2>
<input type="text" placeholder="Search tables..." class="p-2 border rounded-lg w-64">
</div>
<div class="overflow-x-auto">
<table class="min-w-full">
<thead class="bg-gray-50">
<tr>
<th class="py-3 px-4 text-left">Table Name</th>
<th class="py-3 px-4 text-left">Columns</th>
<th class="py-3 px-4 text-left">API Endpoint</th>
<th class="py-3 px-4 text-left">Status</th>
<th class="py-3 px-4 text-left">Actions</th>
</tr>
</thead>
<tbody class="divide-y">
<tr>
<td class="py-3 px-4 font-medium">users</td>
<td class="py-3 px-4">5</td>
<td class="py-3 px-4 font-mono">/api/users</td>
<td class="py-3 px-4">
<span class="bg-green-100 text-green-800 py-1 px-2 rounded-full text-xs">Active</span>
</td>
<td class="py-3 px-4 space-x-2">
<button class="p-1 text-blue-500 hover:text-blue-700 edit-table-btn" data-table="users">
<i class="fas fa-edit"></i>
</button>
<button class="p-1 text-red-500 hover:text-red-700">
<i class="fas fa-trash"></i>
</button>
</td>
</tr>
<tr>
<td class="py-3 px-4 font-medium">products</td>
<td class="py-3 px-4">6</td>
<td class="py-3 px-4 font-mono">/api/products</td>
<td class="py-3 px-4">
<span class="bg-green-100 text-green-800 py-1 px-2 rounded-full text-xs">Active</span>
</td>
<td class="py-3 px-4 space-x-2">
<button class="p-1 text-blue-500 hover:text-blue-700 edit-table-btn" data-table="products">
<i class="fas fa-edit"></i>
</button>
<button class="p-1 text-red-500 hover:text-red-700">
<i class="fas fa-trash"></i>
</button>
</td>
</tr>
<tr>
<td class="py-3 px-4 font-medium">orders</td>
<td class="py-3 px-4">6</td>
<td class="py-3 px-4 font-mono">/api/orders</td>
<td class="py-3 px-4">
<span class="bg-yellow-100 text-yellow-800 py-1 px-2 rounded-full text-xs">Draft</span>
</td>
<td class="py-3 px-4 space-x-2">
<button class="p-1 text-blue-500 hover:text-blue-700 edit-table-btn" data-table="orders">
<i class="fas fa-edit"></i>
</button>
<button class="p-1 text-red-500 hover:text-red-700">
<i class="fas fa-trash"></i>
</button>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
<div id="api-config-content">
<!-- API Configuration Content -->
<div id="api-config-content" >
<div class="p-6">
<h1 class="text-2xl font-bold mb-6">API Configuration</h1>
<div class="grid grid-cols-1 md:grid-cols-2 gap-8">
<!-- Global Settings -->
<div class="bg-gray-50 p-6 rounded-lg">
<h2 class="text-lg font-semibold mb-4 border-b pb-2">Global Settings</h2>
<div class="space-y-4">
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">Base Path</label>
<input type="text" value="/api" class="w-full p-2 border rounded focus:ring-2 focus:ring-primary focus:border-transparent">
<p class="text-xs text-gray-500 mt-1">The base path for all API endpoints</p>
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">Default Limit</label>
<input type="number" value="100" class="w-full p-2 border rounded focus:ring-2 focus:ring-primary focus:border-transparent">
<p class="text-xs text-gray-500 mt-1">Default number of items returned per request</p>
</div>
<div class="flex items-center">
<input type="checkbox" id="enable-caching" class="h-4 w-4 text-primary focus:ring-primary border-gray-300 rounded" checked>
<label for="enable-caching" class="ml-2 block text-sm text-gray-700">Enable Response Caching</label>
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">Cache Duration (seconds)</label>
<input type="number" value="300" class="w-full p-2 border rounded focus:ring-2 focus:ring-primary focus:border-transparent">
</div>
</div>
</div>
<!-- Security Settings -->
<div class="bg-gray-50 p-6 rounded-lg">
<h2 class="text-lg font-semibold mb-4 border-b pb-2">Security Settings</h2>
<div class="space-y-4">
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">Authentication Method</label>
<select class="w-full p-2 border rounded focus:ring-2 focus:ring-primary focus:border-transparent">
<option>JWT</option>
<option>API Key</option>
<option>OAuth 2.0</option>
<option>Basic Auth</option>
<option>None</option>
</select>
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">CORS Origins</label>
<input type="text" value="*" class="w-full p-2 border rounded focus:ring-2 focus:ring-primary focus:border-transparent">
<p class="text-xs text-gray-500 mt-1">Comma-separated list of allowed origins</p>
</div>
<div class="flex items-center">
<input type="checkbox" id="enable-https" class="h-4 w-4 text-primary focus:ring-primary border-gray-300 rounded" checked>
<label for="enable-https" class="ml-2 block text-sm text-gray-700">Require HTTPS</label>
</div>
<div class="flex items-center">
<input type="checkbox" id="enable-rate-limiting" class="h-4 w-4 text-primary focus:ring-primary border-gray-300 rounded" checked>
<label for="enable-rate-limiting" class="ml-2 block text-sm text-gray-700">Enable Rate Limiting</label>
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">Rate Limit (requests/minute)</label>
<input type="number" value="1000" class="w-full p-2 border rounded focus:ring-2 focus:ring-primary focus:border-transparent">
</div>
</div>
</div>
<!-- Logging Settings -->
<div class="bg-gray-50 p-6 rounded-lg">
<h2 class="text-lg font-semibold mb-4 border-b pb-2">Logging & Monitoring</h2>
<div class="space-y-4">
<div class="flex items-center">
<input type="checkbox" id="enable-request-logging" class="h-4 w-4 text-primary focus:ring-primary border-gray-300 rounded" checked>
<label for="enable-request-logging" class="ml-2 block text-sm text-gray-700">Enable Request Logging</label>
</div>
<div class="flex items-center">
<input type="checkbox" id="enable-error-logging" class="h-4 w-4 text-primary focus:ring-primary border-gray-300 rounded" checked>
<label for="enable-error-logging" class="ml-2 block text-sm text-gray-700">Enable Error Logging</label>
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">Log Retention (days)</label>
<input type="number" value="30" class="w-full p-2 border rounded focus:ring-2 focus:ring-primary focus:border-transparent">
</div>
</div>
</div>
<!-- Response Settings -->
<div class="bg-gray-50 p-6 rounded-lg">
<h2 class="text-lg font-semibold mb-4 border-b pb-2">Response Settings</h2>
<div class="space-y-4">
<div class="flex items-center">
<input type="checkbox" id="enable-pretty-print" class="h-4 w-4 text-primary focus:ring-primary border-gray-300 rounded" checked>
<label for="enable-pretty-print" class="ml-2 block text-sm text-gray-700">Pretty Print JSON</label>
</div>
<div class="flex items-center">
<input type="checkbox" id="include-timestamps" class="h-4 w-4 text-primary focus:ring-primary border-gray-300 rounded">
<label for="include-timestamps" class="ml-2 block text-sm text-gray-700">Include Timestamps</label>
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">Default Response Format</label>
<select class="w-full p-2 border rounded focus:ring-2 focus:ring-primary focus:border-transparent">
<option>JSON</option>
<option>XML</option>
</select>
</div>
</div>
</div>
</div>
<div class="mt-8 flex justify-end space-x-4">
<button class="px-4 py-2 border border-gray-300 rounded-md text-gray-700 bg-white hover:bg-gray-50">
Reset to Defaults
</button>
<button class="px-4 py-2 bg-primary text-white rounded-md hover:bg-secondary focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary">
Save Changes
</button>
</div>
</div>
</div>
</div>
<!-- Database Connections Content -->
<div id="db-connections-content" class="hidden">
<div class="p-6">
<h1 class="text-2xl font-bold mb-6">Database Connection Settings</h1>
<div class="bg-white rounded-lg shadow mb-8">
<div class="p-4 border-b">
<h2 class="text-lg font-semibold">Current Connections</h2>
</div>
<div class="p-4">
<div class="overflow-x-auto">
<table class="min-w-full">
<thead class="bg-gray-50">
<tr>
<th class="py-3 px-4 text-left">Name</th>
<th class="py-3 px-4 text-left">Type</th>
<th class="py-3 px-4 text-left">Host</th>
<th class="py-3 px-4 text-left">Database</th>
<th class="py-3 px-4 text-left">Status</th>
<th class="py-3 px-4 text-left">Actions</th>
</tr>
</thead>
<tbody class="divide-y">
<tr>
<td class="py-3 px-4 font-medium">Primary DB</td>
<td class="py-3 px-4">PostgreSQL</td>
<td class="py-3 px-4">localhost:5432</td>
<td class="py-3 px-4">app_production</td>
<td class="py-3 px-4">
<span class="bg-green-100 text-green-800 py-1 px-2 rounded-full text-xs">Connected</span>
</td>
<td class="py-3 px-4 space-x-2">
<button class="p-1 text-blue-500 hover:text-blue-700">
<i class="fas fa-edit"></i>
</button>
<button class="p-1 text-red-500 hover:text-red-700">
<i class="fas fa-trash"></i>
</button>
<button class="p-1 text-gray-500 hover:text-gray-700">
<i class="fas fa-sync-alt"></i>
</button>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div class="bg-white rounded-lg shadow">
<div class="p-4 border-b">
<h2 class="text-lg font-semibold">Add New Connection</h2>
</div>
<div class="p-4">
<form class="space-y-4">
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">Connection Name</label>
<input type="text" class="w-full p-2 border rounded focus:ring-2 focus:ring-primary">
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">Database Type</label>
<select class="w-full p-2 border rounded focus:ring-2 focus:ring-primary">
<option>PostgreSQL</option>
<option>MySQL</option>
<option>SQL Server</option>
<option>Oracle</option>
<option>SQLite</option>
</select>
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">Host</label>
<input type="text" placeholder="localhost" class="w-full p-2 border rounded focus:ring-2 focus:ring-primary">
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">Port</label>
<input type="number" placeholder="5432" class="w-full p-2 border rounded focus:ring-2 focus:ring-primary">
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">Database Name</label>
<input type="text" class="w-full p-2 border rounded focus:ring-2 focus:ring-primary">
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">Username</label>
<input type="text" class="w-full p-2 border rounded focus:ring-2 focus:ring-primary">
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">Password</label>
<input type="password" class="w-full p-2 border rounded focus:ring-2 focus:ring-primary">
</div>
<div class="md:col-span-2">
<label class="block text-sm font-medium text-gray-700 mb-1">Connection String</label>
<input type="text" placeholder="postgresql://user:pass@host:port/db" class="w-full p-2 border rounded focus:ring-2 focus:ring-primary">
</div>
</div>
<div class="flex items-center space-x-4 pt-4">
<button type="button" class="px-4 py-2 bg-primary text-white rounded-md hover:bg-secondary">
Test Connection
</button>
<button type="submit" class="px-4 py-2 bg-success text-white rounded-md hover:bg-green-700">
Save Connection
</button>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Edit Table Modal -->
<div id="edit-table-modal" class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 hidden">
<div class="bg-white rounded-lg shadow-xl w-full max-w-2xl">
<div class="p-4 border-b flex justify-between items-center">
<h3 class="text-lg font-semibold">Edit Table: <span id="edit-table-name"></span></h3>
<button id="close-edit-modal" class="text-gray-500 hover:text-gray-700">
<i class="fas fa-times"></i>
</button>
</div>
<div class="p-6">
<div class="mb-6">
<h4 class="font-medium mb-3">Table Settings</h4>
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">Table Name</label>
<input type="text" class="w-full p-2 border rounded" value="users">
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">API Endpoint</label>
<input type="text" class="w-full p-2 border rounded" value="/api/users">
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">Status</label>
<select class="w-full p-2 border rounded">
<option>Active</option>
<option>Draft</option>
<option>Disabled</option>
</select>
</div>
</div>
</div>
<div class="mb-6">
<div class="flex justify-between items-center mb-3">
<h4 class="font-medium">Columns</h4>
<button class="text-sm text-primary hover:text-secondary">
<i class="fas fa-plus mr-1"></i> Add Column
</button>
</div>
<div class="overflow-x-auto">
<table class="min-w-full">
<thead class="bg-gray-50">
<tr>
<th class="py-2 px-3 text-left">Name</th>
<th class="py-2 px-3 text-left">Type</th>
<th class="py-2 px-3 text-left">Nullable</th>
<th class="py-2 px-3 text-left">Default</th>
<th class="py-2 px-3 text-left">Actions</th>
</tr>
</thead>
<tbody class="divide-y">
<tr>
<td class="py-2 px-3"><input type="text" class="p-1 border rounded w-full" value="id"></td>
<td class="py-2 px-3">
<select class="p-1 border rounded w-full">
<option>integer</option>
<option selected>serial</option>
<option>varchar</option>
<option>text</option>
<option>boolean</option>
<option>timestamp</option>
</select>
</td>
<td class="py-2 px-3">
<input type="checkbox" class="h-4 w-4" checked>
</td>
<td class="py-2 px-3"><input type="text" class="p-1 border rounded w-full" placeholder="None"></td>
<td class="py-2 px-3">
<button class="text-red-500 hover:text-red-700">
<i class="fas fa-trash"></i>
</button>
</td>
</tr>
<tr>
<td class="py-2 px-3"><input type="text" class="p-1 border rounded w-full" value="username"></td>
<td class="py-2 px-3">
<select class="p-1 border rounded w-full">
<option>integer</option>
<option>serial</option>
<option selected>varchar(50)</option>
<option>text</option>
<option>boolean</option>
<option>timestamp</option>
</select>
</td>
<td class="py-2 px-3">
<input type="checkbox" class="h-4 w-4">
</td>
<td class="py-2 px-3"><input type="text" class="p-1 border rounded w-full" placeholder="None"></td>
<td class="py-2 px-3">
<button class="text-red-500 hover:text-red-700">
<i class="fas fa-trash"></i>
</button>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="flex justify-end space-x-3">
<button class="px-4 py-2 border border-gray-300 rounded-md text-gray-700 bg-white hover:bg-gray-50">
Cancel
</button>
<button class="px-4 py-2 bg-primary text-white rounded-md hover:bg-secondary">
Save Changes
</button>
</div>
</div>
</div>
</div>
<script>
// Mock database tables for demonstration
const databaseTables = [
{
name: 'users',
columns: [
{name: 'id', type: 'integer', primaryKey: true},
{name: 'username', type: 'varchar(50)'},
{name: 'email', type: 'varchar(100)'},
{name: 'created_at', type: 'timestamp'},
{name: 'role', type: 'varchar(20)'}
],
endpoint: '/api/users',
status: 'active'
},
{
name: 'products',
columns: [
{name: 'id', type: 'integer', primaryKey: true},
{name: 'name', type: 'varchar(255)'},
{name: 'price', type: 'numeric(10,2)'},
{name: 'category', type: 'varchar(50)'},
{name: 'stock', type: 'integer'},
{name: 'created_at', type: 'timestamp'}
],
endpoint: '/api/products',
status: 'active'
},
{
name: 'orders',
columns: [
{name: 'id', type: 'integer', primaryKey: true},
{name: 'user_id', type: 'integer', foreignKey: 'users.id'},
{name: 'product_id', type: 'integer', foreignKey: 'products.id'},
{name: 'quantity', type: 'integer'},
{name: 'total_price', type: 'numeric(10,2)'},
{name: 'created_at', type: 'timestamp'}
],
endpoint: '/api/orders',
status: 'draft'
}
];
// Mock API endpoints
const apiEndpoints = [
{
method: 'GET',
path: '/api/users',
description: 'Retrieve all users',
status: 'active',
filters: ['id', 'username', 'email', 'role'],
sorting: ['id', 'username', 'created_at'],
authentication: 'JWT'
},
{
method: 'GET',
path: '/api/products',
description: 'Retrieve all products',
status: 'active',
filters: ['id', 'name', 'category', 'price'],
sorting: ['id', 'name', 'price'],
authentication: 'API Key'
},
{
method: 'GET',
path: '/api/orders',
description: 'Retrieve all orders',
status: 'draft',
filters: ['id', 'user_id', 'product_id'],
sorting: ['id', 'created_at'],
authentication: 'JWT'
}
];
// Mock users for demonstration
const users = [
{id: 1, username: 'admin', role: 'Administrator', email: 'admin@company.com', createdAt: '2023-05-12'},
{id: 2, username: 'manager', role: 'Manager', email: 'manager@company.com', createdAt: '2023-06-01'},
{id: 3, username: 'developer', role: 'Developer', email: 'dev@company.com', createdAt: '2023-07-15'},
{id: 4, username: 'client1', role: 'Client', email: 'client1@business.com', createdAt: '2023-08-20'},
];
// Mock API keys
const apiKeys = [
{id: 1, key: 'a1b2c3d4e5f6', name: 'Mobile App', status: 'active', rateLimit: 1000, permissions: ['read:users', 'read:products']},
{id: 2, key: 'x7y8z9abcdef', name: 'Web Dashboard', status: 'active', rateLimit: 5000, permissions: ['read:all']},
{id: 3, key: 'ghijklmnopqr', name: 'Internal Script', status: 'inactive', rateLimit: 100, permissions: ['read:orders']},
];
// Initialize sidebar toggling
document.addEventListener('DOMContentLoaded', function() {
const sidebarToggle = document.querySelector('header button');
const app = document.getElementById('app');
sidebarToggle.addEventListener('click', function() {
app.classList.toggle('collapsed');
});
// Initialize tab switching
const sidebarItems = document.querySelectorAll('.sidebar li');
const tabContents = {
'Dashboard': 'dashboard-content',
'Database Tables': 'tables-content',
'API Configuration': 'api-config-content',
'Authentication': 'auth-content',
'API Documentation': 'docs-content',
'Request Logs': 'logs-content',
'API Keys': 'keys-content',
'Users': 'users-content',
'Database Connections': 'db-connections-content',
'Settings': 'settings-content'
};
sidebarItems.forEach(item => {
item.addEventListener('click', function() {
sidebarItems.forEach(i => i.classList.remove('active'));
this.classList.add('active');
const tabName = this.querySelector('span').textContent;
const contentId = tabContents[tabName];
// Hide all content
document.querySelectorAll('#tab-content > div').forEach(div => {
div.classList.add('hidden');
});
// Show selected content
if (contentId) {
document.getElementById(contentId).classList.remove('hidden');
}
});
});
// Initialize with dashboard visible
document.getElementById('dashboard-content').classList.remove('hidden');
// Table edit modal handling
const editModal = document.getElementById('edit-table-modal');
const editTableName = document.getElementById('edit-table-name');
const closeEditModal = document.getElementById('close-edit-modal');
document.querySelectorAll('.edit-table-btn').forEach(btn => {
btn.addEventListener('click', function() {
const tableName = this.getAttribute('data-table');
editTableName.textContent = tableName;
editModal.classList.remove('hidden');
});
});
closeEditModal.addEventListener('click', function() {
editModal.classList.add('hidden');
});
// Close modal when clicking outside
editModal.addEventListener('click', function(e) {
if (e.target === editModal) {
editModal.classList.add('hidden');
}
});
});
</script>
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=Pervyh/api-manager" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
</html> |