Files
node-monitor/app/web/templates/logs.html
2025-06-14 01:19:57 +03:00

68 lines
3.0 KiB
HTML

<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Node Monitor Logs - {{ service_uuid }}</title>
<link rel="stylesheet" href="{{ url_for('static', path='/style.css') }}">
</head>
<body>
<div class="header-container">
<h1>Node Monitor Logs</h1>
<p>Service UUID: <code>{{ service_uuid }}</code></p>
<p>Total Logs: <span id="log-count">{{ log_count }}</span> (<span id="polling-status"></span>)</p>
<div class="filter-container">
<fieldset>
<legend>Log Level</legend>
<label><input type="radio" name="log-level" value="" checked> All</label>
<label><input type="radio" name="log-level" value="INFO"> INFO</label>
<label><input type="radio" name="log-level" value="WARNING"> WARNING</label>
<label><input type="radio" name="log-level" value="ERROR"> ERROR</label>
</fieldset>
<label for="since-filter">Since (UTC ISO 8601):</label>
<input type="datetime-local" id="since-filter" placeholder="e.g., 2025-06-11T13:32 (UTC)">
<button id="apply-filters">Apply</button>
<button id="toggle-polling"></button> {# Added toggle-polling button #}
</div>
</div>
<div id="log-table-container" data-service-uuid="{{ service_uuid }}">
{# The initial logs are rendered by Jinja2 here #}
{% if logs %}
<table class="log-table">
<thead>
<tr>
<th>Timestamp</th>
<th>Level</th>
<th>Message</th>
<th>Extra</th>
</tr>
</thead>
<tbody>
{% for log in logs %}
<tr>
<td>{{ log.timestamp }}</td>
<td class="log-level log-level-{{ (log.level or '').lower() }}">{{ log.level }}</td>
<td>{{ log.message }}</td>
<td>
{% if log.extra %}
<div class="json-toggle">Show JSON</div>
<pre class="json-content" style="display: none;">{{ log.extra | tojson(indent=2) }}</pre>
{% else %}
-
{% endif %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
<p class="loading-message">No logs available on server.</p>
{% endif %}
</div>
<script>
// Pass the base path for API calls if mounted under a subpath
window.API_BASE_PATH = "{{ root_path }}";
</script>
<script src="{{ url_for('static', path='/logs.js') }}"></script>
</body>
</html>