commit 1d105a3bfaef2ef36b1d8e2dc916057e32234f83 Author: chris bell Date: Fri Jun 5 18:11:04 2026 -0500 Inial commit (basic UI) diff --git a/app.js b/app.js new file mode 100644 index 0000000..ff1f7b2 --- /dev/null +++ b/app.js @@ -0,0 +1,83 @@ +const DAEMON_URL = 'http://127.0.0.1:12345'; + +document.addEventListener('DOMContentLoaded', () => { + fetchInstances(); + document.getElementById('refresh-btn').addEventListener('click', fetchInstances); +}); + + +async function fetchInstances() { + const tableBody = document.getElementById('instances-table-body'); + + try { + const response = await fetch(`${DAEMON_URL}/instances/list`); + if (!response.ok) throw new Error(`Server returned code: ${response.status}`); + + const instances = await response.json(); + renderTable(instances); + } catch (error) { + console.error('Failed fetching telemetry data:', error); + tableBody.innerHTML = `Offline: Could not connect to vs-manager daemon.`; + } +} + + +function renderTable(instances) { + const tableBody = document.getElementById('instances-table-body'); + + if (!instances || instances.length === 0) { + tableBody.innerHTML = `No server configurations registered.`; + return; + } + + tableBody.innerHTML = ''; + + instances.forEach(inst => { + const row = document.createElement('tr'); + const isRunning = inst.status === 'RUNNING'; + + row.innerHTML = ` + ${inst.name} + ${inst.version} + ${inst.port} + ${inst.status} + + + + `; + + tableBody.appendChild(row); + }); + + + document.querySelectorAll('.action-btn').forEach(btn => { + btn.addEventListener('click', handleAction); + }); +} + + +async function handleAction(e) { + const button = e.target; + const name = button.getAttribute('data-name'); + const action = button.getAttribute('data-action'); + + button.disabled = true; + button.innerText = 'Processing...'; + + try { + const response = await fetch(`${DAEMON_URL}/instances/${action}?name=${encodeURIComponent(name)}`, { + method: 'POST' + }); + + if (!response.ok) { + const errText = await response.text(); + alert(`Action Failed: ${errText}`); + } + } catch (error) { + alert(`Network transmission failure: ${error.message}`); + } finally { + await fetchInstances(); + } +} \ No newline at end of file diff --git a/index.html b/index.html new file mode 100644 index 0000000..8ceb20d --- /dev/null +++ b/index.html @@ -0,0 +1,41 @@ + + + + + + VS Manager Dashboard + + + +

Vintage Story Manager Hub

+ + + + + + + + + + + + + + + + + +
Instance NameVersionPortStatusActions
Connecting to daemon infrastructure...
+ + + + \ No newline at end of file