Przeglądaj źródła

add modal for view logs users and add logo

Manuel 1 rok temu
rodzic
commit
1abad9bafe
3 zmienionych plików z 119 dodań i 1 usunięć
  1. BIN
      assets/squidstats.png
  2. 63 0
      static/logs.css
  3. 56 1
      templates/components/logs.html

BIN
assets/squidstats.png


+ 63 - 0
static/logs.css

@@ -344,4 +344,67 @@ body {
     padding: 2rem;
     font-size: 1.2rem;
     color: var(--gray-color);
+}
+
+.user-card {
+    transition: all 0.3s ease;
+    cursor: pointer;
+    position: relative;
+    z-index: 1;
+}
+
+.user-card.expanded {
+    position: fixed;
+    top: 80px;
+    left: 20px;
+    right: 20px;
+    bottom: 20px;
+    z-index: 1000;
+    overflow-y: auto;
+    box-shadow: 0 0 30px rgba(0,0,0,0.3);
+}
+
+.overlay {
+    position: fixed;
+    top: 0;
+    left: 0;
+    right: 0;
+    bottom: 0;
+    background: rgba(0,0,0,0.5);
+    z-index: 999;
+    display: none;
+}
+
+.expanded-content {
+    display: none;
+}
+
+.user-card.expanded .expanded-content {
+    display: block;
+    margin-top: 2em;
+    border-top: 1px solid #eee;
+    padding-top: 2em;
+}
+
+.user-card.expanded .logs-list {
+    max-height: 50vh;
+    overflow-y: auto;
+}
+
+.logs-table {
+    display: grid;
+    grid-template-columns: 1fr auto auto auto;
+    gap: 1em;
+    margin-top: 1em;
+}
+
+.log-row {
+    display: contents;
+}
+
+.log-row > div {
+    padding: 0.8em;
+    background: #f8f9fa;
+    border-radius: 6px;
+    font-size: 0.9em;
 }

+ 56 - 1
templates/components/logs.html

@@ -85,6 +85,23 @@
                     {% endfor %}
                 </div>
             </div>
+
+            <!-- Contenido expandido -->
+            <div class="expanded-content">
+                <div class="full-logs">
+                    <h4>Historial completo</h4>
+                    <div class="logs-table">
+                        {% for log in user.logs %}
+                        <div class="log-row">
+                            <div class="log-url">{{ log.url }}</div>
+                            <div class="log-response response-{{ log.response }}">{{ log.response }}</div>
+                            <div class="log-requests">{{ log.request_count }}</div>
+                            <div class="log-data">{{ log.data_transmitted|format_bytes }}</div>
+                        </div>
+                        {% endfor %}
+                    </div>
+                </div>
+            </div>
         </div>
         {% endfor %}
     </div>
@@ -106,6 +123,8 @@
     </div>
 </div>
 
+<div class="overlay" id="overlay"></div>
+
 <script>
 document.addEventListener("DOMContentLoaded", function () {
     const searchInput = document.getElementById("username-search");
@@ -115,11 +134,46 @@ document.addEventListener("DOMContentLoaded", function () {
     const prevBtn = document.getElementById("prev-page");
     const nextBtn = document.getElementById("next-page");
     const pageNumbers = document.getElementById("page-numbers");
+    const overlay = document.getElementById('overlay');
 
     let currentPage = 1;
     const itemsPerPage = 12;
     let filteredUsers = [...userCards];
 
+    function expandCard(card) {
+        if (card.classList.contains('expanded')) return;
+
+        document.querySelectorAll('.user-card.expanded').forEach(expandedCard => {
+            expandedCard.classList.remove('expanded');
+        });
+
+        card.classList.add('expanded');
+        overlay.style.display = 'block';
+        document.body.style.overflow = 'hidden';
+    }
+
+    function collapseCards() {
+        document.querySelectorAll('.user-card.expanded').forEach(card => {
+            card.classList.remove('expanded');
+        });
+        overlay.style.display = 'none';
+        document.body.style.overflow = 'auto';
+    }
+
+    document.querySelectorAll('.user-card').forEach(card => {
+        card.addEventListener('click', (e) => {
+            if (!card.classList.contains('expanded')) {
+                expandCard(card);
+            }
+        });
+    });
+
+    overlay.addEventListener('click', collapseCards);
+
+    document.addEventListener('keydown', (e) => {
+        if (e.key === 'Escape') collapseCards();
+    });
+
     function renderPage(page = 1) {
         const totalPages = Math.ceil(filteredUsers.length / itemsPerPage);
         currentPage = Math.min(Math.max(1, page), totalPages);
@@ -136,6 +190,7 @@ document.addEventListener("DOMContentLoaded", function () {
         nextBtn.disabled = currentPage === totalPages;
 
         pageNumbers.innerHTML = `Page ${currentPage} of ${totalPages}`;
+        collapseCards();
     }
 
     function filterUsers() {
@@ -153,4 +208,4 @@ document.addEventListener("DOMContentLoaded", function () {
 
     renderPage(1);
 });
-</script>
+</script>