displaypc.asp: Add eDNC recent activity log (last 10 entries)

Shows file, action (cleaned/ok/failed/error), and timestamp

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
cproudlock
2025-12-12 09:01:57 -05:00
parent 4e37378923
commit 4441dde2e8

View File

@@ -795,6 +795,61 @@ End If
</tbody> </tbody>
</table> </table>
</div> </div>
<%
' Show recent log entries
Dim logSQL, rsLog
logSQL = "SELECT filename, action, bytes_removed, created FROM ednc_logs " & _
"WHERE UPPER(hostname) = UPPER(?) AND action IN ('cleaned', 'ok', 'failed', 'error') " & _
"ORDER BY created DESC LIMIT 10"
Set rsLog = ExecuteParameterizedQuery(objConn, logSQL, Array(rsEdnc("hostname") & ""))
%>
<h6 class="mt-4 mb-2">Recent Activity</h6>
<div class="table-responsive" style="max-height: 300px; overflow-y: auto;">
<table class="table table-sm table-striped mb-0">
<thead class="thead-light">
<tr>
<th>File</th>
<th>Action</th>
<th>Time</th>
</tr>
</thead>
<tbody>
<%
If rsLog.EOF Then
Response.Write "<tr><td colspan='3' class='text-muted text-center'>No recent activity</td></tr>"
Else
Do While Not rsLog.EOF
Dim logAction, logBadge
logAction = rsLog("action") & ""
Select Case logAction
Case "cleaned"
logBadge = "<span class='badge badge-success'>cleaned</span>"
If CLng(rsLog("bytes_removed") & "0") > 0 Then
logBadge = logBadge & " <small class='text-muted'>(" & rsLog("bytes_removed") & " bytes)</small>"
End If
Case "ok"
logBadge = "<span class='badge badge-secondary'>ok</span>"
Case "failed"
logBadge = "<span class='badge badge-danger'>failed</span>"
Case "error"
logBadge = "<span class='badge badge-danger'>error</span>"
Case Else
logBadge = "<span class='badge badge-info'>" & Server.HTMLEncode(logAction) & "</span>"
End Select
Response.Write "<tr>"
Response.Write "<td><code>" & Server.HTMLEncode(rsLog("filename") & "") & "</code></td>"
Response.Write "<td>" & logBadge & "</td>"
Response.Write "<td><small>" & rsLog("created") & "</small></td>"
Response.Write "</tr>"
rsLog.MoveNext
Loop
End If
rsLog.Close
Set rsLog = Nothing
%>
</tbody>
</table>
</div>
<% <%
End If End If
rsEdnc.Close rsEdnc.Close