Spaces:
Running
Running
Download index.html from Pervyh/api-manager: direct link, hf CLI and curl.
- Browser
- Download file 58.7 kB
-
https://huggingface.co/spaces/Pervyh/api-manager/resolve/main/index.html
- Command line
-
hf download hf://spaces/Pervyh/api-manager/index.html
-
curl -L -o index.html https://huggingface.co/spaces/Pervyh/api-manager/resolve/main/index.html
58.7 kB
| <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> |