FCORD / templates /index.html
Fred808's picture
Create index.html
e5b0ce2 verified
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Flow Server {{ flow_id }} - Control Panel</title>
<style>
body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
margin: 0;
padding: 20px;
background-color: #f4f7f9;
color: #333;
}
.container {
max-width: 1200px;
margin: auto;
background-color: #fff;
padding: 30px;
border-radius: 12px;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}
h1 {
color: #007bff;
border-bottom: 2px solid #eee;
padding-bottom: 10px;
margin-bottom: 20px;
}
.status-box {
display: flex;
flex-wrap: wrap;
gap: 20px;
margin-bottom: 30px;
}
.stat-card {
background-color: #e9ecef;
padding: 15px 20px;
border-radius: 8px;
flex: 1;
min-width: 200px;
}
.stat-card h3 {
margin-top: 0;
font-size: 1.1em;
color: #555;
}
.stat-card p {
font-size: 1.8em;
font-weight: bold;
margin: 5px 0 0 0;
color: #007bff;
}
.control-panel {
display: flex;
gap: 20px;
margin-bottom: 30px;
padding: 20px;
border: 1px solid #ddd;
border-radius: 8px;
background-color: #f8f9fa;
}
.control-panel form {
display: flex;
gap: 10px;
align-items: center;
}
.control-panel input[type="number"] {
padding: 8px;
border: 1px solid #ccc;
border-radius: 4px;
width: 150px;
}
.control-panel button {
padding: 10px 15px;
border: none;
border-radius: 4px;
cursor: pointer;
font-weight: bold;
transition: background-color 0.3s;
}
.btn-primary {
background-color: #28a745;
color: white;
}
.btn-primary:hover {
background-color: #218838;
}
.btn-danger {
background-color: #dc3545;
color: white;
}
.btn-danger:hover {
background-color: #c82333;
}
.btn-info {
background-color: #17a2b8;
color: white;
}
.btn-info:hover {
background-color: #138496;
}
.server-stats table {
width: 100%;
border-collapse: collapse;
margin-top: 20px;
}
.server-stats th, .server-stats td {
border: 1px solid #ddd;
padding: 10px;
text-align: left;
}
.server-stats th {
background-color: #007bff;
color: white;
font-weight: normal;
}
.server-stats tr:nth-child(even) {
background-color: #f8f9fa;
}
.server-stats .busy-true {
background-color: #fff3cd;
}
.current-status {
padding: 15px;
background-color: #e9f7ef;
border: 1px solid #d4edda;
color: #155724;
border-radius: 8px;
margin-bottom: 20px;
font-size: 1.1em;
}
.current-status strong {
color: #007bff;
}
</style>
<script>
// Function to refresh the page every 5 seconds
function autoRefresh() {
setTimeout(function() {
window.location.reload();
}, 5000); // 5000 milliseconds = 5 seconds
}
// Call the function when the page loads
window.onload = autoRefresh;
</script>
</head>
<body>
<div class="container">
<h1>Flow Server {{ flow_id }} Control Panel</h1>
<div class="current-status">
<strong>Current Status:</strong> {{ status }} ({{ "RUNNING" if is_running else "STOPPED" }})
<br>
<strong>Current File:</strong> {{ current_file }} ({{ current_file_progress }})
<br>
<small>Last Updated: {{ last_update }}</small>
</div>
<div class="status-box">
<div class="stat-card">
<h3>Total Files</h3>
<p>{{ total_files }}</p>
</div>
<div class="stat-card">
<h3>Processed Files</h3>
<p>{{ processed_count }}</p>
</div>
<div class="stat-card">
<h3>Remaining Files</h3>
<p>{{ remaining_count }}</p>
</div>
<div class="stat-card">
<h3>Current Index</h3>
<p>{{ current_index }}</p>
</div>
<div class="stat-card">
<h3>Overall FPS</h3>
<p>{{ overall_fps }}</p>
</div>
</div>
<h2>Control Panel</h2>
<div class="control-panel">
<!-- Start/Stop Form -->
<form method="POST" action="/control_processing">
{% if is_running %}
<input type="hidden" name="action" value="stop">
<button type="submit" class="btn-danger">STOP Processing</button>
{% else %}
<input type="hidden" name="action" value="start">
<button type="submit" class="btn-primary">START Processing (from Index {{ current_index }})</button>
{% endif %}
</form>
<!-- Set Index Form -->
<form method="POST" action="/set_index">
<label for="start_index">Set Start Index (0 to {{ total_files - 1 }}):</label>
<input type="number" id="start_index" name="start_index" min="0" max="{{ total_files }}" value="{{ current_index }}" required>
<button type="submit" class="btn-info">Set Index & Restart</button>
</form>
</div>
<h2>Caption Server Stats</h2>
<div class="server-stats">
<table>
<thead>
<tr>
<th>Server URL</th>
<th>Status</th>
<th>Total Processed</th>
<th>FPS (Frames/Sec)</th>
</tr>
</thead>
<tbody>
{% for server in server_stats %}
<tr class="{{ 'busy-true' if server.busy else '' }}">
<td>{{ server.url }}</td>
<td>{{ "BUSY" if server.busy else "IDLE" }}</td>
<td>{{ server.processed }}</td>
<td>{{ server.fps }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</body>
</html>