Added checkbox to enable autoscroll in the terminal tab.

master
Gina Häußge 2013-01-20 14:34:44 +01:00
parent 1e77467a41
commit ca3c973bfc
2 changed files with 7 additions and 3 deletions

View File

@ -396,6 +396,8 @@ function TerminalViewModel() {
self.isReady = ko.observable(undefined);
self.isLoading = ko.observable(undefined);
self.autoscrollEnabled = ko.observable(true);
self.fromCurrentData = function(data) {
self._processStateData(data.state);
self._processCurrentLogData(data.logs);
@ -438,11 +440,9 @@ function TerminalViewModel() {
}
var container = $("#terminal-output");
var autoscroll = (container.scrollTop() == container[0].scrollHeight - container.height);
container.text(output);
if (autoscroll) {
if (self.autoscrollEnabled()) {
container.scrollTop(container[0].scrollHeight - container.height())
}
}

View File

@ -219,6 +219,10 @@
</div>
<div class="tab-pane" id="term">
<pre id="terminal-output" class="pre-scrollable"></pre>
<label class="checkbox">
<input type="checkbox" id="terminal-autoscroll" data-bind="checked: autoscrollEnabled"> Autoscroll
</label>
<div class="input-append">
<input type="text" id="terminal-command">
<button class="btn" type="button" id="terminal-send">Send</button>