db in one refactor

This commit is contained in:
Tony Murray
2020-06-15 21:30:39 -05:00
parent 229a501d4f
commit ed3e818413
4 changed files with 63 additions and 75 deletions

View File

@ -19,7 +19,7 @@ return [
'database' => [
'title' => 'Configure Database',
'status' => 'Status',
'test' => 'Test',
'test' => 'Check Connection',
'host' => 'Host',
'port' => 'Port',
'socket' => 'Unix-Socket',

View File

@ -63,6 +63,19 @@
</form>
</div>
</div>
<div id="migration-output" class="row">
<div class="col-12">
<label for="db-update">@lang('install.migrate.building')<br />@lang('install.migrate.building_interrupt')</label>
<textarea readonly id="db-update" class="form-control" rows="20" placeholder="@lang('install.migrate.wait')"></textarea>
</div>
</div>
<div class="row">
<div class="col-12">
<button type="button" id="retry-btn" onClick="window.location.reload()" class="btn btn-success pull-right">
@lang('install.migrate.retry')
</button>
</div>
</div>
@endsection
@section('scripts')
@ -90,5 +103,50 @@
},
});
});
function run_migrations() {
var output = document.getElementById("db-update");
var xhr = new XMLHttpRequest();
xhr.open("GET", "{{ route('install.action.migrate') }}", true);
xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
xhr.withCredentials = true;
xhr.onprogress = function (e) {
output.innerHTML = e.currentTarget.responseText;
output.scrollTop = output.scrollHeight - output.clientHeight; // scrolls the output area
if (output.innerHTML.indexOf('Error!') !== -1) {
// if error word in output, show the retry button
$("#retry-btn").css("display", "");
$('#error-box').append($('<div class="alert alert-danger">@lang('install.migrate.error')</div>'))
}
};
xhr.timeout = 240000; // if no response for 4m, allow the user to retry
xhr.ontimeout = function (e) {
$("#retry-btn").css("display", "");
$('#error-box').append($('<div class="alert alert-danger">@lang('install.migrate.timeout')</div>'))
};
xhr.onreadystatechange = function () {
if (xhr.readyState === XMLHttpRequest.DONE && xhr.status === 200) {
checkStepStatus();
}
};
xhr.send();
}
</script>
@endsection
@section('style')
<style type="text/css">
label[for=db-update] {
font-size: large;
}
#db-update {
resize:vertical;
}
#retry-btn {
display: none;
}
#migration-output {
display: none;
}
</style>
@endsection

View File

@ -1,63 +0,0 @@
@extends('layouts.install')
@section('title', trans('install.migrate.title'))
@section('content')
<div class="row">
<div class="col-12">
<label for="db-update">@lang('install.migrate.building')<br />@lang('install.migrate.building_interrupt')</label>
<textarea readonly id="db-update" class="form-control" rows="20" placeholder="@lang('install.migrate.wait')"></textarea>
</div>
</div>
<div class="row">
<div class="col-12">
<button type="button" id="retry-btn" onClick="window.location.reload()" class="btn btn-success pull-right">
@lang('install.migrate.retry')
</button>
</div>
</div>
@endsection
@section('scripts')
<script type="text/javascript">
var output = document.getElementById("db-update");
var xhr = new XMLHttpRequest();
xhr.open("GET", "{{ route('install.action.migrate') }}", true);
xhr.setRequestHeader('X-Requested-With','XMLHttpRequest');
xhr.withCredentials = true;
xhr.onprogress = function (e) {
output.innerHTML = e.currentTarget.responseText;
output.scrollTop = output.scrollHeight - output.clientHeight; // scrolls the output area
if (output.innerHTML.indexOf('Error!') !== -1) {
// if error word in output, show the retry button
$("#retry-btn").css("display", "");
$('#error-box').append($('<div class="alert alert-danger">@lang('install.migrate.error')</div>'))
}
};
xhr.timeout = 240000; // if no response for 4m, allow the user to retry
xhr.ontimeout = function (e) {
$("#retry-btn").css("display", "");
$('#error-box').append($('<div class="alert alert-danger">@lang('install.migrate.timeout')</div>'))
};
xhr.onreadystatechange = function () {
if (xhr.readyState === XMLHttpRequest.DONE && xhr.status === 200) {
checkStepStatus();
}
};
xhr.send();
</script>
@endsection
@section('style')
<style type="text/css">
label[for=db-update] {
font-size: large;
}
#db-update {
resize:vertical;
}
#retry-btn {
display: none;
}
</style>
@endsection

View File

@ -38,18 +38,11 @@
#progress-icons {
background: linear-gradient(to bottom, #EEEEEE 50%, white 50%)
}
.btn-circle {
background-color: #70A9A1;
border-color: #66A39B;
}
.btn-circle:hover {
background-color: #548C85;
border-color: #4D807A;
}
.btn-circle.disabled {
opacity: 1;
background-color: #A6C9C5;
border-color: #9AC1BC;
background-color: #62bcca;
border-color: #64c0ce;
}
.install-progress {
@ -89,7 +82,7 @@
<div>
<a href="{{ route('install.' . $step) }}"
id="install-{{ $step }}-button"
class="btn btn-primary btn-circle @if(!$controller->enabled($steps)) disabled @endif"
class="btn btn-info btn-circle @if(!$controller->enabled($steps)) disabled @endif"
title="@lang("install.$step.title")"
>
<i class="fa fa-lg {{ $controller->icon() }}"></i>