Merge pull request #4441 from jlmitch5/fixJobResults

Fix job results
This commit is contained in:
jlmitch5 2016-12-16 14:13:02 -05:00 committed by GitHub
commit bd18be06df
8 changed files with 45 additions and 25 deletions

View File

@ -90,23 +90,14 @@ export default [ 'templateUrl', '$timeout', '$location', '$anchorScroll',
var visItem,
parentItem;
var containerHeight = $container.height();
var containerTop = $container.position().top;
var containerNetHeight = containerHeight + containerTop;
// iterate through each line of standard out
$container.find('.JobResultsStdOut-aLineOfStdOut')
$container.find('.JobResultsStdOut-aLineOfStdOut:visible')
.each( function () {
var $this = $(this);
var lineHeight = $this.height();
var lineTop = $this.position().top;
var lineNetHeight = lineHeight + lineTop;
// check to see if the line is the first visible
// line in the viewport...
if (lineNetHeight > containerTop &&
lineTop < containerNetHeight) {
if ($this.position().top >= 0) {
// ...if it is, return the line number
// for this line

View File

@ -1,4 +1,5 @@
export default ['jobData', 'jobDataOptions', 'jobLabels', 'jobFinished', 'count', '$scope', 'ParseTypeChange', 'ParseVariableString', 'jobResultsService', 'eventQueue', '$compile', '$log', 'Dataset', '$q', 'Rest', '$state', 'QuerySet', function(jobData, jobDataOptions, jobLabels, jobFinished, count, $scope, ParseTypeChange, ParseVariableString, jobResultsService, eventQueue, $compile, $log, Dataset, $q, Rest, $state, QuerySet) {
export default ['jobData', 'jobDataOptions', 'jobLabels', 'jobFinished', 'count', '$scope', 'ParseTypeChange', 'ParseVariableString', 'jobResultsService', 'eventQueue', '$compile', '$log', 'Dataset', '$q', 'Rest', '$state', 'QuerySet', '$rootScope', function(jobData, jobDataOptions, jobLabels, jobFinished, count, $scope, ParseTypeChange, ParseVariableString, jobResultsService, eventQueue, $compile, $log, Dataset, $q, Rest, $state, QuerySet, $rootScope) {
// used for tag search
$scope.job_event_dataset = Dataset.data;
@ -47,7 +48,6 @@ export default ['jobData', 'jobDataOptions', 'jobLabels', 'jobFinished', 'count'
}
};
$scope.status_label = getTowerLabel('status');
$scope.type_label = getTowerLabel('job_type');
$scope.verbosity_label = getTowerLabel('verbosity');
};
@ -63,6 +63,27 @@ export default ['jobData', 'jobDataOptions', 'jobLabels', 'jobFinished', 'count'
$scope.labels = jobLabels;
$scope.jobFinished = jobFinished;
// update label in left pane and tooltip in right pane when the job_status
// changes
$scope.$watch('job_status', function(status) {
if (status) {
$scope.status_label = $scope.jobOptions.status.choices
.filter(val => val[0] === status)
.map(val => val[1])[0];
$scope.status_tooltip = "Job " + $scope.status_label;
}
});
// update the job_status value. Use the cached rootScope value if there
// is one. This is a workaround when the rest call for the jobData is
// made before some socket events come in for the job status
if ($rootScope['lastSocketStatus' + jobData.id]) {
$scope.job_status = $rootScope['lastSocketStatus' + jobData.id];
delete $rootScope['lastSocketStatus' + jobData.id];
} else {
$scope.job_status = jobData.status;
}
// turn related api browser routes into tower routes
getTowerLinks();
@ -114,7 +135,6 @@ export default ['jobData', 'jobDataOptions', 'jobLabels', 'jobFinished', 'count'
$scope.relaunchJob = function() {
jobResultsService.relaunchJob($scope);
$state.reload();
};
$scope.lessLabels = false;
@ -420,13 +440,19 @@ export default ['jobData', 'jobDataOptions', 'jobLabels', 'jobFinished', 'count'
$scope.$on(`ws-jobs`, function(e, data) {
if (parseInt(data.unified_job_id, 10) ===
parseInt($scope.job.id,10)) {
$scope.job.status = data.status;
}
if (parseInt(data.project_id, 10) ===
// controller is defined, so set the job_status
$scope.job_status = data.status;
} else if (parseInt(data.project_id, 10) ===
parseInt($scope.job.project,10)) {
// this is a project status update message, so set the
// project status in the left pane
$scope.project_status = data.status;
$scope.project_update_link = `/#/scm_update/${data
.unified_job_id}`;
} else {
// controller was previously defined, but is not yet defined
// for this job. cache the socket status on root scope
$rootScope['lastSocketStatus' + data.unified_job_id] = data.status;
}
});
}];

View File

@ -70,7 +70,7 @@
<div class="JobResults-resultRowText">
<i class="JobResults-statusResultIcon
fa
icon-job-{{ job.status }}">
icon-job-{{ job_status }}">
</i> {{ status_label }}
</div>
</div>
@ -417,9 +417,10 @@
<div class="StandardOut-panelHeader">
<div class="StandardOut-panelHeaderText">
<i class="JobResults-statusResultIcon
fa icon-job-{{ job.status }}"
fa icon-job-{{ job_status }}"
ng-show="stdoutFullScreen"
aw-tool-tip="Job {{status_label}}"
data-tip-watch="status_tooltip"
aw-tip-placement="top"
data-original-title>
</i>

View File

@ -35,8 +35,9 @@ export default {
resolve: {
// the GET for the particular job
jobData: ['Rest', 'GetBasePath', '$stateParams', '$q', '$state', 'Alert', function(Rest, GetBasePath, $stateParams, $q, $state, Alert) {
Rest.setUrl(GetBasePath('jobs') + $stateParams.id);
var val = $q.defer();
Rest.setUrl(GetBasePath('jobs') + $stateParams.id);
Rest.get()
.then(function(data) {
val.resolve(data.data);
@ -51,6 +52,7 @@ export default {
$state.go('jobs');
});
return val.promise;
}],
Dataset: ['QuerySet', '$stateParams', 'jobData',

View File

@ -5,7 +5,7 @@
<li><a href="#stdout" id="stdout-link" data-toggle="tab" ng-click="toggleTab($event, 'stdout-link', 'logview-tabs')">Standard Out</a></li>
<li><a href="#traceback" id="traceback-link" data-toggle="tab" ng-click="toggleTab($event, 'traceback-link', 'logview-tabs')">Traceback</a></li>
<li><a href="#options" id="options-link" data-toggle="tab" ng-click="toggleTab($event, 'options-link', 'logview-tabs')">Options</a></li>
<li><a href="#variables" id="variables-link" data-toggle="tab" ng-click="toggleTab($event, 'variable-link', 'logview-tabs')">Extra Vars</a></li>
<li><a href="#variables" id="variables-link" data-toggle="tab" ng-click="toggleTab($event, 'variable-link', 'logview-tabs')">Extra Variables</a></li>
<li><a href="#source-variables" id="source-variables-link" data-toggle="tab" ng-click="toggleTab($event, 'source-variable-link', 'logview-tabs')">Source Vars</a></li>
</ul>
<div class="tab-content">

View File

@ -100,7 +100,7 @@
font-size: 12px;
color: @default-interface-txt;
background-color: @default-bg;
margin-right: 5px;
margin-right: 10px;
max-width: 100%;
white-space: nowrap;
text-overflow: ellipsis;
@ -115,7 +115,7 @@
max-width: ~"calc(100% - 23px)";
background-color: @default-link;
color: @default-bg;
margin-right: 5px;
margin-right: 10px;
}
.SmartSearch-deleteContainer {

View File

@ -56,7 +56,7 @@
</div>
<div class="StandardOut-detailsRow--extraVars" ng-show="job.extra_vars">
<div class="StandardOut-detailsLabel">EXTRA VARS</div>
<div class="StandardOut-detailsLabel">EXTRA VARIABLES</div>
</div>
<div class="StandardOut-extraVarsContainer" ng-show="job.extra_vars">

View File

@ -391,7 +391,7 @@ describe('Controller: jobResultsController', () => {
status: 'finished'
};
$rScope.$broadcast('ws-jobs', eventPayload);
expect($scope.job.status).toBe(eventPayload.status);
expect($scope.job_status).toBe(eventPayload.status);
});
});