shell-mirror 1.5.38 → 1.5.39
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/public/app/dashboard.css +9 -0
- package/public/app/dashboard.js +34 -5
package/package.json
CHANGED
package/public/app/dashboard.css
CHANGED
|
@@ -294,6 +294,10 @@ body {
|
|
|
294
294
|
border-bottom: 1px solid #f0f0f0;
|
|
295
295
|
}
|
|
296
296
|
|
|
297
|
+
.session-item.compact {
|
|
298
|
+
padding: 12px 0;
|
|
299
|
+
}
|
|
300
|
+
|
|
297
301
|
.session-item:last-child {
|
|
298
302
|
border-bottom: none;
|
|
299
303
|
}
|
|
@@ -345,6 +349,11 @@ body {
|
|
|
345
349
|
color: #f57c00;
|
|
346
350
|
}
|
|
347
351
|
|
|
352
|
+
.session-status.disconnected {
|
|
353
|
+
background: #f5f5f5;
|
|
354
|
+
color: #666;
|
|
355
|
+
}
|
|
356
|
+
|
|
348
357
|
/* Empty States */
|
|
349
358
|
.no-data {
|
|
350
359
|
text-align: center;
|
package/public/app/dashboard.js
CHANGED
|
@@ -148,8 +148,14 @@ class ShellMirrorDashboard {
|
|
|
148
148
|
}
|
|
149
149
|
|
|
150
150
|
renderActiveAgents() {
|
|
151
|
-
|
|
152
|
-
const
|
|
151
|
+
// Filter for recently active agents (online or seen within last 5 minutes)
|
|
152
|
+
const activeAgents = this.agents.filter(agent => {
|
|
153
|
+
const timeSinceLastSeen = Date.now() / 1000 - agent.lastSeen;
|
|
154
|
+
return agent.onlineStatus === 'online' || timeSinceLastSeen < 300; // 5 minutes
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
const agentCount = activeAgents.length;
|
|
158
|
+
const agentsHtml = activeAgents.map(agent => `
|
|
153
159
|
<div class="agent-item">
|
|
154
160
|
<div class="agent-info">
|
|
155
161
|
<div class="agent-name">${agent.machineName || agent.agentId}</div>
|
|
@@ -200,8 +206,31 @@ class ShellMirrorDashboard {
|
|
|
200
206
|
}
|
|
201
207
|
|
|
202
208
|
renderRecentSessions() {
|
|
203
|
-
|
|
204
|
-
|
|
209
|
+
// Get inactive agents (not seen in last 5 minutes and offline)
|
|
210
|
+
const inactiveAgents = this.agents.filter(agent => {
|
|
211
|
+
const timeSinceLastSeen = Date.now() / 1000 - agent.lastSeen;
|
|
212
|
+
return agent.onlineStatus === 'offline' && timeSinceLastSeen >= 300; // More than 5 minutes
|
|
213
|
+
});
|
|
214
|
+
|
|
215
|
+
// Combine real sessions with inactive agents as past connections
|
|
216
|
+
const allSessions = [
|
|
217
|
+
// Add inactive agents as past connections
|
|
218
|
+
...inactiveAgents.map(agent => ({
|
|
219
|
+
type: 'past_agent',
|
|
220
|
+
agentId: agent.machineName || agent.agentId,
|
|
221
|
+
startTime: new Date(agent.lastSeen * 1000),
|
|
222
|
+
duration: 'Last connection',
|
|
223
|
+
status: 'disconnected'
|
|
224
|
+
})),
|
|
225
|
+
// Add actual session history
|
|
226
|
+
...this.sessions
|
|
227
|
+
];
|
|
228
|
+
|
|
229
|
+
// Sort by most recent
|
|
230
|
+
allSessions.sort((a, b) => b.startTime - a.startTime);
|
|
231
|
+
|
|
232
|
+
const sessionsHtml = allSessions.map(session => `
|
|
233
|
+
<div class="session-item compact">
|
|
205
234
|
<div class="session-info">
|
|
206
235
|
<div class="session-agent">${session.agentId}</div>
|
|
207
236
|
<div class="session-time">${this.formatDate(session.startTime)}</div>
|
|
@@ -217,7 +246,7 @@ class ShellMirrorDashboard {
|
|
|
217
246
|
<div class="dashboard-card full-width">
|
|
218
247
|
<h2>📊 Recent Sessions</h2>
|
|
219
248
|
<div class="card-content">
|
|
220
|
-
${
|
|
249
|
+
${allSessions.length > 0 ? sessionsHtml : '<p class="no-data">No recent sessions</p>'}
|
|
221
250
|
</div>
|
|
222
251
|
</div>
|
|
223
252
|
`;
|