Add admin panel API with CRUD for apps
- Express.js backend with JWT authentication - CRUD endpoints for apps management - Health check endpoint - Dockerfile per admin API (Node 18 Alpine) - Kubernetes: admin-api deployment, service, ingress - Admin panel at http://admin.apps.local - Updated nginx.conf to route /api to admin API - Fixed ingress rules for separate web and admin services
This commit is contained in:
111
frontend/admin.html
Normal file
111
frontend/admin.html
Normal file
@@ -0,0 +1,111 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="it">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Admin - Linux App Store</title>
|
||||
<script src="https://cdn.tailwindcss.com"></script>
|
||||
<script>
|
||||
tailwind.config = {
|
||||
theme: { extend: { colors: { gray: { 850: '#1f2937', 900: '#111827' } } } }
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body class="bg-gray-900 text-white">
|
||||
<nav class="bg-gray-850 border-b border-gray-700">
|
||||
<div class="max-w-7xl mx-auto px-4">
|
||||
<div class="flex items-center h-16">
|
||||
<i class="fas fa-cog text-purple-500 text-xl mr-3"></i>
|
||||
<span class="text-xl font-bold">Admin Panel</span>
|
||||
<span id="user-status" class="ml-auto hidden text-sm text-gray-400"></span>
|
||||
<button onclick="logout()" class="ml-4 px-3 py-1 text-sm bg-red-600 hover:bg-red-700 rounded">Logout</button>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<main class="max-w-7xl mx-auto px-4 py-8">
|
||||
<div id="login-section" class="max-w-md mx-auto mt-20">
|
||||
<div class="bg-gray-850 rounded-xl p-8 shadow-2xl">
|
||||
<h2 class="text-2xl font-bold mb-6 text-center">Accesso Amministratore</h2>
|
||||
<div id="error-message" class="hidden bg-red-900 text-red-200 px-4 py-3 rounded mb-4"></div>
|
||||
<div class="space-y-4">
|
||||
<div>
|
||||
<label class="block text-sm font-medium mb-1">Token Admin</label>
|
||||
<input type="password" id="admin-token" class="w-full bg-gray-900 border border-gray-700 rounded px-3 py-2 focus:ring-2 focus:ring-purple-500 focus:border-transparent">
|
||||
</div>
|
||||
<button onclick="login()" class="w-full bg-purple-600 hover:bg-purple-700 text-white font-bold py-2 px-4 rounded transition">
|
||||
Accedi
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="admin-section" class="hidden">
|
||||
<div class="flex justify-between items-center mb-6">
|
||||
<h2 class="text-3xl font-bold">Gestione Applicazioni</h2>
|
||||
<button onclick="showAddForm()" class="bg-green-600 hover:bg-green-700 text-white font-bold py-2 px-6 rounded-lg transition shadow-lg">
|
||||
<i class="fas fa-plus mr-2"></i>Aggiungi App
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div id="apps-list" class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
|
||||
<!-- Add/Edit Form Modal -->
|
||||
<div id="app-form-modal" class="hidden fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center p-4 z-50">
|
||||
<div class="bg-gray-850 rounded-xl p-6 w-full max-w-2xl max-h-[90vh] overflow-y-auto shadow-2xl">
|
||||
<h3 class="text-2xl font-bold mb-4" id="form-title">Aggiungi Applicazione</h3>
|
||||
<form id="app-form" onsubmit="saveApp(event)">
|
||||
<input type="hidden" id="app-id">
|
||||
<div class="grid grid-cols-2 gap-4 mb-4">
|
||||
<div>
|
||||
<label class="block text-sm font-medium mb-1">ID Unico</label>
|
||||
<input type="text" id="app-id-input" required class="w-full bg-gray-900 border border-gray-700 rounded px-3 py-2">
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-sm font-medium mb-1">Nome</label>
|
||||
<input type="text" id="app-name" required class="w-full bg-gray-900 border border-gray-700 rounded px-3 py-2">
|
||||
</div>
|
||||
</div>
|
||||
<div class="mb-4">
|
||||
<label class="block text-sm font-medium mb-1">Descrizione</label>
|
||||
<textarea id="app-description" required class="w-full bg-gray-900 border border-gray-700 rounded px-3 py-2 h-24"></textarea>
|
||||
</div>
|
||||
<div class="grid grid-cols-3 gap-4 mb-4">
|
||||
<div>
|
||||
<label class="block text-sm font-medium mb-1">Icona (Font Awesome)</label>
|
||||
<input type="text" id="app-icon" placeholder="fa-volume-up" class="w-full bg-gray-900 border border-gray-700 rounded px-3 py-2">
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-sm font-medium mb-1">Colori Gradient</label>
|
||||
<input type="text" id="app-colors" placeholder="from-purple-500 to-indigo-600" class="w-full bg-gray-900 border border-gray-700 rounded px-3 py-2">
|
||||
</div>
|
||||
</div>
|
||||
<div class="space-y-2 mb-4">
|
||||
<label class="block text-sm font-medium">Pacchetti</label>
|
||||
<div>
|
||||
<label class="text-xs text-gray-500">APT Package</label>
|
||||
<input type="text" id="app-apt" class="w-full bg-gray-900 border border-gray-700 rounded px-3 py-2 text-sm">
|
||||
</div>
|
||||
<div>
|
||||
<label class="text-xs text-gray-500">AppStream ID</label>
|
||||
<input type="text" id="app-appstream" class="w-full bg-gray-900 border border-gray-700 rounded px-3 py-2 text-sm">
|
||||
</div>
|
||||
<div>
|
||||
<label class="text-xs text-gray-500">Flatpak URL</label>
|
||||
<input type="text" id="app-flatpak" class="w-full bg-gray-900 border border-gray-700 rounded px-3 py-2 text-sm">
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex justify-end space-x-3">
|
||||
<button type="button" onclick="closeForm()" class="px-4 py-2 text-gray-300 hover:text-white transition">Annulla</button>
|
||||
<button type="submit" class="px-6 py-2 bg-green-600 hover:bg-green-700 text-white font-bold rounded transition">Salva</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="admin.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user