algairim commented on a change in pull request #249:
URL: https://github.com/apache/brooklyn-ui/pull/249#discussion_r671165588
##########
File path: ui-modules/utils/logbook/logbook.js
##########
@@ -39,168 +39,249 @@ export function logbook() {
const DEFAULT_NUMBER_OF_ITEMS = 1000;
- $scope.isAutoScroll = true; // Auto-scroll by default.
- $scope.isLatest = true; // Indicates whether to query tail (last
number of lines) or head (by default).
- $scope.autoUpdate = false;
- $scope.waitingResponse = false;
-
- $scope.logtext = '';
- $scope.logEntries = [];
-
let vm = this;
let refreshFunction = null;
- let autoScrollableElements =
Array.from($element.find('pre')).filter(item =>
item.classList.contains('auto-scrollable'));
- let dateTimeToAutoUpdateFrom = ''; // TODO: use this date to optimize
'tail' queries to reduce the network traffic.
-
- // Set up cancellation of auto-scrolling on scrolling up.
- autoScrollableElements.forEach(item => {
- if (item.addEventListener) {
- let wheelHandler = () => {
- $scope.$apply(() => {
- $scope.isAutoScroll = (item.scrollTop +
item.offsetHeight) >= item.scrollHeight;
- });
- }
- // Chrome, Safari, Opera
- item.addEventListener("mousewheel", wheelHandler, false);
- // Firefox
- item.addEventListener("DOMMouseScroll", wheelHandler, false);
- }
- });
-
- vm.queryTail = () => {
- let autoUpdate = !$scope.autoUpdate; // Calculate new value.
-
- if (autoUpdate) {
- $scope.isAutoScroll = true;
- resetQueryParameters();
- doQuery();
+ let autoScrollableElement = Array.from($element.find('pre')).find(item
=> item.classList.contains('auto-scrollable'));
Review comment:
Element object is required here to perform a scroll action on entire log
section, not just on a single log entry (log line), when needed. I take any
suggestion(s) on how to perform scroll action by using data model, instead of
searching element in the DOM.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]