mirror of
https://github.com/ansible/awx.git
synced 2026-05-12 11:57:37 -02:30
add top anchor scroll, fix follow tooltips, replace stdout tabs w spaces
This commit is contained in:
committed by
jaredevantabor
parent
c94d86206d
commit
3424db7f90
@@ -186,6 +186,23 @@
|
|||||||
height: 100%;
|
height: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.JobResultsStdOut-followAnchor {
|
||||||
|
height: 20px;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.JobResultsStdOut-toTop {
|
||||||
|
margin-right: 20px;
|
||||||
|
color: #D7D7D7;
|
||||||
|
cursor: pointer;
|
||||||
|
text-align: right;
|
||||||
|
font-family: monaco;
|
||||||
|
}
|
||||||
|
|
||||||
|
.JobResultsStdOut-toTop:hover {
|
||||||
|
color: @default-interface-txt;
|
||||||
|
}
|
||||||
|
|
||||||
.foo {
|
.foo {
|
||||||
margin-right: auto;
|
margin-right: auto;
|
||||||
margin-top: 8px;
|
margin-top: 8px;
|
||||||
|
|||||||
@@ -5,8 +5,8 @@
|
|||||||
*************************************************/
|
*************************************************/
|
||||||
|
|
||||||
// import hostStatusBarController from './host-status-bar.controller';
|
// import hostStatusBarController from './host-status-bar.controller';
|
||||||
export default [ 'templateUrl', '$timeout', '$location', '$anchorScroll', '$log',
|
export default [ 'templateUrl', '$timeout', '$location', '$anchorScroll',
|
||||||
function(templateUrl, $timeout, $location, $anchorScroll, $log) {
|
function(templateUrl, $timeout, $location, $anchorScroll) {
|
||||||
return {
|
return {
|
||||||
scope: false,
|
scope: false,
|
||||||
templateUrl: templateUrl('job-results/job-results-stdout/job-results-stdout'),
|
templateUrl: templateUrl('job-results/job-results-stdout/job-results-stdout'),
|
||||||
@@ -55,10 +55,10 @@ export default [ 'templateUrl', '$timeout', '$location', '$anchorScroll', '$log'
|
|||||||
});
|
});
|
||||||
scope.visLine = visItem;
|
scope.visLine = visItem;
|
||||||
scope.parentVisLine = parentItem;
|
scope.parentVisLine = parentItem;
|
||||||
scope.visibleItems = "First visible line: " + visItem + ", Parent line: " + parentItem;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
var lastScrollTop = 0;
|
var lastScrollTop = 0;
|
||||||
|
scope.stdoutOverflowed = false;
|
||||||
$(".JobResultsStdOut-stdoutContainer").on('scroll', function() {
|
$(".JobResultsStdOut-stdoutContainer").on('scroll', function() {
|
||||||
var st = $(this).scrollTop();
|
var st = $(this).scrollTop();
|
||||||
if (st < lastScrollTop){
|
if (st < lastScrollTop){
|
||||||
@@ -67,12 +67,17 @@ export default [ 'templateUrl', '$timeout', '$location', '$anchorScroll', '$log'
|
|||||||
}
|
}
|
||||||
|
|
||||||
if($(this).scrollTop() + $(this).innerHeight() >=
|
if($(this).scrollTop() + $(this).innerHeight() >=
|
||||||
$(this)[0].scrollHeight) {
|
$(this)[0].scrollHeight - 25) {
|
||||||
// user scrolled all the way to bottom, so engage
|
// user scrolled all the way to bottom, so engage
|
||||||
// follow
|
// follow
|
||||||
scope.followEngaged = true;
|
scope.followEngaged = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// pane is now overflowed, show top indicator
|
||||||
|
if (st > 0) {
|
||||||
|
scope.stdoutOverflowed = true;
|
||||||
|
}
|
||||||
|
|
||||||
lastScrollTop = st;
|
lastScrollTop = st;
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -84,17 +89,15 @@ export default [ 'templateUrl', '$timeout', '$location', '$anchorScroll', '$log'
|
|||||||
$anchorScroll();
|
$anchorScroll();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
scope.toTop = function() {
|
||||||
|
$location.hash('topAnchor');
|
||||||
|
$anchorScroll();
|
||||||
|
};
|
||||||
|
|
||||||
scope.topLineAnchor = function() {
|
scope.topLineAnchor = function() {
|
||||||
$location.hash('topLineAnchor');
|
$location.hash('topLineAnchor');
|
||||||
$anchorScroll();
|
$anchorScroll();
|
||||||
}
|
};
|
||||||
|
|
||||||
// follow button for completed job should specify that the
|
|
||||||
// button will jump to the bottom of the standard out pane,
|
|
||||||
// not follow lines as they come in
|
|
||||||
if (scope.jobFinished) {
|
|
||||||
scope.followTooltip = "Jump to last line";
|
|
||||||
}
|
|
||||||
|
|
||||||
// if following becomes active, go ahead and get to the bottom
|
// if following becomes active, go ahead and get to the bottom
|
||||||
// of the standard out pane
|
// of the standard out pane
|
||||||
@@ -105,9 +108,9 @@ export default [ 'templateUrl', '$timeout', '$location', '$anchorScroll', '$log'
|
|||||||
|
|
||||||
if (!scope.jobFinished) {
|
if (!scope.jobFinished) {
|
||||||
if (val) {
|
if (val) {
|
||||||
scope.followTooltip = "Follow standard out";
|
scope.followTooltip = "Currently following standard out as it comes in. Click to unfollow.";
|
||||||
} else {
|
} else {
|
||||||
scope.followTooltip = "Unfollow standard out";
|
scope.followTooltip = "Click to follow standard out as it comes in.";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -17,31 +17,30 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="JobResultsStdOut-toolbarStdoutColumn">
|
<div class="JobResultsStdOut-toolbarStdoutColumn">
|
||||||
<!-- <span class="foo">{{ visibleItems }}</span> -->
|
|
||||||
<div class="JobResultsStdOut-followButton"
|
<div class="JobResultsStdOut-followButton"
|
||||||
ng-class="{'is-engaged': followEngaged && !jobFinished}"
|
ng-class="{'is-engaged': followEngaged && !jobFinished}"
|
||||||
aw-tool-tip="Follow standard out"
|
aw-tool-tip="{{ followTooltip }}"
|
||||||
|
data-tip-watch="followTooltip"
|
||||||
data-placement="left"
|
data-placement="left"
|
||||||
|
data-trigger="hover"
|
||||||
|
data-container="body"
|
||||||
ng-click="followToggleClicked()">
|
ng-click="followToggleClicked()">
|
||||||
<i class="JobResultsStdOut-followIcon fa fa-arrow-down">
|
<i class="JobResultsStdOut-followIcon fa fa-arrow-down">
|
||||||
</i>
|
</i>
|
||||||
</div>
|
</div>
|
||||||
<!-- TODO: get followTooltip watch working
|
|
||||||
<div class="JobResultsStdOut-followButton"
|
|
||||||
aw-tool-tip="{{followTooltip}}"
|
|
||||||
data-tip-watch="followTooltip"
|
|
||||||
data-placement="left"
|
|
||||||
ng-click="followToggleClicked()">
|
|
||||||
<i class="JobResultsStdOut-followIcon fa fa-arrow-down">
|
|
||||||
</i>
|
|
||||||
</div> -->
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="JobResultsStdOut-stdoutContainer">
|
<div class="JobResultsStdOut-stdoutContainer">
|
||||||
|
<div id="topAnchor"></div>
|
||||||
<div class="JobResultsStdOut-numberColumnPreload"></div>
|
<div class="JobResultsStdOut-numberColumnPreload"></div>
|
||||||
<div id='topLineAnchor'></div>
|
<div id='topLineAnchor'></div>
|
||||||
<div id="followAnchor"
|
<div id="followAnchor"
|
||||||
class="JobResultsStdOut-followAnchor">
|
class="JobResultsStdOut-followAnchor">
|
||||||
|
<div class="JobResultsStdOut-toTop"
|
||||||
|
ng-click="toTop()"
|
||||||
|
ng-show="stdoutOverflowed">
|
||||||
|
^ TOP
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="JobResultsStdOut-footer">
|
<div class="JobResultsStdOut-footer">
|
||||||
|
|||||||
@@ -86,6 +86,15 @@ export default ['jobData', 'jobDataOptions', 'jobLabels', 'jobFinished', 'count'
|
|||||||
$scope.jobFinished = jobFinished;
|
$scope.jobFinished = jobFinished;
|
||||||
$scope.followEngaged = !$scope.jobFinished;
|
$scope.followEngaged = !$scope.jobFinished;
|
||||||
|
|
||||||
|
// follow button for completed job should specify that the
|
||||||
|
// button will jump to the bottom of the standard out pane,
|
||||||
|
// not follow lines as they come in
|
||||||
|
if ($scope.jobFinished) {
|
||||||
|
$scope.followTooltip = "Jump to last line of standard out.";
|
||||||
|
} else {
|
||||||
|
$scope.followTooltip = "Currently following standard out as it comes in. Click to unfollow.";
|
||||||
|
}
|
||||||
|
|
||||||
// EVENT STUFF BELOW
|
// EVENT STUFF BELOW
|
||||||
|
|
||||||
// just putting the event queue on scope so it can be inspected in the
|
// just putting the event queue on scope so it can be inspected in the
|
||||||
@@ -127,6 +136,7 @@ export default ['jobData', 'jobDataOptions', 'jobLabels', 'jobFinished', 'count'
|
|||||||
if (change === 'finishedTime' && !$scope.job.finished) {
|
if (change === 'finishedTime' && !$scope.job.finished) {
|
||||||
$scope.job.finished = mungedEvent.finishedTime;
|
$scope.job.finished = mungedEvent.finishedTime;
|
||||||
$scope.jobFinished = true;
|
$scope.jobFinished = true;
|
||||||
|
$scope.followTooltip = "Jump to last line of standard out.";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (change === 'countFinished') {
|
if (change === 'countFinished') {
|
||||||
@@ -143,6 +153,9 @@ export default ['jobData', 'jobDataOptions', 'jobLabels', 'jobFinished', 'count'
|
|||||||
.append($compile(mungedEvent
|
.append($compile(mungedEvent
|
||||||
.stdout)($scope));
|
.stdout)($scope));
|
||||||
|
|
||||||
|
$(".JobResultsStdOut-followAnchor")
|
||||||
|
.appendTo(".JobResultsStdOut-stdoutContainer");
|
||||||
|
|
||||||
if ($scope.followEngaged) {
|
if ($scope.followEngaged) {
|
||||||
$scope.followScroll();
|
$scope.followScroll();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ export default [function(){
|
|||||||
return _
|
return _
|
||||||
.zip(_.range(event.start_line + 1,
|
.zip(_.range(event.start_line + 1,
|
||||||
event.end_line + 1),
|
event.end_line + 1),
|
||||||
event.stdout.split("\r\n").slice(0, -1))
|
event.stdout.replace("\t", " ").split("\r\n").slice(0, -1))
|
||||||
.map(lineArr => {
|
.map(lineArr => {
|
||||||
return `
|
return `
|
||||||
<div class="JobResultsStdOut-aLineOfStdOut${this.getCollapseClasses(event, lineArr[1], lineArr[0])}">
|
<div class="JobResultsStdOut-aLineOfStdOut${this.getCollapseClasses(event, lineArr[1], lineArr[0])}">
|
||||||
|
|||||||
Reference in New Issue
Block a user