53 lines
960 B
JavaScript
53 lines
960 B
JavaScript
|
|
async function init() {
|
|
try {
|
|
|
|
connection = await wh.get(`iip://${window.location.hostname}`, {
|
|
autoReconnect: true
|
|
});
|
|
|
|
window.service = await connection.get("sys/service");
|
|
|
|
await app.setData(connection);
|
|
console.log(connection);
|
|
|
|
|
|
}
|
|
catch (ex)
|
|
{
|
|
alert(ex);
|
|
}
|
|
}
|
|
|
|
async function addJob() {
|
|
let cmd = prompt("Job command", "");
|
|
|
|
if (cmd != null) {
|
|
try {
|
|
await service.Compute(cmd, "");
|
|
} catch (ex) {
|
|
alert(ex);
|
|
}
|
|
}
|
|
|
|
document.getElementById("list").update();
|
|
}
|
|
|
|
async function addAgent() {
|
|
let ip = prompt("Agent IP or hostname", "");
|
|
|
|
if (ip != null) {
|
|
try {
|
|
await service.AddAgent(ip);
|
|
} catch (ex) {
|
|
alert(ex);
|
|
}
|
|
}
|
|
|
|
document.getElementById("list").update();
|
|
|
|
}
|
|
|
|
const FORMAT_CONNECTION_STATUS = (x) => ["Offline", "Connecting...", "Online"][x];
|
|
|
|
|