Feat: schedule added to dashboard view. logo rework
This commit is contained in:
131
templates/partials/dashboard/todays_actions.html
Normal file
131
templates/partials/dashboard/todays_actions.html
Normal file
@@ -0,0 +1,131 @@
|
||||
<!-- Today's Scheduled Actions - Dashboard Card Content -->
|
||||
|
||||
<!-- Summary stats -->
|
||||
<div class="flex items-center gap-4 mb-4 text-sm">
|
||||
{% if pending_count > 0 %}
|
||||
<div class="flex items-center gap-1.5">
|
||||
<span class="w-2 h-2 bg-yellow-400 rounded-full"></span>
|
||||
<span class="text-gray-600 dark:text-gray-400">{{ pending_count }} pending</span>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if completed_count > 0 %}
|
||||
<div class="flex items-center gap-1.5">
|
||||
<span class="w-2 h-2 bg-green-400 rounded-full"></span>
|
||||
<span class="text-gray-600 dark:text-gray-400">{{ completed_count }} completed</span>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if failed_count > 0 %}
|
||||
<div class="flex items-center gap-1.5">
|
||||
<span class="w-2 h-2 bg-red-400 rounded-full"></span>
|
||||
<span class="text-gray-600 dark:text-gray-400">{{ failed_count }} failed</span>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if total_count == 0 %}
|
||||
<span class="text-gray-500 dark:text-gray-400">No actions scheduled for today</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<!-- Actions list -->
|
||||
{% if actions %}
|
||||
<div class="space-y-2 max-h-64 overflow-y-auto">
|
||||
{% for item in actions %}
|
||||
<div class="flex items-center gap-3 p-2 rounded-lg
|
||||
{% if item.action.execution_status == 'pending' %}bg-yellow-50 dark:bg-yellow-900/20
|
||||
{% elif item.action.execution_status == 'completed' %}bg-green-50 dark:bg-green-900/20
|
||||
{% elif item.action.execution_status == 'failed' %}bg-red-50 dark:bg-red-900/20
|
||||
{% else %}bg-gray-50 dark:bg-gray-700/50{% endif %}">
|
||||
|
||||
<!-- Action type icon -->
|
||||
<div class="flex-shrink-0">
|
||||
{% if item.action.action_type == 'start' %}
|
||||
<div class="w-8 h-8 rounded-full bg-green-100 dark:bg-green-900/30 flex items-center justify-center">
|
||||
<svg class="w-4 h-4 text-green-600 dark:text-green-400" fill="currentColor" viewBox="0 0 20 20">
|
||||
<path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zM9.555 7.168A1 1 0 008 8v4a1 1 0 001.555.832l3-2a1 1 0 000-1.664l-3-2z" clip-rule="evenodd"/>
|
||||
</svg>
|
||||
</div>
|
||||
{% elif item.action.action_type == 'stop' %}
|
||||
<div class="w-8 h-8 rounded-full bg-red-100 dark:bg-red-900/30 flex items-center justify-center">
|
||||
<svg class="w-4 h-4 text-red-600 dark:text-red-400" fill="currentColor" viewBox="0 0 20 20">
|
||||
<path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zM8 7a1 1 0 00-1 1v4a1 1 0 001 1h4a1 1 0 001-1V8a1 1 0 00-1-1H8z" clip-rule="evenodd"/>
|
||||
</svg>
|
||||
</div>
|
||||
{% elif item.action.action_type == 'download' %}
|
||||
<div class="w-8 h-8 rounded-full bg-blue-100 dark:bg-blue-900/30 flex items-center justify-center">
|
||||
<svg class="w-4 h-4 text-blue-600 dark:text-blue-400" fill="currentColor" viewBox="0 0 20 20">
|
||||
<path fill-rule="evenodd" d="M3 17a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1zm3.293-7.707a1 1 0 011.414 0L9 10.586V3a1 1 0 112 0v7.586l1.293-1.293a1 1 0 111.414 1.414l-3 3a1 1 0 01-1.414 0l-3-3a1 1 0 010-1.414z" clip-rule="evenodd"/>
|
||||
</svg>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<!-- Action details -->
|
||||
<div class="flex-1 min-w-0">
|
||||
<div class="flex items-center gap-2">
|
||||
<span class="font-medium text-sm text-gray-900 dark:text-white capitalize">{{ item.action.action_type }}</span>
|
||||
|
||||
<!-- Status indicator -->
|
||||
{% if item.action.execution_status == 'pending' %}
|
||||
<span class="text-xs text-yellow-600 dark:text-yellow-400">
|
||||
{{ item.action.scheduled_time|local_datetime('%H:%M') }}
|
||||
</span>
|
||||
{% elif item.action.execution_status == 'completed' %}
|
||||
<svg class="w-4 h-4 text-green-500" fill="currentColor" viewBox="0 0 20 20">
|
||||
<path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z" clip-rule="evenodd"/>
|
||||
</svg>
|
||||
{% elif item.action.execution_status == 'failed' %}
|
||||
<svg class="w-4 h-4 text-red-500" fill="currentColor" viewBox="0 0 20 20">
|
||||
<path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z" clip-rule="evenodd"/>
|
||||
</svg>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<!-- Location/Project info -->
|
||||
<div class="text-xs text-gray-500 dark:text-gray-400 truncate">
|
||||
{% if item.location %}
|
||||
<a href="/projects/{{ item.action.project_id }}/nrl/{{ item.location.id }}"
|
||||
class="hover:text-seismo-orange">
|
||||
{{ item.location.name }}
|
||||
</a>
|
||||
{% elif item.project %}
|
||||
<a href="/projects/{{ item.project.id }}" class="hover:text-seismo-orange">
|
||||
{{ item.project.name }}
|
||||
</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<!-- Result details for completed/failed -->
|
||||
{% if item.action.execution_status == 'completed' and item.result %}
|
||||
{% if item.result.cycle_response and item.result.cycle_response.downloaded_folder %}
|
||||
<div class="text-xs text-green-600 dark:text-green-400">
|
||||
{{ item.result.cycle_response.downloaded_folder }}
|
||||
{% if item.result.cycle_response.download_success %}downloaded{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% elif item.action.execution_status == 'failed' and item.action.error_message %}
|
||||
<div class="text-xs text-red-600 dark:text-red-400 truncate" title="{{ item.action.error_message }}">
|
||||
{{ item.action.error_message[:50] }}{% if item.action.error_message|length > 50 %}...{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<!-- Time -->
|
||||
<div class="flex-shrink-0 text-right">
|
||||
{% if item.action.execution_status == 'pending' %}
|
||||
<span class="text-xs text-gray-500 dark:text-gray-400">Scheduled</span>
|
||||
{% elif item.action.executed_at %}
|
||||
<span class="text-xs text-gray-500 dark:text-gray-400">
|
||||
{{ item.action.executed_at|local_datetime('%H:%M') }}
|
||||
</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="text-center py-6 text-gray-500 dark:text-gray-400">
|
||||
<svg class="w-10 h-10 mx-auto mb-2 text-gray-300 dark:text-gray-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"></path>
|
||||
</svg>
|
||||
<p class="text-sm">No scheduled actions for today</p>
|
||||
</div>
|
||||
{% endif %}
|
||||
@@ -108,6 +108,53 @@
|
||||
<span class="ml-1 text-red-700 dark:text-red-300">{{ item.schedule.error_message }}</span>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<!-- Execution result details for completed/failed actions -->
|
||||
{% if item.result and item.schedule.execution_status in ['completed', 'failed'] %}
|
||||
<div class="mt-2 p-2 bg-gray-50 dark:bg-gray-700/50 rounded text-xs space-y-1">
|
||||
{% if item.result.cycle_response %}
|
||||
{% set cycle = item.result.cycle_response %}
|
||||
{% if cycle.new_index is defined and cycle.new_index is not none %}
|
||||
<div class="flex items-center gap-2">
|
||||
<span class="text-gray-500 dark:text-gray-400">Index:</span>
|
||||
<span class="font-mono text-gray-700 dark:text-gray-300">{{ '%04d'|format(cycle.new_index) }}</span>
|
||||
{% if cycle.old_index is defined and cycle.old_index is not none %}
|
||||
<span class="text-gray-400">(was {{ '%04d'|format(cycle.old_index) }})</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if cycle.downloaded_folder %}
|
||||
<div class="flex items-center gap-2">
|
||||
<span class="text-gray-500 dark:text-gray-400">Folder:</span>
|
||||
<span class="font-mono text-gray-700 dark:text-gray-300">{{ cycle.downloaded_folder }}</span>
|
||||
{% if cycle.download_success %}
|
||||
<span class="text-green-600 dark:text-green-400">Downloaded</span>
|
||||
{% elif cycle.download_attempted %}
|
||||
<span class="text-red-600 dark:text-red-400">Download failed</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if cycle.clock_synced %}
|
||||
<div class="flex items-center gap-2">
|
||||
<span class="text-gray-500 dark:text-gray-400">Clock synced:</span>
|
||||
<span class="text-green-600 dark:text-green-400">Yes</span>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% elif item.result.device_response %}
|
||||
{% set dev = item.result.device_response %}
|
||||
<div class="flex items-center gap-2">
|
||||
<span class="text-gray-500 dark:text-gray-400">Device:</span>
|
||||
<span class="text-gray-700 dark:text-gray-300">{{ dev.message or dev.status }}</span>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if item.result.session_id %}
|
||||
<div class="flex items-center gap-2">
|
||||
<span class="text-gray-500 dark:text-gray-400">Session:</span>
|
||||
<span class="font-mono text-xs text-gray-600 dark:text-gray-400">{{ item.result.session_id[:8] }}...</span>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<!-- Actions -->
|
||||
|
||||
Reference in New Issue
Block a user