dashboard improvement
This commit is contained in:
@@ -1,58 +1,71 @@
|
||||
{% macro recent_activity(activities) %}
|
||||
{% macro recent_activity(events, is_admin=False) %}
|
||||
<div class="masonry-card">
|
||||
<div class="card h-100">
|
||||
<div class="card-header bg-white border-0">
|
||||
<div class="d-flex justify-content-between align-items-center mb-3">
|
||||
<h5 class="card-title mb-0"><i class="fas fa-history me-2"></i>Recent Activity</h5>
|
||||
<a href="{{ url_for('rooms.rooms') }}" class="btn btn-primary btn-sm">View All</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card shadow-sm">
|
||||
<div class="card-body">
|
||||
<div class="d-flex justify-content-between align-items-center mb-3">
|
||||
<h5 class="card-title mb-0">
|
||||
<i class="fas fa-history me-2"></i>
|
||||
{% if is_admin %}Recent Activity{% else %}Your Recent Actions{% endif %}
|
||||
</h5>
|
||||
{% if is_admin %}
|
||||
<a href="{{ url_for('main.settings', tab='events') }}" class="btn btn-primary btn-sm">View All</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
{% if events %}
|
||||
<div class="list-group list-group-flush">
|
||||
{% for activity in activities %}
|
||||
<div class="list-group-item">
|
||||
<div class="d-flex align-items-center">
|
||||
<div class="flex-shrink-0">
|
||||
{% if activity.type == 'folder' %}
|
||||
<i class="fas fa-folder me-2 icon-primary"></i>
|
||||
{% else %}
|
||||
<i class="fas fa-file me-2 icon-primary"></i>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="flex-grow-1 ms-3">
|
||||
<div class="d-flex justify-content-between align-items-center">
|
||||
<div>
|
||||
<div class="d-flex align-items-center mb-1">
|
||||
<h6 class="mb-0">{{ activity.name }}</h6>
|
||||
{% if activity.is_starred %}
|
||||
<span class="badge badge-starred ms-2">
|
||||
<i class="fas fa-star me-1"></i>Starred
|
||||
</span>
|
||||
{% endif %}
|
||||
{% if activity.is_deleted %}
|
||||
<span class="badge badge-trash ms-2">
|
||||
<i class="fas fa-trash me-1"></i>Trash
|
||||
</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
<small class="text-muted">
|
||||
{{ activity.room.name }} •
|
||||
{{ activity.uploader.username }} {{ activity.uploader.last_name }} •
|
||||
{% if activity.uploaded_at %}{{ activity.uploaded_at|timeago }}{% else %}Unknown{% endif %}
|
||||
</small>
|
||||
{% for event in events %}
|
||||
<div class="list-group-item px-0">
|
||||
<div class="d-flex justify-content-between align-items-center">
|
||||
<div class="d-flex align-items-center">
|
||||
<div>
|
||||
<div class="fw-bold text-primary">
|
||||
{% if event.event_type == 'file_upload' %}
|
||||
Uploaded {{ event.details.get('file_name', 'a file') }}
|
||||
{% elif event.event_type == 'file_download' %}
|
||||
Downloaded {{ event.details.get('file_name', 'a file') }}
|
||||
{% elif event.event_type == 'file_delete' %}
|
||||
Deleted {{ event.details.get('file_name', 'a file') }}
|
||||
{% elif event.event_type == 'file_star' %}
|
||||
Starred {{ event.details.get('file_name', 'a file') }}
|
||||
{% elif event.event_type == 'file_unstar' %}
|
||||
Unstarred {{ event.details.get('file_name', 'a file') }}
|
||||
{% elif event.event_type == 'room_create' %}
|
||||
Created room "{{ event.details.get('room_name', 'a room') }}"
|
||||
{% elif event.event_type == 'room_update' %}
|
||||
Updated room "{{ event.details.get('room_name', 'a room') }}"
|
||||
{% elif event.event_type == 'conversation_create' %}
|
||||
Started a conversation
|
||||
{% elif event.event_type == 'message_create' %}
|
||||
Sent a message
|
||||
{% else %}
|
||||
{{ event.event_type|replace('_', ' ')|title }}
|
||||
{% endif %}
|
||||
</div>
|
||||
{% if activity.type == 'file' and activity.can_download %}
|
||||
<a href="{{ url_for('room_files.download_room_file', room_id=activity.room.id, filename=activity.name, path=activity.path) }}"
|
||||
class="btn btn-download btn-sm ms-2" title="Download">
|
||||
<i class="fas fa-download"></i>
|
||||
</a>
|
||||
{% endif %}
|
||||
<small class="text-muted">
|
||||
{% if is_admin %}
|
||||
by {{ event.user.username }}
|
||||
{% endif %}
|
||||
{{ event.timestamp.strftime('%Y-%m-%d %H:%M') }}
|
||||
</small>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% if event.details.get('room_id') %}
|
||||
<a href="{{ url_for('rooms.room', room_id=event.details.get('room_id')) }}" class="btn btn-sm btn-outline-primary" style="background-color: white; border: 1px solid var(--primary-color); color: var(--primary-color);" onmouseover="this.style.backgroundColor='var(--primary-color)'; this.querySelector('i').style.color='white'" onmouseout="this.style.backgroundColor='white'; this.querySelector('i').style.color='var(--primary-color)'">
|
||||
<i class="fas fa-external-link-alt"></i>
|
||||
</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="text-center text-muted py-3">
|
||||
<i class="fas fa-info-circle mb-2"></i>
|
||||
<p class="mb-0">No recent activity</p>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<div class="card shadow-sm">
|
||||
<div class="card-body">
|
||||
<div class="d-flex justify-content-between align-items-center mb-3">
|
||||
<h5 class="card-title mb-0"><i class="fas fa-database me-2"></i>Storage Overview</h5>
|
||||
<h5 class="card-title mb-0"><i class="fas fa-database me-2"></i>Room Storage Overview</h5>
|
||||
<a href="{{ url_for('rooms.rooms') }}" class="btn btn-primary btn-sm">Browse</a>
|
||||
</div>
|
||||
<div class="d-flex flex-column">
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<div class="card shadow-sm">
|
||||
<div class="card-body">
|
||||
<div class="d-flex justify-content-between align-items-center mb-3">
|
||||
<h5 class="card-title mb-0"><i class="fas fa-trash me-2"></i>Trash</h5>
|
||||
<h5 class="card-title mb-0"><i class="fas fa-trash me-2"></i>Trash Storage Overview</h5>
|
||||
<a href="{{ url_for('main.trash') }}" class="btn btn-primary btn-sm">View All</a>
|
||||
</div>
|
||||
<div class="d-flex flex-column">
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
{% from 'components/starred_files.html' import starred_files %}
|
||||
{% from 'components/trash.html' import trash %}
|
||||
{% from 'components/trash_type.html' import trash_type %}
|
||||
{% from 'components/recent_activity.html' import recent_activity %}
|
||||
|
||||
<style>
|
||||
.masonry {
|
||||
@@ -45,6 +46,7 @@
|
||||
<div class="masonry">
|
||||
{{ storage_overview(room_count, file_count, folder_count, total_size) }}
|
||||
{{ storage_usage(storage_by_type) }}
|
||||
{{ recent_activity(recent_events, is_admin) }}
|
||||
|
||||
{% if current_user.is_admin %}
|
||||
{{ contacts(recent_contacts) }}
|
||||
|
||||
Reference in New Issue
Block a user