Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
pve-manager
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
pve-manager
Commits
46da951a
Commit
46da951a
authored
Nov 08, 2011
by
Dietmar Maurer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
automatically scroll to end of log
parent
9ece39fb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
80 additions
and
3 deletions
+80
-3
LogView.js
www/manager/grid/LogView.js
+80
-3
No files found.
www/manager/grid/LogView.js
View file @
46da951a
...
...
@@ -3,6 +3,8 @@ Ext.define('PVE.grig.LogView', {
alias
:
[
'
widget.pveLogView
'
],
scrollToEnd
:
true
,
initComponent
:
function
()
{
var
me
=
this
;
...
...
@@ -22,26 +24,101 @@ Ext.define('PVE.grig.LogView', {
}
});
var
scrollEndMarker
=
false
;
var
autoscroll
=
true
;
var
scrollToEndFn
=
function
()
{
var
vertScroller
=
me
.
getVerticalScroller
();
if
(
!
(
vertScroller
&&
vertScroller
.
scrollEl
))
{
return
;
}
var
vertScrollerEl
=
vertScroller
.
scrollEl
;
var
vertScrollerElDom
=
vertScrollerEl
.
dom
;
var
maxDown
=
vertScrollerElDom
.
scrollHeight
-
vertScrollerElDom
.
clientHeight
-
vertScrollerElDom
.
scrollTop
;
scrollEndMarker
=
(
maxDown
<=
0
);
if
(
me
.
scrollToEnd
&&
scrollEndMarker
)
{
autoscroll
=
true
;
}
if
(
!
autoscroll
)
{
return
;
}
vertScroller
.
scrollByDeltaY
(
maxDown
);
// invalidate last page by removing last entry from cache
store
.
prefetchData
.
removeAtKey
(
store
.
totalCount
-
1
);
store
.
guaranteeRange
(
store
.
totalCount
-
store
.
pageSize
,
store
.
totalCount
-
1
);
};
var
onScroll
=
function
()
{
var
scroller
=
this
;
if
(
me
.
scrollToEnd
&&
scrollEndMarker
)
{
autoscroll
=
false
;
}
};
Ext
.
apply
(
me
,
{
store
:
store
,
features
:
[
{
ftype
:
'
selectable
'
}],
stateful
:
false
,
verticalScrollerType
:
'
paginggridscroller
'
,
loadMask
:
true
,
invalidateScrollerOnRefresh
:
false
,
viewConfig
:
{
loadMask
:
false
,
trackOver
:
false
,
stripeRows
:
false
},
hideHeaders
:
true
,
columns
:
[
{
header
:
"
Text
"
,
dataIndex
:
'
t
'
,
flex
:
1
}
]
],
listeners
:
{
'
scrollershow
'
:
function
(
scroller
,
orientation
)
{
if
(
orientation
!==
'
vertical
'
)
{
return
;
}
scroller
.
on
(
'
afterrender
'
,
function
()
{
me
.
mon
(
scroller
.
scrollEl
,
'
scroll
'
,
onScroll
,
scroller
);
});
},
'
scrollerhide
'
:
function
(
scroller
,
orientation
)
{
if
(
orientation
!==
'
vertical
'
)
{
return
;
}
autoscroll
=
false
;
},
}
});
me
.
callParent
();
store
.
guaranteeRange
(
0
,
store
.
pageSize
-
1
);
var
load_task
=
new
Ext
.
util
.
DelayedTask
();
var
run_load_task
=
function
()
{
if
(
!
store
.
totalCount
)
{
store
.
guaranteeRange
(
0
,
store
.
pageSize
-
1
);
}
else
{
scrollToEndFn
();
}
load_task
.
delay
(
1000
,
run_load_task
);
};
if
(
me
.
scrollToEnd
)
{
run_load_task
();
}
else
{
store
.
guaranteeRange
(
0
,
store
.
pageSize
-
1
);
}
me
.
on
(
'
destroy
'
,
function
()
{
load_task
.
cancel
();
});
}
});
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment