199 lines
5.4 KiB
HTML
199 lines
5.4 KiB
HTML
<!doctype html>
|
|
<html lang="en">
|
|
<head>
|
|
<!-- Required meta tags -->
|
|
<meta charset="utf-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
|
<title>INSTALLER TOOL</title>
|
|
<!-- Bootstrap CSS -->
|
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.2.1/dist/css/bootstrap.min.css" integrity="sha384-GJzZqFGwb1QTTN6wy59ffF1BuGJpLSa9DkKMp0DgiMDm4iYMj70gZWKYbI706tWS" crossorigin="anonymous">
|
|
<!-- Custom styles for this template -->
|
|
<link href="installer.css?t=1" rel="stylesheet">
|
|
</head>
|
|
<body id="scan" class="text-center">
|
|
<div class="container-fluid">
|
|
<div class="col-md-12">
|
|
<h1>Scanning your device for any previous installed versions</h1>
|
|
<div class="row d-flex justify-content-center mt-100">
|
|
<div class="progress blue" data-value="100">
|
|
<span class="progress-left">
|
|
<span class="progress-bar"></span>
|
|
</span>
|
|
<span class="progress-right">
|
|
<span class="progress-bar"></span>
|
|
</span>
|
|
<div class="progress-value"></div>
|
|
</div>
|
|
</div>
|
|
<div><a href="install.html" class="stop">STOP AND START INSTALL</a></div>
|
|
<br>
|
|
<br>
|
|
<div id="redis"></div>
|
|
<div id="previous"></div>
|
|
</div>
|
|
</div>
|
|
<!-- Optional JavaScript -->
|
|
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
|
|
<script src="https://code.jquery.com/jquery-3.7.1.min.js"></script>
|
|
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.14.6/dist/umd/popper.min.js" integrity="sha384-wHAiFfRlMFy6i5SRaxvfOCifBUQy1xHdJ/yoi7FRNXMRBu5WHdZYu1hA6ZOblgut" crossorigin="anonymous"></script>
|
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.2.1/dist/js/bootstrap.min.js" integrity="sha384-B0UglyR+jN6CkvvICOB2joaf5I4l3gm9GU6Hc1og6Ls7i6U/mkkaduKaBhlAXv9k" crossorigin="anonymous"></script>
|
|
<script>
|
|
$(function() {
|
|
|
|
function redirectToInstall() {
|
|
window.location.href = 'install.html';
|
|
}
|
|
|
|
function redirectToManage() {
|
|
window.location.href = 'manage.html';
|
|
}
|
|
|
|
function start_system() {
|
|
var url = 'scan.php?op=system';
|
|
$.get(url, function(data){
|
|
console.log('start_system: '+data);
|
|
if (data=='OK') {
|
|
$("#previous").html('Scanning for previous install. Please wait...');
|
|
check_system();
|
|
}
|
|
else {
|
|
$("#previous").html('Scanning for previous install has aborted...');
|
|
}
|
|
});
|
|
}
|
|
|
|
function check_system() {
|
|
var url = 'scan.php?op=check_system';
|
|
$.get(url, function(data){
|
|
console.log('check_system: '+data);
|
|
if (data=='NEW') {
|
|
$("#previous").html('No previous install has found...');
|
|
setTimeout(redirectToInstall, 3000);
|
|
}
|
|
else if (data=='EXISTS') {
|
|
$("#previous").html('Previous install has found...');
|
|
setTimeout(redirectToManage, 3000);
|
|
}
|
|
else if (data=='WAIT') {
|
|
setTimeout(check_system, 1000);
|
|
}
|
|
else {
|
|
// UNEXPECTED ERROR
|
|
}
|
|
});
|
|
}
|
|
|
|
function check_redis() {
|
|
|
|
var url = 'scan.php?op=redis';
|
|
$.get(url, function(data){
|
|
console.log('check_redis: '+data);
|
|
if (data=='OK') {
|
|
$("#redis").html('Redis server - OK');
|
|
start_system();
|
|
}
|
|
else {
|
|
$("#redis").html('Redis server is not available...');
|
|
setTimeout(check_redis, 1000);
|
|
}
|
|
});
|
|
}
|
|
|
|
function check_directory() {
|
|
|
|
var url = 'scan.php?op=directory';
|
|
$.get(url, function(data){
|
|
console.log('check_directory: '+data);
|
|
if (data=='OK') {
|
|
$("#redis").html('Connection is ready - OK');
|
|
start_system();
|
|
}
|
|
else {
|
|
$("#redis").html('Shared directory is not available...');
|
|
}
|
|
});
|
|
}
|
|
|
|
function check_interface() {
|
|
|
|
var url = 'scan.php?op=get_interface';
|
|
$.get(url, function(data){
|
|
console.log('check_interface: '+data);
|
|
if (data=='redis') {
|
|
check_redis();
|
|
}
|
|
else if (data=='directory') {
|
|
check_directory();
|
|
}
|
|
else {
|
|
$("#redis").html('Invalid interface definition...');
|
|
}
|
|
});
|
|
}
|
|
|
|
check_interface();
|
|
|
|
//setTimeout(redirectToManage, 10000);
|
|
|
|
$(".progress").each(function() {
|
|
|
|
var value = $(this).attr('data-value');
|
|
var left = $(this).find('.progress-left .progress-bar');
|
|
var right = $(this).find('.progress-right .progress-bar');
|
|
|
|
if (value > 0) {
|
|
/*
|
|
angle1 = getRotationDegrees(right);
|
|
angle2 = getRotationDegrees(left);
|
|
console.log(angle1);
|
|
console.log(angle2);
|
|
idx=1
|
|
while (idx < 50) {
|
|
angle1 = getRotationDegrees(right);
|
|
angle2 = getRotationDegrees(left);
|
|
console.log(angle1);
|
|
console.log(angle2);
|
|
$('div.progress-value').html(angle2);
|
|
idx++;
|
|
}
|
|
*/
|
|
/*
|
|
if (value <= 50) {
|
|
right.css('transform', 'rotate(' + percentageToDegrees(value) + 'deg)')
|
|
} else {
|
|
right.css('transform', 'rotate(180deg)')
|
|
left.css('transform', 'rotate(' + percentageToDegrees(value - 50) + 'deg)')
|
|
}
|
|
*/
|
|
}
|
|
|
|
})
|
|
|
|
function percentageToDegrees(percentage) {
|
|
return percentage / 100 * 360
|
|
}
|
|
|
|
/**
|
|
* Returns rotation in degrees when obtaining transform-styles using javascript
|
|
* http://stackoverflow.com/questions/8270612/get-element-moz-transformrotate-value-in-jquery
|
|
*/
|
|
function getRotationDegrees(obj) {
|
|
var matrix = obj.css("-webkit-transform") ||
|
|
obj.css("-moz-transform") ||
|
|
obj.css("-ms-transform") ||
|
|
obj.css("-o-transform") ||
|
|
obj.css("transform");
|
|
if(matrix !== 'none') {
|
|
var values = matrix.split('(')[1].split(')')[0].split(',');
|
|
var a = values[0];
|
|
var b = values[1];
|
|
var angle = Math.round(Math.atan2(b, a) * (180/Math.PI));
|
|
} else { var angle = 0; }
|
|
return angle;
|
|
}
|
|
|
|
});
|
|
</script>
|
|
</body>
|
|
</html>
|