if the total we got was bigger than the last line number, we appended
empty lines at the end of the panel, to which we scrolled
the only time we need to do that is when we do not follow the task log
'live' but when we are elsewhere (to keep the scroll position/size)
so give the lines directly to 'updateView' and let it decide
if we append the empty lines at the end
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
- updateView: function(text, first, total) {
+ updateView: function(lines, first, total) {
let me = this;
let view = me.getView();
let viewModel = me.getViewModel();
let content = me.lookup('content');
let data = viewModel.get('data');
let me = this;
let view = me.getView();
let viewModel = me.getViewModel();
let content = me.lookup('content');
let data = viewModel.get('data');
- if (first === data.first && total === data.total && text.length === data.textlen) {
+ if (first === data.first && total === data.total && lines.length === data.lines) {
return; // same content, skip setting and scrolling
}
viewModel.set('data', {
first: first,
total: total,
return; // same content, skip setting and scrolling
}
viewModel.set('data', {
first: first,
total: total,
});
let scrollPos = me.scrollPosBottom();
});
let scrollPos = me.scrollPosBottom();
+ let scrollToBottom = view.scrollToEnd && scrollPos <= 5;
+ if (!scrollToBottom) {
+ // so that we have the 'correct' height for the text
+ lines.length = total;
+ }
+
+ content.update(lines.join('<br>'));
- if (view.scrollToEnd && scrollPos <= 5) {
// we use setTimeout to work around scroll handling on touchscreens
setTimeout(function() { view.scrollTo(0, Infinity); }, 10);
}
// we use setTimeout to work around scroll handling on touchscreens
setTimeout(function() { view.scrollTo(0, Infinity); }, 10);
}
lines[line.n - 1] = Ext.htmlEncode(line.t);
});
lines[line.n - 1] = Ext.htmlEncode(line.t);
});
- lines.length = total;
- me.updateView(lines.join('<br>'), first - 1, total);
+ me.updateView(lines, first - 1, total);
me.running = false;
if (me.requested) {
me.requested = false;
me.running = false;
if (me.requested) {
me.requested = false;