picluster/web/hosts-edit.html

73 lines
1.6 KiB
HTML
Raw Permalink Normal View History

2021-08-25 08:44:55 -06:00
<html>
<head>
<script src="/assets/jquery.min.js"></script>
<link rel="stylesheet" href="/assets/jquery-ui.css">
<script src="/assets/jquery-ui.js"></script>
<script src="/assets/distLogo.js"></script>
<link rel="stylesheet" href="/assets/picluster-iframe.css">
<script>
function exec() {
var payload = $("#payload").val();
try {
var payload_json = JSON.parse(payload);
} catch (err) {}
$.post("/sendhosts", {
token: parent.token,
payload: payload
}, function (data) {
var output = data.replace(/(?:\r\n|\r|\n)/g, '<br />');
alert(output);
});
};
function getconfig() {
$.get("/gethosts?token=" + parent.token, function (data) {
$("#payload").val(data);
});
};
</script>
</head>
<body>
<div id="modal_container" class="modal">
<div class="modal-content modal-large">
<div class="modal-header">
<span class="close">&times;</span>
<h2>PiCluster Hosts Configuraton Editor</h2>
</div>
<div class="modal-body">
<div id="config_editor" title="PiCluster Hosts Editor">
<textarea id="payload" name="payload" value="" enctype="application/json"></textarea>
<br><br>
<div id="submit_button_div">
<button id="submit_button">Submit</button>
</div>
</div>
</div>
</div>
</div>
<script>
var modal = document.getElementById('modal_container');
var span = document.getElementsByClassName("close")[0];
var submit_button = document.getElementById("submit_button");
span.onclick = function () {
modal.style.display = "none";
}
submit_button.onclick = function () {
exec();
}
modal.style.display = "block";
getconfig();
</script>
</body>
</html>