Merge pull request #204 from schrej/feature/terminal-only-scroll-at-bottom
Only auto-scroll terminal on new output when at the bottom
This commit is contained in:
commit
c3abb32c0c
4 changed files with 89 additions and 42 deletions
38
public/js/jquery.terminal-0.11.23.min.js
vendored
Normal file
38
public/js/jquery.terminal-0.11.23.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
37
public/js/jquery.terminal-0.11.6.min.js
vendored
37
public/js/jquery.terminal-0.11.6.min.js
vendored
File diff suppressed because one or more lines are too long
|
@ -286,6 +286,24 @@ li.btn.btn-default.pill:active,li.btn.btn-default.pill:focus,li.btn.btn-default.
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#consoleNotify {
|
||||||
|
position: absolute;
|
||||||
|
bottom: 0;
|
||||||
|
margin-right: 17px;
|
||||||
|
margin-bottom: 2px;
|
||||||
|
z-index: 10;
|
||||||
|
background: white;
|
||||||
|
right: 0;
|
||||||
|
opacity: .6;
|
||||||
|
padding: 5px 7px;
|
||||||
|
border-radius: 5px;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
#consoleNotify:hover {
|
||||||
|
opacity: .9;
|
||||||
|
}
|
||||||
|
|
||||||
.hasFileHover {
|
.hasFileHover {
|
||||||
border: 2px dashed #0087F7;
|
border: 2px dashed #0087F7;
|
||||||
border-radius: 5px;
|
border-radius: 5px;
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
@parent
|
@parent
|
||||||
{!! Theme::css('css/jquery.terminal.css') !!}
|
{!! Theme::css('css/jquery.terminal.css') !!}
|
||||||
{!! Theme::js('js/jquery.mousewheel-min.js') !!}
|
{!! Theme::js('js/jquery.mousewheel-min.js') !!}
|
||||||
{!! Theme::js('js/jquery.terminal-0.11.6.min.js') !!}
|
{!! Theme::js('js/jquery.terminal-0.11.23.min.js') !!}
|
||||||
{!! Theme::js('js/unix_formatting.js') !!}
|
{!! Theme::js('js/unix_formatting.js') !!}
|
||||||
{!! Theme::js('js/vendor/chartjs/chart.min.js') !!}
|
{!! Theme::js('js/vendor/chartjs/chart.min.js') !!}
|
||||||
{!! Theme::js('js/vendor/jquery/jquery-dateFormat.min.js') !!}
|
{!! Theme::js('js/vendor/jquery/jquery-dateFormat.min.js') !!}
|
||||||
|
@ -50,6 +50,9 @@
|
||||||
<div class="alert alert-info hidden" id="consoleThrottled">
|
<div class="alert alert-info hidden" id="consoleThrottled">
|
||||||
The console is currently being throttled due to the speed at which data is being sent. Messages are being queued and will appear as the queue is worked through.
|
The console is currently being throttled due to the speed at which data is being sent. Messages are being queued and will appear as the queue is worked through.
|
||||||
</div>
|
</div>
|
||||||
|
<div id="consoleNotify" class="hidden">
|
||||||
|
<i class="fa fa-bell"></i>
|
||||||
|
</div>
|
||||||
<div id="terminal">
|
<div id="terminal">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -193,11 +196,31 @@ $(window).load(function () {
|
||||||
height: 400,
|
height: 400,
|
||||||
exit: false,
|
exit: false,
|
||||||
prompt: '{{ $server->username }}:~$ ',
|
prompt: '{{ $server->username }}:~$ ',
|
||||||
|
scrollOnEcho: false,
|
||||||
|
scrollBottomOffset: 5,
|
||||||
onBlur: function (terminal) {
|
onBlur: function (terminal) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const $consoleNotify = $('#consoleNotify');
|
||||||
|
$consoleNotify.on('click', function () {
|
||||||
|
terminal.scroll_to_bottom();
|
||||||
|
$consoleNotify.removeClass('hidden');
|
||||||
|
});
|
||||||
|
|
||||||
|
terminal.on('scroll', function() {
|
||||||
|
if (terminal.is_bottom()) {
|
||||||
|
$consoleNotify.addClass('hidden');
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
function terminalNotifyOutput() {
|
||||||
|
if (!terminal.is_bottom()) {
|
||||||
|
$consoleNotify.removeClass('hidden');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var ctc = $('#chart_cpu');
|
var ctc = $('#chart_cpu');
|
||||||
var timeLabels = [];
|
var timeLabels = [];
|
||||||
var cpuData = [];
|
var cpuData = [];
|
||||||
|
@ -326,11 +349,14 @@ $(window).load(function () {
|
||||||
$('#consoleThrottled').addClass('hidden');
|
$('#consoleThrottled').addClass('hidden');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (outputQueue.length > 0) {
|
||||||
for (var i = 0; i < {{ env('CONSOLE_PUSH_COUNT', 10) }} && outputQueue.length > 0; i++)
|
for (var i = 0; i < {{ env('CONSOLE_PUSH_COUNT', 10) }} && outputQueue.length > 0; i++)
|
||||||
{
|
{
|
||||||
terminal.echo(outputQueue[0]);
|
terminal.echo(outputQueue[0]);
|
||||||
outputQueue.shift();
|
outputQueue.shift();
|
||||||
}
|
}
|
||||||
|
terminalNotifyOutput();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update Listings on Initial Status
|
// Update Listings on Initial Status
|
||||||
|
@ -347,8 +373,10 @@ $(window).load(function () {
|
||||||
timeout: 10000
|
timeout: 10000
|
||||||
}).done(function(data) {
|
}).done(function(data) {
|
||||||
terminal.echo(data);
|
terminal.echo(data);
|
||||||
|
terminalNotifyOutput();
|
||||||
}).fail(function() {
|
}).fail(function() {
|
||||||
terminal.error('Unable to load initial server log, try reloading the page.');
|
terminal.error('Unable to load initial server log, try reloading the page.');
|
||||||
|
terminalNotifyOutput();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
updateServerPowerControls(data.status);
|
updateServerPowerControls(data.status);
|
||||||
|
|
Loading…
Reference in a new issue