Files
radixOS/public/views/integrated/serverinfo.hbs
2026-04-28 15:35:20 +02:00

85 lines
2.8 KiB
Handlebars

<div class="container">
<div class="card">
<span style="font-weight: bold;">Dienst</span>
<button class="redbutton" id="shutdownButton">Abschalten</button>
<button class="yellowbutton" id="restartButton">Neustart</button>
<div>
<span>PID:</span> <span class="selectable" id="pid"></span>
<span class="copy-icon" onclick="copyToClipboard(`${document.getElementById('pid').textContent}`)">⧉</span>
</div>
</div>
<div class="card">
<div class="table-wrapper" style="max-height:250px;height:100%">
<table id="releaseNotes">
<thead>
<tr>
<th class="text-align:left">Erledigt</th>
<th class="text-align:left">Timestamp</th>
<th class="text-align:left">User</th>
<th class="text-align:left">Note</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
<div class="card static" style="min-height:150px">
<div id="package" style="overflow:auto"></div>
</div>
</div>
<script>
shutdownButton.onclick = evt => {
fetch('/api/shutdown', { method: 'POST' })
.then(res => res.json())
.then(json => {
console.log(json);
});
};
restartButton.onclick = evt => {
fetch('/api/restart', { method: 'POST' })
.then(res => res.json())
.then(json => {
console.log(json);
});
};
fetch('/api/serverInfo/get', { method: 'POST' })
.then(res => res.json())
.then(json => {
document.querySelector('#pid').innerHTML = json.pid;
const vt = virtualTable({
tableEl: document.getElementById('releaseNotes'),
data: [],
buffer: 5,
rowHeight: 30,
customRender: (row, tr) => {
createTd(tr,
`
<label class="cb cb-modern">
<input id="id1" data-status="{{name}}" type="checkbox" ${row.finish ? 'checked' : ''} >
<span class="cb-box" aria-hidden="true"></span>
</label>
`, { });
createTd(tr, row.datetime, { });
createTd(tr, row.sAMAccountName, { });
createTd(tr, row.value, { attributes: { "data-tooltip": row.value } });
}
});
vt.addData(json.releaseNotes.sort((a, b) => new Date(b.datetime) - new Date(a.datetime)));
createJsonTree({
container: document.getElementById("package"),
data: json.package,
expandInitially: true,
readonly: true
});
});
</script>