diff --git a/awx/ui/client/features/output/index.controller.js b/awx/ui/client/features/output/index.controller.js index 529d319aab..a76ec0206e 100644 --- a/awx/ui/client/features/output/index.controller.js +++ b/awx/ui/client/features/output/index.controller.js @@ -21,6 +21,7 @@ const listeners = []; const rx = []; let following = false; +let attach = true; function bufferInit () { rx.length = 0; @@ -65,6 +66,10 @@ function onFrames (events) { return $q.resolve(); } + if (!attach) { + return $q.resolve(); + } + follow(); } @@ -117,23 +122,39 @@ function last () { stream.setMissingCounterThreshold(slide.getTailCounter() + 1); scroll.setScrollPosition(scroll.getScrollHeight()); + attach = true; scroll.resume(); return $q.resolve(); }); } +function down () { + scroll.moveDown(); +} + +function up () { + if (following) { + unfollow(); + } else { + scroll.moveUp(); + } +} + function follow () { scroll.pause(); - // scroll.hide(); + scroll.hide(); following = true; + vm.isFollowing = following; } function unfollow () { + attach = false; following = false; + vm.isFollowing = following; - // scroll.unhide(); + scroll.unhide(); scroll.resume(); } @@ -289,13 +310,9 @@ function OutputIndexController ( vm.togglePanelExpand = togglePanelExpand; // Stdout Navigation - vm.menu = { - end: last, - home: first, - up: previous, - down: next, - }; + vm.menu = { last, first, down, up }; vm.isMenuExpanded = true; + vm.isFollowing = following; vm.toggleMenuExpand = toggleMenuExpand; vm.toggleLineExpand = toggleLineExpand; vm.showHostDetails = showHostDetails; diff --git a/awx/ui/client/features/output/index.view.html b/awx/ui/client/features/output/index.view.html index dd5de91357..9861b32e63 100644 --- a/awx/ui/client/features/output/index.view.html +++ b/awx/ui/client/features/output/index.view.html @@ -23,18 +23,19 @@ ng-class="{ 'fa-minus': vm.isMenuExpanded, 'fa-plus': !vm.isMenuExpanded }"> -