Add an index

This commit is contained in:
mudler
2024-04-10 19:40:39 +02:00
parent 7c70f09834
commit 82ac74ac5d
7 changed files with 111 additions and 77 deletions

63
example/webui/agents.html Normal file
View File

@@ -0,0 +1,63 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Agent List</title>
<link href="https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css" rel="stylesheet">
</head>
<body class="bg-gray-900 p-4 text-white">
<div class="max-w-6xl mx-auto">
<div class="text-center mb-6">
<h1 class="text-2xl font-bold">Smart Agent List</h1>
</div>
<div class="flex flex-col">
<div class="-my-2 overflow-x-auto sm:-mx-6 lg:-mx-8">
<div class="py-2 align-middle inline-block min-w-full sm:px-6 lg:px-8">
<div class="shadow overflow-hidden border-b border-gray-700 sm:rounded-lg">
<table class="min-w-full divide-y divide-gray-700">
<thead class="bg-gray-700">
<tr>
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-400 uppercase tracking-wider">
Name
</th>
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-400 uppercase tracking-wider">
Status
</th>
<th scope="col" class="relative px-6 py-3">
<span class="sr-only">Talk</span>
</th>
<th scope="col" class="relative px-6 py-3">
<span class="sr-only">Delete</span>
</th>
</tr>
</thead>
<tbody class="bg-gray-800 divide-y divide-gray-700">
<!-- Dynamic agent rows go here -->
{{ range .Agents }}
<tr>
<td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-300">{{.}}</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-300">Online</td>
<td class="px-6 py-4 whitespace-nowrap text-right text-sm font-medium">
<a href="/talk/{{.}}" class="text-blue-500 hover:text-blue-400">Talk</a>
</td>
<td class="px-6 py-4 whitespace-nowrap text-right text-sm font-medium">
<a href="/delete/{{.}}" class="text-blue-500 hover:text-blue-400">Delete</a>
</td>
</tr>
{{ end }}
<!-- Repeat for each agent -->
</tbody>
</table>
</div>
</div>
</div>
</div>
<div class="mt-6">
<a href="/create" class="bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded">
Add New Agent
</a>
</div>
</div>
</body>
</html>