Added Ping behaviour and loader circle.

When opening website, check will run wether api is reachable
This commit is contained in:
glax 2023-09-08 16:32:48 +02:00
parent 37e2a74c39
commit f791d1f977

View File

@ -41,28 +41,37 @@ const newMangaTitle = document.querySelector("#newMangaTitle");
const newMangaResult = document.querySelector("#newMangaResult"); const newMangaResult = document.querySelector("#newMangaResult");
const jobsRunningTag = document.querySelector("#jobsRunningTag"); const jobsRunningTag = document.querySelector("#jobsRunningTag");
const jobsQueuedTag = document.querySelector("#jobsQueuedTag"); const jobsQueuedTag = document.querySelector("#jobsQueuedTag");
const loaderdiv = document.querySelector('#loaderdiv');
function Setup(){ function Setup(){
GetAvailableNotificationConnectors().then((json) => { Ping().then((ret) => {
json.forEach(connector => { loaderdiv.style.display = 'none';
notificationConnectorTypes[connector.Key] = connector.Value;
GetAvailableNotificationConnectors().then((json) => {
json.forEach(connector => {
notificationConnectorTypes[connector.Key] = connector.Value;
});
}); });
});
GetAvailableLibraryConnectors().then((json) => { GetAvailableLibraryConnectors().then((json) => {
json.forEach(connector => { json.forEach(connector => {
libraryConnectorTypes[connector.Key] = connector.Value; libraryConnectorTypes[connector.Key] = connector.Value;
});
}); });
});
GetAvailableControllers().then((json) => {
GetAvailableControllers().then((json) => { json.forEach(connector => {
json.forEach(connector => { var option = document.createElement('option');
var option = document.createElement('option'); option.value = connector;
option.value = connector; option.innerText = connector;
option.innerText = connector; newMangaConnector.appendChild(option);
newMangaConnector.appendChild(option); });
}); });
UpdateJobs();
setInterval(() => {
UpdateJobs();
}, 1000);
}); });
} }
Setup(); Setup();
@ -331,17 +340,13 @@ function UpdateSettings(){
} }
OpenSettings(); OpenSettings();
Setup();
} }
function utf8_to_b64(str) { function utf8_to_b64(str) {
return window.btoa(unescape(encodeURIComponent( str ))); return window.btoa(unescape(encodeURIComponent( str )));
} }
UpdateJobs();
setInterval(() => {
UpdateJobs();
}, 1000);
function UpdateJobs(){ function UpdateJobs(){
GetMonitorJobs().then((json) => { GetMonitorJobs().then((json) => {
ResetContent(); ResetContent();