diff --git a/awx/ui/client/src/job-results/job-results-stdout/job-results-stdout.block.less b/awx/ui/client/src/job-results/job-results-stdout/job-results-stdout.block.less index 0be6ccdec9..3505f1ce7d 100644 --- a/awx/ui/client/src/job-results/job-results-stdout/job-results-stdout.block.less +++ b/awx/ui/client/src/job-results/job-results-stdout/job-results-stdout.block.less @@ -111,13 +111,14 @@ } .JobResultsStdOut-numberColumnPreload { - background-color: #EBEBEB; + background-color: @default-list-header-bg; width: 70px; position: fixed; top: 148px; bottom: 20px; margin-top: 65px; margin-bottom: 65px; + } .JobResultsStdOut-aLineOfStdOut { @@ -203,9 +204,30 @@ color: @default-interface-txt; } -.foo { - margin-right: auto; - margin-top: 8px; - margin-left: 20px; - font-weight: bold; +@media (max-width: 1199px) { + .JobResultsStdOut-numberColumnPreload { + display: none; + } + + .JobResultsStdOut-topAnchor { + position: static; + width: 100%; + top: -20px; + margin-top: -250px; + margin-bottom: 250px; + } + + .JobResultsStdOut-followAnchor { + height: 20px; + width: 100%; + border-left: 70px solid @default-list-header-bg; + } + + .JobResultsStdOut-stdoutContainer { + overflow-y: auto; + } + + .JobResultsStdOut-lineAnchor { + display: none !important; + } } diff --git a/awx/ui/client/src/job-results/job-results-stdout/job-results-stdout.directive.js b/awx/ui/client/src/job-results/job-results-stdout/job-results-stdout.directive.js index aa31b6da9a..f60d8399a2 100644 --- a/awx/ui/client/src/job-results/job-results-stdout/job-results-stdout.directive.js +++ b/awx/ui/client/src/job-results/job-results-stdout/job-results-stdout.directive.js @@ -57,28 +57,70 @@ export default [ 'templateUrl', '$timeout', '$location', '$anchorScroll', scope.parentVisLine = parentItem; }; - var lastScrollTop = 0; - scope.stdoutOverflowed = false; - $(".JobResultsStdOut-stdoutContainer").on('scroll', function() { - var st = $(this).scrollTop(); + // find when window changes from mobile to desktop width + if (window.innerWidth < 1200) { + scope.isMobile = true; + } else { + scope.isMobile = false; + } + $( window ).resize(function() { + if (window.innerWidth < 1200 && !scope.isMobile) { + scope.isMobile = true; + } else if (window.innerWidth >= 1200 & scope.isMobile) { + scope.isMobile = false; + } + }); + + var lastScrollTop; + + var initScrollTop = function() { + lastScrollTop = 0; + } + var scrollWatcher = function() { + var st = $(this).scrollTop(), + fullHeight; if (st < lastScrollTop){ // user up scrolled, so disengage follow scope.followEngaged = false; } + if (scope.isMobile) { + fullHeight = $("body").height(); + } else { + fullHeight = $(this)[0].scrollHeight - 25; + } + if($(this).scrollTop() + $(this).innerHeight() >= - $(this)[0].scrollHeight - 25) { + fullHeight) { // user scrolled all the way to bottom, so engage // follow scope.followEngaged = true; } // pane is now overflowed, show top indicator - if (st > 0) { + if (st > 0 && !scope.isMobile) { scope.stdoutOverflowed = true; } lastScrollTop = st; + } + + scope.$watch('isMobile', function(val) { + if (val === true) { + // make sure ^ TOP always shown + scope.stdoutOverflowed = true; + + initScrollTop(); + $(".JobResultsStdOut-stdoutContainer") + .unbind('scroll'); + $(window).on('scroll', scrollWatcher); + + } else if (val === false) { + initScrollTop(); + $(window).unbind('scroll'); + $(".JobResultsStdOut-stdoutContainer").on('scroll', + scrollWatcher); + } }); scope.followScroll = function() { diff --git a/awx/ui/client/src/job-results/job-results-stdout/job-results-stdout.partial.html b/awx/ui/client/src/job-results/job-results-stdout/job-results-stdout.partial.html index 147181eb48..0ba992b146 100644 --- a/awx/ui/client/src/job-results/job-results-stdout/job-results-stdout.partial.html +++ b/awx/ui/client/src/job-results/job-results-stdout/job-results-stdout.partial.html @@ -31,9 +31,9 @@
-
+
-
+