install-finish-magic

Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann
2022-08-20 13:44:44 +02:00
parent 07094f231a
commit 3ee04a6e75
9 changed files with 66 additions and 11 deletions

View File

@@ -60,7 +60,8 @@
<a href="?step={{ setup.step - 1 }}" class="btn btn-secondary">&laquo; {{ lng('panel.back') }}</a>
<button type="submit" name="submit" class="btn btn-primary">{{ lng('panel.next') }} &raquo;</button>
{% else %}
<button type="submit" name="submit" class="btn btn-success">{{ lng('install.install.top') }} &raquo;</button>
<span id="submitAuto"><i class="fas fa-spinner fa-pulse"></i> {{ lng('install.install.waitforconfig') }}</span>
<button id="submitManual" type="submit" name="submit" class="btn btn-success d-none">{{ lng('install.install.top') }} &raquo;</button>
{% endif %}
</div>
{% else %}

View File

@@ -11,7 +11,7 @@
<pre>chown -R {{ user }}:{{ group }} {{ installdir }}</pre>
<hr>
<p class="mt-1 text-center">
<a href="./install/install.php" class="btn btn-primary" title="Click to start the install process">Start install</a>
<a href="" class="btn btn-primary" title="Reload page">Reload</a>
</p>
</div>
</div>

View File

@@ -4,7 +4,7 @@ $(function () {
*/
$('#switchInstallMode').on('click', function () {
var checked = $(this).prop('checked');
window.location = '/install/install.php' + replaceQueryParam('extended', +checked, window.location.search);
window.location = window.location.pathname + replaceQueryParam('extended', +checked, window.location.search);
});
function replaceQueryParam(param, newval, search) {
@@ -14,4 +14,49 @@ $(function () {
}
return search + '&' + param + '=' + newval;
}
function checkConfigState() {
$.ajax({
url: window.location.href,
type: "GET",
success: function (data, textStatus, request) {
if (request.status >= 300) {
window.location = "http://" + srvName;
}
},
error: function (request, textStatus, errorThrown) {
// continue
if (request.status >= 300) {
window.location = "http://" + srvName;
}
}
});
}
var cTimer;
/**
* check manual-config switch
*/
$('#manual_config').on('click', function () {
clearInterval(cTimer);
var checked = $(this).prop('checked');
if (checked) {
// button zum login
$('#submitAuto').addClass('d-none');
$('#submitManual').removeClass('d-none');
} else {
cTimer = setInterval(checkConfigState, 1000);
// spinner fürs warten
$('#submitAuto').removeClass('d-none');
$('#submitManual').addClass('d-none');
}
});
if ($('#manual_config').length > 0) {
var srvName = $('#target_servername').val();
clearInterval(cTimer);
cTimer = setInterval(checkConfigState, 1000);
}
});