mirror of
https://github.com/ansible/awx.git
synced 2026-02-27 07:56:06 -03:30
fix stdout ordering
This commit is contained in:
@@ -27,6 +27,7 @@ export default ['jobResultsService', 'parseStdoutService', function(jobResultsSe
|
|||||||
if (event.stdout) {
|
if (event.stdout) {
|
||||||
mungedEvent.stdout = parseStdoutService.parseStdout(event);
|
mungedEvent.stdout = parseStdoutService.parseStdout(event);
|
||||||
mungedEvent.start_line = event.start_line + 1;
|
mungedEvent.start_line = event.start_line + 1;
|
||||||
|
mungedEvent.end_line = event.end_line + 1;
|
||||||
mungedEvent.changes.push('stdout');
|
mungedEvent.changes.push('stdout');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -285,6 +285,51 @@ function(jobData, jobDataOptions, jobLabels, jobFinished, count, $scope, ParseTy
|
|||||||
}
|
}
|
||||||
|
|
||||||
// EVENT STUFF BELOW
|
// EVENT STUFF BELOW
|
||||||
|
var linesInPane = [];
|
||||||
|
|
||||||
|
function addToLinesInPane(event) {
|
||||||
|
var arr = _.range(event.start_line, event.end_line);
|
||||||
|
linesInPane = linesInPane.concat(arr);
|
||||||
|
linesInPane = linesInPane.sort(function(a, b) {
|
||||||
|
return a - b;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function appendToBottom (event){
|
||||||
|
// if we get here then the event type was either a
|
||||||
|
// header line, recap line, or one of the additional
|
||||||
|
// event types, so we append it to the bottom.
|
||||||
|
// These are the event types for captured
|
||||||
|
// stdout not directly related to playbook or runner
|
||||||
|
// events:
|
||||||
|
// (0, 'debug', _('Debug'), False),
|
||||||
|
// (0, 'verbose', _('Verbose'), False),
|
||||||
|
// (0, 'deprecated', _('Deprecated'), False),
|
||||||
|
// (0, 'warning', _('Warning'), False),
|
||||||
|
// (0, 'system_warning', _('System Warning'), False),
|
||||||
|
// (0, 'error', _('Error'), True),
|
||||||
|
angular
|
||||||
|
.element(".JobResultsStdOut-stdoutContainer")
|
||||||
|
.append($compile(event
|
||||||
|
.stdout)($scope.events[event
|
||||||
|
.counter]));
|
||||||
|
};
|
||||||
|
|
||||||
|
function putInCorrectPlace(event) {
|
||||||
|
if (linesInPane.length) {
|
||||||
|
for (var i = linesInPane.length - 1; i >= 0; i--) {
|
||||||
|
if (event.start_line > linesInPane[i]) {
|
||||||
|
$(`.line_num_${linesInPane[i]}`)
|
||||||
|
.after($compile(event
|
||||||
|
.stdout)($scope.events[event
|
||||||
|
.counter]));
|
||||||
|
i = -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
appendToBottom(event);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// This is where the async updates to the UI actually happen.
|
// This is where the async updates to the UI actually happen.
|
||||||
// Flow is event queue munging in the service -> $scope setting in here
|
// Flow is event queue munging in the service -> $scope setting in here
|
||||||
@@ -338,26 +383,6 @@ function(jobData, jobDataOptions, jobLabels, jobFinished, count, $scope, ParseTy
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(change === 'stdout'){
|
if(change === 'stdout'){
|
||||||
var appendToBottom = function(mungedEvent){
|
|
||||||
// if we get here then the event type was either a
|
|
||||||
// header line, recap line, or one of the additional
|
|
||||||
// event types, so we append it to the bottom.
|
|
||||||
// These are the event types for captured
|
|
||||||
// stdout not directly related to playbook or runner
|
|
||||||
// events:
|
|
||||||
// (0, 'debug', _('Debug'), False),
|
|
||||||
// (0, 'verbose', _('Verbose'), False),
|
|
||||||
// (0, 'deprecated', _('Deprecated'), False),
|
|
||||||
// (0, 'warning', _('Warning'), False),
|
|
||||||
// (0, 'system_warning', _('System Warning'), False),
|
|
||||||
// (0, 'error', _('Error'), True),
|
|
||||||
angular
|
|
||||||
.element(".JobResultsStdOut-stdoutContainer")
|
|
||||||
.append($compile(mungedEvent
|
|
||||||
.stdout)($scope.events[mungedEvent
|
|
||||||
.counter]));
|
|
||||||
};
|
|
||||||
|
|
||||||
if (!$scope.events[mungedEvent.counter]) {
|
if (!$scope.events[mungedEvent.counter]) {
|
||||||
// line hasn't been put in the pane yet
|
// line hasn't been put in the pane yet
|
||||||
|
|
||||||
@@ -375,6 +400,7 @@ function(jobData, jobDataOptions, jobLabels, jobFinished, count, $scope, ParseTy
|
|||||||
.after($compile(mungedEvent
|
.after($compile(mungedEvent
|
||||||
.stdout)($scope.events[mungedEvent
|
.stdout)($scope.events[mungedEvent
|
||||||
.counter]));
|
.counter]));
|
||||||
|
addToLinesInPane(mungedEvent);
|
||||||
} else {
|
} else {
|
||||||
var putIn;
|
var putIn;
|
||||||
var classList = $("div",
|
var classList = $("div",
|
||||||
@@ -396,30 +422,33 @@ function(jobData, jobDataOptions, jobLabels, jobFinished, count, $scope, ParseTy
|
|||||||
var isDup = false;
|
var isDup = false;
|
||||||
|
|
||||||
if ($(".header_" + putIn + ",." + putIn).length === 0) {
|
if ($(".header_" + putIn + ",." + putIn).length === 0) {
|
||||||
appendToBottom(mungedEvent);
|
putInCorrectPlace(mungedEvent);
|
||||||
|
addToLinesInPane(mungedEvent);
|
||||||
} else {
|
} else {
|
||||||
$(".header_" + putIn + ",." + putIn)
|
$(".header_" + putIn + ",." + putIn)
|
||||||
.each((i, v) => {
|
.each((i, v) => {
|
||||||
if (angular.element(v).scope()
|
if (angular.element(v).scope()
|
||||||
.event.start_line < mungedEvent
|
.event.start_line < mungedEvent
|
||||||
.start_line) {
|
.start_line) {
|
||||||
putAfter = v;
|
putAfter = v;
|
||||||
} else if (angular.element(v).scope()
|
} else if (angular.element(v).scope()
|
||||||
.event.start_line === mungedEvent
|
.event.start_line === mungedEvent
|
||||||
.start_line) {
|
.start_line) {
|
||||||
isDup = true;
|
isDup = true;
|
||||||
return false;
|
return false;
|
||||||
} else if (angular.element(v).scope()
|
} else if (angular.element(v).scope()
|
||||||
.event.start_line > mungedEvent
|
.event.start_line > mungedEvent
|
||||||
.start_line) {
|
.start_line) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
appendToBottom(mungedEvent);
|
appendToBottom(mungedEvent);
|
||||||
|
addToLinesInPane(mungedEvent);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isDup) {
|
if (!isDup && putAfter) {
|
||||||
|
addToLinesInPane(mungedEvent);
|
||||||
$(putAfter).after($compile(mungedEvent
|
$(putAfter).after($compile(mungedEvent
|
||||||
.stdout)($scope.events[mungedEvent
|
.stdout)($scope.events[mungedEvent
|
||||||
.counter]));
|
.counter]));
|
||||||
|
|||||||
Reference in New Issue
Block a user