Add skeleton for pages

This commit is contained in:
mudler
2024-04-07 20:29:33 +02:00
parent 00078b5da8
commit dda993e43b
3 changed files with 101 additions and 0 deletions

32
example/webui/create.html Normal file
View File

@@ -0,0 +1,32 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Create New Agent</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-md mx-auto mt-10">
<h1 class="text-2xl font-bold text-center mb-6">Create New Agent</h1>
<form action="/path/to/your/form/handler" method="POST">
<div class="mb-4">
<label for="agentName" class="block text-sm font-medium text-gray-400">Agent Name</label>
<input type="text" name="agentName" id="agentName" class="mt-1 focus:ring-blue-500 focus:border-blue-500 block w-full shadow-sm sm:text-sm border-gray-300 rounded-md bg-gray-700 text-white" placeholder="Agent Name">
</div>
<div class="mb-4">
<label for="agentType" class="block text-sm font-medium text-gray-400">Agent Type</label>
<select id="agentType" name="agentType" class="mt-1 block w-full pl-3 pr-10 py-2 text-base border-gray-300 focus:outline-none focus:ring-blue-500 focus:border-blue-500 sm:text-sm rounded-md bg-gray-700 text-white">
<option>General</option>
<option>Support</option>
<option>Sales</option>
</select>
</div>
<div class="flex items-center justify-between">
<button type="submit" class="w-full flex justify-center py-2 px-4 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-blue-500 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500">
Create Agent
</button>
</div>
</form>
</div>
</body>
</html>

54
example/webui/index.html Normal file
View File

@@ -0,0 +1,54 @@
<!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">Edit</span>
</th>
</tr>
</thead>
<tbody class="bg-gray-800 divide-y divide-gray-700">
<!-- Dynamic agent rows go here -->
<tr>
<td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-300">Agent 1</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="#" class="text-blue-500 hover:text-blue-400">Edit</a>
</td>
</tr>
<!-- Repeat for each agent -->
</tbody>
</table>
</div>
</div>
</div>
</div>
<div class="mt-6">
<a href="create_agent.html" 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>

View File

@@ -123,6 +123,21 @@ func main() {
// Initialize a new Fiber app
webapp := fiber.New()
// Serve static files
webapp.Static("/", "./public")
webapp.Get("/", func(c fiber.Ctx) error {
return c.Render("index.html", fiber.Map{
"Title": "Hello, World!",
})
})
webapp.Get("/create", func(c fiber.Ctx) error {
return c.Render("create.html", fiber.Map{
"Title": "Hello, World!",
})
})
// Define a route for the GET method on the root path '/'
webapp.Get("/sse", func(c fiber.Ctx) error {
sseManager.Handle(c, NewClient(randStringRunes(10)))