36 lines
1.0 KiB
HTML
36 lines
1.0 KiB
HTML
{% extends "index.html" %}
|
|
|
|
{% block workspace_header %}
|
|
<div class="header-bar">
|
|
<div class="info-container">
|
|
<div class="page-title">{% block page_title %}CLI Logs{% endblock %}</div>
|
|
<div class="page-description">{% block page_description %}{% endblock %}</div>
|
|
</div>
|
|
</div>
|
|
{% endblock %}
|
|
|
|
{% block workspace_content %}
|
|
<div class="tutor-logs-container">
|
|
<pre id="tutor-logs" hx-ext="sse" sse-connect="{{ url_for('cli_logs_stream') }}" sse-swap="logs"></pre>
|
|
</div>
|
|
{% endblock %}
|
|
|
|
{% block scripts %}
|
|
<script>
|
|
htmx.on("htmx:sseBeforeMessage", function(evt) {
|
|
// Don't swap content, we want to append
|
|
evt.preventDefault();
|
|
|
|
// Parse JSON
|
|
const stdout = JSON.parse(evt.detail.data);
|
|
|
|
// Note that HTML is automatically escaped
|
|
const text = document.createTextNode(stdout);
|
|
evt.detail.elt.appendChild(text);
|
|
|
|
// Scroll to bottom
|
|
evt.detail.elt.scrollTop = evt.detail.elt.scrollHeight;
|
|
});
|
|
</script>
|
|
{% endblock %}
|