picluster/web/functions-create.html

99 lines
2.9 KiB
HTML
Raw 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 get_function = document.getElementById("function-name").value.length > 1 ? document.getElementById("function-name").value : '';
var function_args = document.getElementById("function-args").value.length > 1 ? document.getElementById("function-args").value : '';
if (get_function.length > 1) {
$.get("/function?token=" + parent.token + '&function=' + get_function + '&container_args=' + function_args, function(create_data) {
modal.style.display = "none";
output_modal.style.display = "block";
});
} else {
alert('Error, you did enter a function name.')
modal.style.display = "block";
output_modal.style.display = "none";
}
}
</script>
</head>
<body>
<div id="modal_container" class="modal">
<div class="modal-content modal-small">
<div class="modal-header">
<span class="close">&times;</span>
<h2>Create a function</h2>
</div>
<div class="modal-body">
<label>Create functions for testing purposes.</label>
<fieldset name="functions" id="functions">
<legend><b>Function Name</b></legend>
<label><i>This should correspond to the container name in the Docker folder.</i></label>
<br><br>
<label>Name</label>
<input type="text" id="function-name" class="modal_input" name="function-name" value=""></font>
</fieldset>
<fieldset name="options" id="options">
<legend><b>Container Arguments</b> <i>(Optional)</i></legend>
</select>
<label><i>Additional Docker arguments if needed such as ENVAR's or ports.</i></label>
<br><br>
<label>Arguments</label>
<input type="text" id="function-args" class="modal_input" name="function-args" value=""></font>
</fieldset>
<div id="submit_button_div">
<button id="submit_button">Create</button>
</div>
</div>
</div>
</div>
<div id="output" class="modal">
<div class="modal-content modal-large">
<div class="modal-header">
<span class="close">&times;</span>
<h2>Command Output</h2>
</div>
<div id="functions-create-modal-body" class="modal-body">
Sent request to create function.
</div>
</div>
</div>
<script>
var modal = document.getElementById('modal_container');
var span = document.getElementsByClassName("close")[0];
var output_modal = document.getElementById('output');
var output_span = document.getElementsByClassName("close")[1];
var submit_button = document.getElementById("submit_button");
span.onclick = function () {
modal.style.display = "none";
}
output_span.onclick = function () {
output_modal.style.display = "none";
}
submit_button.onclick = function () {
exec();
}
modal.style.display = "block";
</script>
</html>