deploy updates
This commit is contained in:
19
ctrl/deploy.sh
Normal file
19
ctrl/deploy.sh
Normal file
@@ -0,0 +1,19 @@
|
||||
#!/bin/bash
|
||||
# Deploy deskmeter to server
|
||||
# Usage: ./ctrl/deploy.sh
|
||||
|
||||
set -e
|
||||
cd "$(dirname "$0")/.."
|
||||
|
||||
echo "Building dmweb image..."
|
||||
docker build -t registry.mcrn.ar/dmweb:latest .
|
||||
|
||||
echo "Pushing to registry..."
|
||||
docker push registry.mcrn.ar/dmweb:latest
|
||||
|
||||
echo "Deploying on server..."
|
||||
rsync -avz docker-compose.yml mcrn.ar:~/dm/
|
||||
ssh mcrn.ar "cd ~/dm && docker compose pull && docker compose up -d --remove-orphans"
|
||||
|
||||
echo "Deploy complete"
|
||||
ssh mcrn.ar "cd ~/dm && docker compose ps"
|
||||
@@ -59,6 +59,7 @@ def sync():
|
||||
log.info("Resuming from saved token")
|
||||
|
||||
watch_kwargs = {"resume_after": resume_token} if resume_token else {}
|
||||
watch_kwargs["full_document"] = "updateLookup" # Get full doc on updates
|
||||
|
||||
# Watch for inserts, updates, and replaces on the database
|
||||
pipeline = [{"$match": {"operationType": {"$in": ["insert", "update", "replace"]}}}]
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
{% extends 'layout.html' %}
|
||||
|
||||
{% block head %}
|
||||
{% extends 'layout.html' %} {% block head %}
|
||||
<style>
|
||||
body {
|
||||
margin: 20px;
|
||||
@@ -182,37 +180,72 @@
|
||||
display: block;
|
||||
}
|
||||
</style>
|
||||
{% endblock head %}
|
||||
{% endblock head %} {% block content %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
<div class="nav-bar" style="margin-bottom: 15px; padding-bottom: 10px; border-bottom: 2px solid #444; font-size: 12pt;">
|
||||
<div
|
||||
class="nav-bar"
|
||||
style="
|
||||
margin-bottom: 15px;
|
||||
padding-bottom: 10px;
|
||||
border-bottom: 2px solid #444;
|
||||
font-size: 12pt;
|
||||
"
|
||||
>
|
||||
<a href="/">Today</a>
|
||||
<a href="/switches/{{ scope }}/{{ base_date.year }}/{{ base_date.month }}/{{ base_date.day }}">Switches</a>
|
||||
<a href="/work">Work</a>
|
||||
<a href="/calendar/daily">Calendar</a>
|
||||
<a
|
||||
href="/switches/{{ scope }}/{{ base_date.year }}/{{ base_date.month }}/{{ base_date.day }}"
|
||||
>Switches</a
|
||||
>
|
||||
<a href="/totals">All Time</a>
|
||||
</div>
|
||||
|
||||
<div class="nav-tabs">
|
||||
<a href="/calendar/daily/{{ base_date.year }}/{{ base_date.month }}/{{ base_date.day }}?grid={{ grid }}"
|
||||
class="{% if scope == 'daily' %}active{% endif %}">Daily</a>
|
||||
<a href="/calendar/weekly/{{ base_date.year }}/{{ base_date.month }}/{{ base_date.day }}?grid={{ grid }}"
|
||||
class="{% if scope == 'weekly' %}active{% endif %}">Weekly</a>
|
||||
<a href="/calendar/monthly/{{ base_date.year }}/{{ base_date.month }}/{{ base_date.day }}?grid={{ grid }}"
|
||||
class="{% if scope == 'monthly' %}active{% endif %}">Monthly</a>
|
||||
<span style="margin-left: auto; display: flex; gap: 15px; align-items: center;">
|
||||
<span style="color: #999; font-size: 11pt;">Grid:</span>
|
||||
<a href="/calendar/{{ scope }}/{{ base_date.year }}/{{ base_date.month }}/{{ base_date.day }}?grid=1"
|
||||
class="{% if grid == 1 %}active{% endif %}" style="font-size: 11pt;">1h</a>
|
||||
<a href="/calendar/{{ scope }}/{{ base_date.year }}/{{ base_date.month }}/{{ base_date.day }}?grid=3"
|
||||
class="{% if grid == 3 %}active{% endif %}" style="font-size: 11pt;">3h</a>
|
||||
<a href="/calendar/{{ scope }}/{{ base_date.year }}/{{ base_date.month }}/{{ base_date.day }}?grid=6"
|
||||
class="{% if grid == 6 %}active{% endif %}" style="font-size: 11pt;">6h</a>
|
||||
<a
|
||||
href="/calendar/daily/{{ base_date.year }}/{{ base_date.month }}/{{ base_date.day }}?grid={{ grid }}"
|
||||
class="{% if scope == 'daily' %}active{% endif %}"
|
||||
>Daily</a
|
||||
>
|
||||
<a
|
||||
href="/calendar/weekly/{{ base_date.year }}/{{ base_date.month }}/{{ base_date.day }}?grid={{ grid }}"
|
||||
class="{% if scope == 'weekly' %}active{% endif %}"
|
||||
>Weekly</a
|
||||
>
|
||||
<a
|
||||
href="/calendar/monthly/{{ base_date.year }}/{{ base_date.month }}/{{ base_date.day }}?grid={{ grid }}"
|
||||
class="{% if scope == 'monthly' %}active{% endif %}"
|
||||
>Monthly</a
|
||||
>
|
||||
<span
|
||||
style="margin-left: auto; display: flex; gap: 15px; align-items: center"
|
||||
>
|
||||
<span style="color: #999; font-size: 11pt">Grid:</span>
|
||||
<a
|
||||
href="/calendar/{{ scope }}/{{ base_date.year }}/{{ base_date.month }}/{{ base_date.day }}?grid=1"
|
||||
class="{% if grid == 1 %}active{% endif %}"
|
||||
style="font-size: 11pt"
|
||||
>1h</a
|
||||
>
|
||||
<a
|
||||
href="/calendar/{{ scope }}/{{ base_date.year }}/{{ base_date.month }}/{{ base_date.day }}?grid=3"
|
||||
class="{% if grid == 3 %}active{% endif %}"
|
||||
style="font-size: 11pt"
|
||||
>3h</a
|
||||
>
|
||||
<a
|
||||
href="/calendar/{{ scope }}/{{ base_date.year }}/{{ base_date.month }}/{{ base_date.day }}?grid=6"
|
||||
class="{% if grid == 6 %}active{% endif %}"
|
||||
style="font-size: 11pt"
|
||||
>6h</a
|
||||
>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div class="date-nav">
|
||||
<a href="/calendar/{{ scope }}/{{ prev_date.year }}/{{ prev_date.month }}/{{ prev_date.day }}?grid={{ grid }}">←</a>
|
||||
<a
|
||||
href="/calendar/{{ scope }}/{{ prev_date.year }}/{{ prev_date.month }}/{{ prev_date.day }}?grid={{ grid }}"
|
||||
>←</a
|
||||
>
|
||||
{% if scope == 'daily' %}
|
||||
<span class="date-info">{{ base_date.strftime('%Y-%m-%d %A') }}</span>
|
||||
{% elif scope == 'weekly' %}
|
||||
@@ -220,14 +253,19 @@
|
||||
{% elif scope == 'monthly' %}
|
||||
<span class="date-info">{{ base_date.strftime('%B %Y') }}</span>
|
||||
{% endif %}
|
||||
<a href="/calendar/{{ scope }}/{{ next_date.year }}/{{ next_date.month }}/{{ next_date.day }}?grid={{ grid }}">→</a>
|
||||
<a
|
||||
href="/calendar/{{ scope }}/{{ next_date.year }}/{{ next_date.month }}/{{ next_date.day }}?grid={{ grid }}"
|
||||
>→</a
|
||||
>
|
||||
</div>
|
||||
|
||||
<div class="calendar-grid">
|
||||
<div class="time-column">
|
||||
<div class="day-header" style="height: 40px;"></div>
|
||||
<div class="day-header" style="height: 40px"></div>
|
||||
{% for hour in range(0, 24, grid) %}
|
||||
<div class="time-slot" style="height: {{ grid * 60 }}px;">{{ '%02d:00'|format(hour) }}</div>
|
||||
<div class="time-slot" style="height: {{ grid * 60 }}px;">
|
||||
{{ '%02d:00'|format(hour) }}
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
@@ -235,64 +273,54 @@
|
||||
{% for day in days %}
|
||||
<div class="day-column">
|
||||
<div class="day-header">
|
||||
{{ day.strftime('%a %d') if scope != 'daily' else day.strftime('%A') }}
|
||||
{{ day.strftime('%a %d') if scope != 'daily' else
|
||||
day.strftime('%A') }}
|
||||
</div>
|
||||
<div class="day-grid">
|
||||
{% for hour in range(0, 24, grid) %}
|
||||
<div class="hour-line" style="top: {{ hour * 60 }}px; height: {{ grid * 60 }}px;"></div>
|
||||
{% endfor %}
|
||||
|
||||
{% set day_blocks = [] %}
|
||||
{% for block in blocks %}
|
||||
{% if block.start.date() == day.date() %}
|
||||
{% set _ = day_blocks.append(block) %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
{# Group blocks by hour for stacking #}
|
||||
{% set hour_groups = {} %}
|
||||
{% for block in day_blocks %}
|
||||
{% set hour_key = block.hour %}
|
||||
{% if hour_key not in hour_groups %}
|
||||
{% set _ = hour_groups.update({hour_key: []}) %}
|
||||
{% endif %}
|
||||
{% set _ = hour_groups[hour_key].append(block) %}
|
||||
{% endfor %}
|
||||
|
||||
{# Render blocks stacked within each hour #}
|
||||
{% for hour_key, hour_blocks in hour_groups.items() %}
|
||||
{% for block in hour_blocks %}
|
||||
{% set idx = loop.index0 %}
|
||||
{% set base_top_px = block.hour * 60 %}
|
||||
{% set duration_hours = block.duration / 3600.0 %}
|
||||
{% set height_px = duration_hours * 60 %}
|
||||
{% if height_px < 2 %}{% set height_px = 2 %}{% endif %}
|
||||
|
||||
{% set task_hash = block.task_path|hash if block.task_path else 0 %}
|
||||
{% set base_color_hue = task_hash % 360 %}
|
||||
{% set active_color = 'hsl(%d, 60%%, 45%%)'|format(base_color_hue) %}
|
||||
|
||||
{# Cascade effect: shift right and down for overlapping blocks #}
|
||||
{# Each block shifts 8% right and 4px down #}
|
||||
{% set offset_pct = idx * 8 %}
|
||||
{% set width_pct = 100 - (idx * 8) - 2 %}
|
||||
{% set vertical_offset_px = idx * 4 %}
|
||||
<div
|
||||
class="hour-line"
|
||||
style="top: {{ hour * 60 }}px; height: {{ grid * 60 }}px;"
|
||||
></div>
|
||||
{% endfor %} {% set day_blocks = [] %} {% for block in blocks %}
|
||||
{% if block.start.date() == day.date() %} {% set _ =
|
||||
day_blocks.append(block) %} {% endif %} {% endfor %} {# Group
|
||||
blocks by hour for stacking #} {% set hour_groups = {} %} {% for
|
||||
block in day_blocks %} {% set hour_key = block.hour %} {% if
|
||||
hour_key not in hour_groups %} {% set _ =
|
||||
hour_groups.update({hour_key: []}) %} {% endif %} {% set _ =
|
||||
hour_groups[hour_key].append(block) %} {% endfor %} {# Render
|
||||
blocks stacked within each hour #} {% for hour_key, hour_blocks
|
||||
in hour_groups.items() %} {% for block in hour_blocks %} {% set
|
||||
idx = loop.index0 %} {% set base_top_px = block.hour * 60 %} {%
|
||||
set duration_hours = block.duration / 3600.0 %} {% set height_px
|
||||
= duration_hours * 60 %} {% if height_px < 2 %}{% set height_px
|
||||
= 2 %}{% endif %} {% set task_hash = block.task_path|hash if
|
||||
block.task_path else 0 %} {% set base_color_hue = task_hash %
|
||||
360 %} {% set active_color = 'hsl(%d, 60%%,
|
||||
45%%)'|format(base_color_hue) %} {# Cascade effect: shift right
|
||||
and down for overlapping blocks #} {# Each block shifts 8% right
|
||||
and 4px down #} {% set offset_pct = idx * 8 %} {% set width_pct
|
||||
= 100 - (idx * 8) - 2 %} {% set vertical_offset_px = idx * 4 %}
|
||||
{% set top_px = base_top_px + vertical_offset_px %}
|
||||
|
||||
<div class="task-block"
|
||||
<div
|
||||
class="task-block"
|
||||
style="top: {{ top_px }}px; height: {{ height_px }}px;
|
||||
left: {{ offset_pct }}%; width: {{ width_pct }}%;
|
||||
background: {{ active_color }}; opacity: 0.9;">
|
||||
background: {{ active_color }}; opacity: 0.9;"
|
||||
>
|
||||
<div class="task-label">{{ block.task_path }}</div>
|
||||
<div class="task-time">{{ (block.duration // 60)|int }}m</div>
|
||||
<div class="task-time">
|
||||
{{ (block.duration // 60)|int }}m
|
||||
</div>
|
||||
<div class="block-tooltip">
|
||||
<strong>{{ block.task_path }}</strong><br>
|
||||
Hour: {{ '%02d:00'|format(block.hour) }}<br>
|
||||
<strong>{{ block.task_path }}</strong><br />
|
||||
Hour: {{ '%02d:00'|format(block.hour) }}<br />
|
||||
Duration: {{ (block.duration // 60)|int }} minutes
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
{% endfor %} {% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
|
||||
@@ -106,7 +106,6 @@
|
||||
<a href="/">Today</a>
|
||||
<a href="/calendar/daily">Calendar</a>
|
||||
<a href="/switches/daily">Switches</a>
|
||||
<a href="/work">Work</a>
|
||||
<a href="/totals">All Time</a>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
{% extends 'layout.html' %}
|
||||
|
||||
{% block head %}
|
||||
{% extends 'layout.html' %} {% block head %}
|
||||
<style>
|
||||
body {
|
||||
margin: 20px;
|
||||
@@ -104,8 +102,12 @@
|
||||
}
|
||||
|
||||
/* Active vs idle workspace indicator */
|
||||
.ws-active { font-weight: bold; }
|
||||
.ws-idle { opacity: 0.5; }
|
||||
.ws-active {
|
||||
font-weight: bold;
|
||||
}
|
||||
.ws-idle {
|
||||
opacity: 0.5;
|
||||
}
|
||||
|
||||
.stats {
|
||||
margin: 20px 0;
|
||||
@@ -135,28 +137,45 @@
|
||||
color: #e0e0e0;
|
||||
}
|
||||
</style>
|
||||
{% endblock head %}
|
||||
{% endblock head %} {% block content %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
<div class="nav-bar" style="margin-bottom: 15px; padding-bottom: 10px; border-bottom: 2px solid #444;">
|
||||
<div
|
||||
class="nav-bar"
|
||||
style="
|
||||
margin-bottom: 15px;
|
||||
padding-bottom: 10px;
|
||||
border-bottom: 2px solid #444;
|
||||
"
|
||||
>
|
||||
<a href="/">Today</a>
|
||||
<a href="/calendar/{{ scope }}/{{ base_date.year }}/{{ base_date.month }}/{{ base_date.day }}">Calendar</a>
|
||||
<a href="/work">Work</a>
|
||||
<a href="/calendar/daily">Calendar</a>
|
||||
<a href="/switches/daily">Switches</a>
|
||||
<a href="/totals">All Time</a>
|
||||
</div>
|
||||
|
||||
<div class="nav-tabs">
|
||||
<a href="/switches/daily/{{ base_date.year }}/{{ base_date.month }}/{{ base_date.day }}"
|
||||
class="{% if scope == 'daily' %}active{% endif %}">Daily</a>
|
||||
<a href="/switches/weekly/{{ base_date.year }}/{{ base_date.month }}/{{ base_date.day }}"
|
||||
class="{% if scope == 'weekly' %}active{% endif %}">Weekly</a>
|
||||
<a href="/switches/monthly/{{ base_date.year }}/{{ base_date.month }}/{{ base_date.day }}"
|
||||
class="{% if scope == 'monthly' %}active{% endif %}">Monthly</a>
|
||||
<a
|
||||
href="/switches/daily/{{ base_date.year }}/{{ base_date.month }}/{{ base_date.day }}"
|
||||
class="{% if scope == 'daily' %}active{% endif %}"
|
||||
>Daily</a
|
||||
>
|
||||
<a
|
||||
href="/switches/weekly/{{ base_date.year }}/{{ base_date.month }}/{{ base_date.day }}"
|
||||
class="{% if scope == 'weekly' %}active{% endif %}"
|
||||
>Weekly</a
|
||||
>
|
||||
<a
|
||||
href="/switches/monthly/{{ base_date.year }}/{{ base_date.month }}/{{ base_date.day }}"
|
||||
class="{% if scope == 'monthly' %}active{% endif %}"
|
||||
>Monthly</a
|
||||
>
|
||||
</div>
|
||||
|
||||
<div class="date-nav">
|
||||
<a href="/switches/{{ scope }}/{{ prev_date.year }}/{{ prev_date.month }}/{{ prev_date.day }}">←</a>
|
||||
<a
|
||||
href="/switches/{{ scope }}/{{ prev_date.year }}/{{ prev_date.month }}/{{ prev_date.day }}"
|
||||
>←</a
|
||||
>
|
||||
{% if scope == 'daily' %}
|
||||
<span class="date-info">{{ base_date.strftime('%Y-%m-%d %A') }}</span>
|
||||
{% elif scope == 'weekly' %}
|
||||
@@ -164,7 +183,10 @@
|
||||
{% elif scope == 'monthly' %}
|
||||
<span class="date-info">{{ base_date.strftime('%B %Y') }}</span>
|
||||
{% endif %}
|
||||
<a href="/switches/{{ scope }}/{{ next_date.year }}/{{ next_date.month }}/{{ next_date.day }}">→</a>
|
||||
<a
|
||||
href="/switches/{{ scope }}/{{ next_date.year }}/{{ next_date.month }}/{{ next_date.day }}"
|
||||
>→</a
|
||||
>
|
||||
</div>
|
||||
|
||||
<div class="stats">
|
||||
@@ -175,7 +197,10 @@
|
||||
</div>
|
||||
<div class="stat-item">
|
||||
<span class="stat-label">Total Time:</span>
|
||||
<span class="stat-value">{{ (switches|sum(attribute='delta') // 3600)|int }}h {{ ((switches|sum(attribute='delta') % 3600) // 60)|int }}m</span>
|
||||
<span class="stat-value"
|
||||
>{{ (switches|sum(attribute='delta') // 3600)|int }}h {{
|
||||
((switches|sum(attribute='delta') % 3600) // 60)|int }}m</span
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -184,34 +209,36 @@
|
||||
|
||||
<div class="switches-container">
|
||||
{% set max_delta = switches|map(attribute='delta')|max if switches else 1 %}
|
||||
{% set base_height = 30 %}
|
||||
{% set max_height = 200 %}
|
||||
{% for switch in switches %}
|
||||
{% set is_active = switch.workspace in ['Plan', 'Think', 'Work'] %}
|
||||
{% set task_hash = switch.task_path|hash if switch.task_path else 0 %}
|
||||
{% set border_hue = task_hash % 360 %}
|
||||
{% set border_color = 'hsl(%d, 70%%, 50%%)'|format(border_hue) %}
|
||||
{% set bg_color = 'hsl(%d, 30%%, 20%%)'|format(border_hue) %}
|
||||
{% set height_ratio = (switch.delta / max_delta) if max_delta > 0 else 0 %}
|
||||
{% set cell_height = (base_height + (height_ratio * (max_height - base_height)))|int %}
|
||||
<div class="switch-row {{ 'ws-active' if is_active else 'ws-idle' }}"
|
||||
style="border-left-color: {{ border_color }}; background-color: {{ bg_color }}; height: {{ cell_height }}px;">
|
||||
<div class="switch-time">{{ switch.date.strftime('%m/%d %H:%M:%S') }}</div>
|
||||
{% set base_height = 30 %} {% set max_height = 200 %} {% for switch in
|
||||
switches %} {% set is_active = switch.workspace in ['Plan', 'Think', 'Work']
|
||||
%} {% set task_hash = switch.task_path|hash if switch.task_path else 0 %} {%
|
||||
set border_hue = task_hash % 360 %} {% set border_color = 'hsl(%d, 70%%,
|
||||
50%%)'|format(border_hue) %} {% set bg_color = 'hsl(%d, 30%%,
|
||||
20%%)'|format(border_hue) %} {% set height_ratio = (switch.delta /
|
||||
max_delta) if max_delta > 0 else 0 %} {% set cell_height = (base_height +
|
||||
(height_ratio * (max_height - base_height)))|int %}
|
||||
<div
|
||||
class="switch-row {{ 'ws-active' if is_active else 'ws-idle' }}"
|
||||
style="border-left-color: {{ border_color }}; background-color: {{ bg_color }}; height: {{ cell_height }}px;"
|
||||
>
|
||||
<div class="switch-time">
|
||||
{{ switch.date.strftime('%m/%d %H:%M:%S') }}
|
||||
</div>
|
||||
<div class="switch-workspace">{{ switch.workspace }}</div>
|
||||
<div class="switch-task">{{ switch.task_path }}</div>
|
||||
<div class="switch-duration">
|
||||
{% if switch.delta >= 3600 %}
|
||||
{{ (switch.delta // 3600)|int }}h {{ ((switch.delta % 3600) // 60)|int }}m
|
||||
{% else %}
|
||||
{{ (switch.delta // 60)|int }}m {{ (switch.delta % 60)|int }}s
|
||||
{% endif %}
|
||||
{% if switch.delta >= 3600 %} {{ (switch.delta // 3600)|int }}h {{
|
||||
((switch.delta % 3600) // 60)|int }}m {% else %} {{ (switch.delta //
|
||||
60)|int }}m {{ (switch.delta % 60)|int }}s {% endif %}
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
{% if not switches %}
|
||||
<p style="text-align: center; color: #666; margin-top: 40px;">No switches in this period</p>
|
||||
<p style="text-align: center; color: #666; margin-top: 40px">
|
||||
No switches in this period
|
||||
</p>
|
||||
{% endif %}
|
||||
|
||||
<style>
|
||||
|
||||
@@ -8,6 +8,7 @@ services:
|
||||
- mongo
|
||||
environment:
|
||||
- MONGODB_HOST=mongo
|
||||
- TZ=America/Argentina/Buenos_Aires
|
||||
networks:
|
||||
- gateway
|
||||
- internal
|
||||
|
||||
Reference in New Issue
Block a user