fix(client_details.html): fix up code for AJAX loading
This commit is contained in:
@@ -1,37 +1,46 @@
|
|||||||
<!doctype html>
|
<div class="details-header">
|
||||||
<html lang="en">
|
<p>Machine {{ client.id }}</p>
|
||||||
<head>
|
</div>
|
||||||
<meta charset="UTF-8" />
|
<div class="details-container">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<div class="details-sidebar">
|
||||||
<title>Details for client {{ client.id }}</title>
|
<ul>
|
||||||
<link
|
<li>
|
||||||
rel="stylesheet"
|
<a href="?tab=summary">
|
||||||
href="{{ url_for('static', filename='css/style.css') }}"
|
<i class="fi fi-ss-summary-check"></i>
|
||||||
/>
|
<span>Summary</span>
|
||||||
</head>
|
</a>
|
||||||
<body>
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="details-content">
|
||||||
<h1>Details for client {{ client.id }}</h1>
|
<h1>Details for client {{ client.id }}</h1>
|
||||||
<p><strong>ID:</strong> {{ client.id }}</p>
|
|
||||||
<p><strong>IP Address:</strong> {{ client.addr[0] }}</p>
|
|
||||||
<p><strong>Port:</strong> {{ client.addr[1] }}</p>
|
|
||||||
<p>
|
<p>
|
||||||
<strong>Last Seen:</strong>
|
<strong>Last Seen:</strong>
|
||||||
<span id="last-seen">{{ client.last_seen }}</span>
|
<span id="last-seen">{{ client.last_seen }}</span>
|
||||||
</p>
|
</p>
|
||||||
<p>
|
</div>
|
||||||
<strong>Initial:</strong>
|
</div>
|
||||||
<pre>{{ client.initial_telemetry | tojson(indent=2) }}</pre>
|
|
||||||
</p>
|
|
||||||
</body>
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
function updateLastSeen() {
|
function updateLastSeen() {
|
||||||
const lastSeenElement = document.getElementById("last-seen");
|
const lastSeenElement = document.getElementById("last-seen");
|
||||||
const lastSeenTimestamp = parseInt(lastSeenElement.textContent);
|
const lastSeenTimestamp = parseInt(lastSeenElement.textContent);
|
||||||
const lastSeenDate = new Date(lastSeenTimestamp * 1000);
|
const lastSeenDate = new Date(lastSeenTimestamp * 1000);
|
||||||
lastSeenElement.textContent = lastSeenDate.toLocaleString();
|
lastSeenElement.textContent = lastSeenDate.toLocaleString();
|
||||||
}
|
}
|
||||||
|
|
||||||
updateLastSeen();
|
$(".details-sidebar > ul > li > a").click(function (e) {
|
||||||
</script>
|
e.preventDefault();
|
||||||
</html>
|
const tab = $(this).attr("href").split("=")[1];
|
||||||
|
const urlParams = new URLSearchParams(window.location.search);
|
||||||
|
urlParams.set("tab", tab);
|
||||||
|
window.history.pushState(
|
||||||
|
{},
|
||||||
|
"",
|
||||||
|
`${window.location.pathname}?${urlParams}`,
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
updateLastSeen();
|
||||||
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user