unmodified changes from long ago commited to kickstart deskmeter again

This commit is contained in:
buenosairesam
2025-12-19 02:57:39 -03:00
parent a966623c75
commit 58348eab82
4 changed files with 70 additions and 50 deletions

View File

@@ -1,14 +1,11 @@
<html>
<head>
<!-- <link rel="stylesheet" href="{{ url_for('static', filename='styles/dm.css') }}"> -->
{% if auto_refresh %}
<meta http-equiv="refresh" content="5">
{% endif %}
{% block head %}
{% endblock %}
<style>
body
body
{
display: flex;
flex-direction: column;
@@ -34,35 +31,34 @@
}
</style>
{% if auto_refresh %}
<script>
function refreshData() {
var xhr = new XMLHttpRequest();
xhr.open('GET', '/api/today', true);
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
document.getElementById('content-container').innerHTML = xhr.responseText;
}
};
xhr.send();
}
// Auto-refresh every 5 seconds using AJAX
setInterval(refreshData, 5000);
</script>
{% endif %}
</head>
<body>
<!-- agregar función que me diga cuanto tiempo hace que esta activo el escritorio
(calcular el delta con el ultimo switch y pasarlo a mm:ss) -->
<div id="content-container">
{% block content %}
{% if current_task_path and current_task_time %}
<div style="font-size: 48pt; margin-bottom: 40px; text-align: center;">
<div style="color: #333;">{{ current_task_path }}</div>
<div style="color: #666; font-size: 36pt;">{{ current_task_time }}</div>
</div>
{% endif %}
<table>
{% for row in rows %}
{% if row["ws"] in ['Away', 'Other'] %}
{% set my_class = 'grey' %}
{% elif row["ws"] in ['Active', 'Idle'] %}
{% set my_class = 'blue' %}
{% else %}
{% set my_class = '' %}
{% endif %}
<tr>
<td class="{{my_class}}" >{{ row["ws"] }}</td>
<td class="{{my_class}}" >{{ row["total"] }}</td>
</tr>
{% endfor %}
</table>
{% include 'main_content.html' %}
{% endblock %}
</div>
</body>
</html>

View File

@@ -0,0 +1,23 @@
{% if current_task_path and current_task_time %}
<div id="current-task-info" style="font-size: 48pt; margin-bottom: 40px; text-align: center;">
<div style="color: #333;">{{ current_task_path }}</div>
<div style="color: #666; font-size: 36pt;">{{ current_task_time }}</div>
</div>
{% endif %}
<table>
<tbody>
{% for row in rows %}
{% if row["ws"] in ['Away', 'Other'] %}
{% set my_class = 'grey' %}
{% elif row["ws"] in ['Active', 'Idle'] %}
{% set my_class = 'blue' %}
{% else %}
{% set my_class = '' %}
{% endif %}
<tr>
<td class="{{my_class}}" >{{ row["ws"] }}</td>
<td class="{{my_class}}" >{{ row["total"] }}</td>
</tr>
{% endfor %}
</tbody>
</table>