log viewer: add heuristic for scroll-direction dependent ratio distribution
if the user scrolls down make 2/3 of the buffer load the downward (newer) buffer and only 1/3 the upward (older), and vice versa, if the user scrolls up load 2/3 of the older messages vs. 1/3 of newer ones. If the user scrolls around frantically we're roughly as good as previously and in all other cases we're better now. Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
parent
a16b036be0
commit
4e95d1e906
@ -7,7 +7,7 @@ Ext.define('Proxmox.panel.LogView', {
|
||||
extend: 'Ext.panel.Panel',
|
||||
xtype: 'proxmoxLogView',
|
||||
|
||||
pageSize: 500,
|
||||
pageSize: 510,
|
||||
viewBuffer: 50,
|
||||
lineHeight: 16,
|
||||
|
||||
@ -136,9 +136,13 @@ Ext.define('Proxmox.panel.LogView', {
|
||||
let limit = viewModel.get('params.limit');
|
||||
let total = viewModel.get('data.total');
|
||||
|
||||
// heuristic: scroll up? -> load more in front; scroll down? -> load more at end
|
||||
let startRatio = view.lastTargetLine && view.lastTargetLine > targetLine ? 2/3 : 1/3;
|
||||
view.lastTargetLine = targetLine;
|
||||
|
||||
let newStart = scrolledToBottom
|
||||
? Math.trunc(total - limit, 10)
|
||||
: Math.trunc(targetLine - (limit / 2) + 10);
|
||||
: Math.trunc(targetLine - (startRatio * limit) + 10);
|
||||
|
||||
viewModel.set('params.start', Math.max(newStart, 0));
|
||||
|
||||
@ -219,7 +223,7 @@ Ext.define('Proxmox.panel.LogView', {
|
||||
},
|
||||
params: {
|
||||
start: 0,
|
||||
limit: 500,
|
||||
limit: 510,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user