Skip to content

Commit 33c2b73

Browse files
committed
refact: fleet server
1 parent 71308c6 commit 33c2b73

3 files changed

Lines changed: 11 additions & 7 deletions

File tree

‎fleet-server/server.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,8 @@ app.get('/ui', requireAuth, (req, res) => {
9797
const list = Object.values(clients).map(c => ({
9898
id: c.id,
9999
hostname: c.hostname || '-',
100-
status: c.status,
101-
metrics: c.metrics || { resources: {} }
100+
connection: c.status,
101+
metrics: c.metrics || { resources: {}, state: {} }
102102
}));
103103
res.render('clients', { clients: list });
104104
});

‎fleet-server/views/clients.handlebars‎

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1+
<button onClick="location.reload()" style="float: right;">refresh</button>
12
<h1>CuOS Fleet</h1>
23
<table>
34
<thead>
45
<tr>
56
<th>Hostname</th>
6-
<th>UUID</th>
77
<th>Connection</th>
88
<th>Status</th>
9+
<th>CuOS Version</th>
10+
<th>Last Update</th>
911
<th>CPU%</th>
1012
<th>RAM%</th>
1113
<th>Disk%</th>
@@ -17,10 +19,11 @@
1719
{{#if clients.length}}
1820
{{#each clients}}
1921
<tr>
20-
<td>{{hostname}}</td>
21-
<td><small>{{id}}</small></td>
22-
<td class="status-{{status}}">{{status}}</td>
23-
<td class="status-{{state?.status}}">{{state?.status}}</td>
22+
<td title="{{id}}">{{hostname}}</td>
23+
<td class="status-{{connection}}">{{connection}}</td>
24+
<td class="status-{{metrics.state.state}}">{{metrics.state.state}}</td>
25+
<td class="version">{{metrics.state.version}}</td>
26+
<td class="last_update">{{formatDate metrics.state.last_update_date}}</td>
2427
<td class="metrics-cell">{{metrics.resources.cpu_usage}}{{#if metrics.resources.cpu_usage}}%{{/if}}</td>
2528
<td class="metrics-cell">{{metrics.resources.ram_percent}}{{#if metrics.resources.ram_percent}}%{{/if}}</td>
2629
<td class="metrics-cell">{{metrics.resources.disk_percent}}{{#if metrics.resources.disk_percent}}%{{/if}}</td>

‎fleet-server/views/layouts/main.handlebars‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
.status-offline { color: #999; }
1515
.status-updating { color: #e67e22; }
1616
.status-error { color: #c00; }
17+
.status-running { color: #0a0; }
1718
.metrics-cell { font-variant-numeric: tabular-nums; }
1819
form.inline { display:inline; }
1920
button { cursor:pointer; }

0 commit comments

Comments
 (0)