Added checkbox to enable autoscroll in the terminal tab.
parent
1e77467a41
commit
ca3c973bfc
|
@ -396,6 +396,8 @@ function TerminalViewModel() {
|
||||||
self.isReady = ko.observable(undefined);
|
self.isReady = ko.observable(undefined);
|
||||||
self.isLoading = ko.observable(undefined);
|
self.isLoading = ko.observable(undefined);
|
||||||
|
|
||||||
|
self.autoscrollEnabled = ko.observable(true);
|
||||||
|
|
||||||
self.fromCurrentData = function(data) {
|
self.fromCurrentData = function(data) {
|
||||||
self._processStateData(data.state);
|
self._processStateData(data.state);
|
||||||
self._processCurrentLogData(data.logs);
|
self._processCurrentLogData(data.logs);
|
||||||
|
@ -438,11 +440,9 @@ function TerminalViewModel() {
|
||||||
}
|
}
|
||||||
|
|
||||||
var container = $("#terminal-output");
|
var container = $("#terminal-output");
|
||||||
var autoscroll = (container.scrollTop() == container[0].scrollHeight - container.height);
|
|
||||||
|
|
||||||
container.text(output);
|
container.text(output);
|
||||||
|
|
||||||
if (autoscroll) {
|
if (self.autoscrollEnabled()) {
|
||||||
container.scrollTop(container[0].scrollHeight - container.height())
|
container.scrollTop(container[0].scrollHeight - container.height())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -219,6 +219,10 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="tab-pane" id="term">
|
<div class="tab-pane" id="term">
|
||||||
<pre id="terminal-output" class="pre-scrollable"></pre>
|
<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">
|
<div class="input-append">
|
||||||
<input type="text" id="terminal-command">
|
<input type="text" id="terminal-command">
|
||||||
<button class="btn" type="button" id="terminal-send">Send</button>
|
<button class="btn" type="button" id="terminal-send">Send</button>
|
||||||
|
|
Loading…
Reference in New Issue