feature: Wire up sites API listing, move add form to separate file

This commit is contained in:
Keith Solomon
2025-05-25 14:51:37 -05:00
parent 4c2576052f
commit 4ba36081d2
6 changed files with 121 additions and 59 deletions

10
views/add-form.ejs Normal file
View File

@@ -0,0 +1,10 @@
<fieldset class="fieldset bg-base-100 rounded-box px-8 py-4 shadow-md">
<legend class="fieldset-legend h3">Start a new test</legend>
<div class="flex gap-0">
<div class="w-fit m-0 p-0">
<input type="text" class="input w-full border-r-0 rounded-r-none" placeholder="Site/URL to test" />
<p class="label">Add either single URL or link to sitemap</p>
</div>
<button type="submit" class="btn btn-info">Test</button>
</div>
</fieldset>

View File

@@ -1,3 +1,59 @@
<h1><%= message %></h1>
<h2><%= error.status %></h2>
<pre><%= error.stack %></pre>
<!DOCTYPE html>
<html>
<head>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Raleway:wght@100..900&display=swap">
<title>
Playwright Dashboard - ERROR
</title>
<link rel='stylesheet' href='/stylesheets/style.css' />
</head>
<body>
<main class="">
<header class="bg-gray-200 w-full">
<div class="container mx-auto flex justify-between items-center text-gray-800 py-4">
<div class="flex items-center">
<!-- <img src="/images/logo.png" alt="Logo" class="h-8 mr-2"> -->
<h1 class="">
Playwright Dashboard - ERROR
</h1>
</div>
<nav>
<ul class="flex space-x-4">
<li><a href="/" class="text-white hover:text-gray-400">Home</a></li>
<li><a href="/about" class="text-white hover:text-gray-400">About</a></li>
<li><a href="/contact" class="text-white hover:text-gray-400">Contact</a></li>
</ul>
</nav>
</div>
</header>
<article class="container mx-auto py-4 min-h-[70dvh]">
<h1><%= message %></h1>
<h2><%= error.status %></h2>
<pre><%= error.stack %></pre>
</article>
<footer class="bg-gray-800 text-white p-4 mt-8">
<div class="container mx-auto text-center">
<div class="flex justify-center gap-8 items-center mb-4">
<p>&copy; <%= new Date().getFullYear() %>
Playwright Dashboard. All rights reserved.</p>
<p>Powered by <a href="https://example.com" class="text-bodylinks">Your Company</a></p>
</div>
<p>
<a href="/privacy" class="text-blue-400">Privacy Policy</a> |
<a href="/terms" class="text-blue-400">Terms of Service</a>
</p>
</div>
</footer>
</main>
</body>
</html>

View File

@@ -3,38 +3,18 @@
<article class="container mx-auto py-4 min-h-[70dvh]">
<h2>Welcome to <%= title %></h2>
<fieldset class="fieldset bg-base-100 rounded-box px-8 py-4 shadow-md">
<legend class="fieldset-legend h3">Start a new test</legend>
<div class="flex gap-0">
<div class="w-fit m-0 p-0">
<input type="text" class="input" placeholder="Type here" />
<p class="label">Add either single URL or link to sitemap</p>
</div>
<button type="submit" class="btn btn-info">Test</button>
</div>
</fieldset>
<%- include('add-form'); -%>
<h2 class="mt-8">Your Tests</h2>
<ul class="list bg-base-100 rounded-box shadow-md mt-8">
<li class="list-row list-none items-center gap-8">
<h3 class="text-slate-300 m-0 p-0"><a href="/test/1" class="text-slate-300 link">Test 1</a></h3>
<span class="site-name list-col-grow text-18px">example.com</span>
<span class="badge badge-info">In Progress</span>
</li>
<li class="list-row list-none items-center gap-8">
<h3 class="text-slate-300 m-0 p-0"><a href="/test/2" class="text-slate-300 link">Test 2</a></h3>
<span class="site-name list-col-grow text-18px">example.com</span>
<span class="badge badge-success">Completed</span>
</li>
<li class="list-row list-none items-center gap-8">
<h3 class="text-slate-300 m-0 p-0"><a href="/test/3" class="text-slate-300 link">Test 3</a></h3>
<span class="site-name list-col-grow text-18px">example.com</span>
<span class="badge badge-error">Failed</span>
</li>
<li class="list-row list-none items-center gap-8">
<h3 class="text-slate-300 m-0 p-0"><a href="/test/4" class="text-slate-300 link">Test 4</a></h3>
<span class="site-name list-col-grow text-18px">example.com</span>
<span class="badge badge-warning">Pending</span>
</li>
<% for (let i=0; i < sites.length; i++) { %>
<li class="list-row list-none items-center gap-8">
<h3 class="text-slate-300 m-0 p-0"><a href="/test/<%= i %>" class="text-slate-300 link">Test <%= i+1 %></a></h3>
<span class="site-name list-col-grow text-18px"><%= sites[i].domain_name %></span>
<span class="badge badge-info">In Progress</span>
</li>
<% } %>
</ul>
</article>