mirror of
https://github.com/ansible/awx.git
synced 2026-03-19 09:57:33 -02:30
Merge pull request #2318 from jakemcdermott/job-results/viewable-page-up-down
make output nav controls move up or down by viewable content height
This commit is contained in:
@@ -21,6 +21,7 @@ const listeners = [];
|
|||||||
const rx = [];
|
const rx = [];
|
||||||
|
|
||||||
let following = false;
|
let following = false;
|
||||||
|
let attach = true;
|
||||||
|
|
||||||
function bufferInit () {
|
function bufferInit () {
|
||||||
rx.length = 0;
|
rx.length = 0;
|
||||||
@@ -65,6 +66,10 @@ function onFrames (events) {
|
|||||||
return $q.resolve();
|
return $q.resolve();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!attach) {
|
||||||
|
return $q.resolve();
|
||||||
|
}
|
||||||
|
|
||||||
follow();
|
follow();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -117,23 +122,39 @@ function last () {
|
|||||||
stream.setMissingCounterThreshold(slide.getTailCounter() + 1);
|
stream.setMissingCounterThreshold(slide.getTailCounter() + 1);
|
||||||
scroll.setScrollPosition(scroll.getScrollHeight());
|
scroll.setScrollPosition(scroll.getScrollHeight());
|
||||||
|
|
||||||
|
attach = true;
|
||||||
scroll.resume();
|
scroll.resume();
|
||||||
|
|
||||||
return $q.resolve();
|
return $q.resolve();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function down () {
|
||||||
|
scroll.moveDown();
|
||||||
|
}
|
||||||
|
|
||||||
|
function up () {
|
||||||
|
if (following) {
|
||||||
|
unfollow();
|
||||||
|
} else {
|
||||||
|
scroll.moveUp();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function follow () {
|
function follow () {
|
||||||
scroll.pause();
|
scroll.pause();
|
||||||
// scroll.hide();
|
scroll.hide();
|
||||||
|
|
||||||
following = true;
|
following = true;
|
||||||
|
vm.isFollowing = following;
|
||||||
}
|
}
|
||||||
|
|
||||||
function unfollow () {
|
function unfollow () {
|
||||||
|
attach = false;
|
||||||
following = false;
|
following = false;
|
||||||
|
vm.isFollowing = following;
|
||||||
|
|
||||||
// scroll.unhide();
|
scroll.unhide();
|
||||||
scroll.resume();
|
scroll.resume();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -289,13 +310,9 @@ function OutputIndexController (
|
|||||||
vm.togglePanelExpand = togglePanelExpand;
|
vm.togglePanelExpand = togglePanelExpand;
|
||||||
|
|
||||||
// Stdout Navigation
|
// Stdout Navigation
|
||||||
vm.menu = {
|
vm.menu = { last, first, down, up };
|
||||||
end: last,
|
|
||||||
home: first,
|
|
||||||
up: previous,
|
|
||||||
down: next,
|
|
||||||
};
|
|
||||||
vm.isMenuExpanded = true;
|
vm.isMenuExpanded = true;
|
||||||
|
vm.isFollowing = following;
|
||||||
vm.toggleMenuExpand = toggleMenuExpand;
|
vm.toggleMenuExpand = toggleMenuExpand;
|
||||||
vm.toggleLineExpand = toggleLineExpand;
|
vm.toggleLineExpand = toggleLineExpand;
|
||||||
vm.showHostDetails = showHostDetails;
|
vm.showHostDetails = showHostDetails;
|
||||||
|
|||||||
@@ -23,18 +23,19 @@
|
|||||||
ng-class="{ 'fa-minus': vm.isMenuExpanded, 'fa-plus': !vm.isMenuExpanded }"></i>
|
ng-class="{ 'fa-minus': vm.isMenuExpanded, 'fa-plus': !vm.isMenuExpanded }"></i>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="pull-right" ng-click="vm.menu.end()">
|
<div class="pull-right" ng-click="vm.menu.last()">
|
||||||
<i class="at-Stdout-menuIcon--lg fa fa-angle-double-down"
|
<i class="at-Stdout-menuIcon--lg fa fa-angle-double-down"
|
||||||
ng-class=" { 'at-Stdout-menuIcon--active': vm.menu.isLocked }"></i>
|
ng-class=" { 'at-Stdout-menuIcon--active': vm.menu.isLocked }"></i>
|
||||||
</div>
|
</div>
|
||||||
<div class="pull-right" ng-click="vm.menu.home()">
|
<div class="pull-right" ng-click="vm.menu.first()">
|
||||||
<i class="at-Stdout-menuIcon--lg fa fa-angle-double-up"></i>
|
<i class="at-Stdout-menuIcon--lg fa fa-angle-double-up"></i>
|
||||||
</div>
|
</div>
|
||||||
<div class="pull-right" ng-click="vm.menu.down()">
|
<div class="pull-right" ng-click="vm.menu.down()">
|
||||||
<i class="at-Stdout-menuIcon--lg fa fa-angle-down"></i>
|
<i class="at-Stdout-menuIcon--lg fa fa-angle-down"></i>
|
||||||
</div>
|
</div>
|
||||||
<div class="pull-right" ng-click="vm.menu.up()">
|
<div class="pull-right" ng-click="vm.menu.up()">
|
||||||
<i class="at-Stdout-menuIcon--lg fa fa-angle-up"></i>
|
<i class="at-Stdout-menuIcon--lg fa fa-angle-up"
|
||||||
|
ng-class=" { 'at-Stdout-menuIcon--active': vm.isFollowing }"></i>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="at-u-clear"></div>
|
<div class="at-u-clear"></div>
|
||||||
|
|||||||
@@ -86,22 +86,20 @@ function JobScrollService ($q, $timeout) {
|
|||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
|
|
||||||
this.pageUp = () => {
|
/**
|
||||||
if (this.isPaused()) {
|
* Move scroll position up by one page of visible content.
|
||||||
return;
|
*/
|
||||||
}
|
this.moveUp = () => {
|
||||||
|
|
||||||
const top = this.getScrollPosition();
|
const top = this.getScrollPosition();
|
||||||
const height = this.getViewableHeight();
|
const height = this.getViewableHeight();
|
||||||
|
|
||||||
this.setScrollPosition(top - height);
|
this.setScrollPosition(top - height);
|
||||||
};
|
};
|
||||||
|
|
||||||
this.pageDown = () => {
|
/**
|
||||||
if (this.isPaused()) {
|
* Move scroll position down by one page of visible content.
|
||||||
return;
|
*/
|
||||||
}
|
this.moveDown = () => {
|
||||||
|
|
||||||
const top = this.getScrollPosition();
|
const top = this.getScrollPosition();
|
||||||
const height = this.getViewableHeight();
|
const height = this.getViewableHeight();
|
||||||
|
|
||||||
@@ -110,6 +108,12 @@ function JobScrollService ($q, $timeout) {
|
|||||||
|
|
||||||
this.getScrollHeight = () => this.el[0].scrollHeight;
|
this.getScrollHeight = () => this.el[0].scrollHeight;
|
||||||
this.getViewableHeight = () => this.el[0].offsetHeight;
|
this.getViewableHeight = () => this.el[0].offsetHeight;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the vertical scroll position.
|
||||||
|
*
|
||||||
|
* @returns {Number} - The number of pixels that are hidden from view above the scrollable area.
|
||||||
|
*/
|
||||||
this.getScrollPosition = () => this.el[0].scrollTop;
|
this.getScrollPosition = () => this.el[0].scrollTop;
|
||||||
|
|
||||||
this.setScrollPosition = position => {
|
this.setScrollPosition = position => {
|
||||||
|
|||||||
Reference in New Issue
Block a user