webcron-site/main.js

67 lines
1.5 KiB
JavaScript
Raw Normal View History

function setAreaByUrl(url){
response = makeRequest(url);
setInfoSection(response);
}
function setDatabaseVersion() {
url = '/api/database_version.php';
setAreaByUrl(url);
}
function makeRequest(url){
var request = new XMLHttpRequest();
request.open("GET", url, false);
request.send(null);
return request.responseText;
}
function setCrontabStats(){
2023-05-15 21:55:42 +00:00
url = "/api/crontab_stats.php";
setAreaByUrl(url);
}
function setInfoSection (string) {
var info_section = document.getElementById("content");
info_section.innerHTML = string;
}
function getTable(name){
url = "/api/table.php?name="+name;
setAreaByUrl(url);
}
function listTables(){
url="/api/table.php?action=list";
setAreaByUrl(url);
}
2023-05-15 21:45:18 +00:00
function getCrontabs (){
2023-05-15 21:55:42 +00:00
url = "/api/table.php?name='crontabs'&columns=crontab_path,crontab_created_timestamp,crontab_modified_timestamp";
setAreaByUrl(url);
}
function listCrontabs(){
url = "/api/crontab.php?action=list";
setAreaByUrl(url);
}
function loadCrontab (id){
url = "/api/crontab_view.php?id="+id;
setAreaByUrl(url);
2023-05-15 21:45:18 +00:00
}
function test (){
2023-05-15 21:55:42 +00:00
url = "/api/crontab_view.php?name=0hourly";
setAreaByUrl(url);
}
function update_crons () {
url = "/api/update.php?target=crontabs";
setAreaByUrl(url);
2023-05-15 21:45:18 +00:00
}
function triggerPopup(info_to_get){
const modal = document.querySelector('dialog');
document.querySelector("#popup_button").addEventListener("click", () => {modal.showModal();});
2023-05-15 21:55:42 +00:00
}