updated of stdout sections to include event

This commit is contained in:
John Mitchell 2016-11-18 18:17:11 -05:00
parent 9538ad2983
commit f7e184650b
2 changed files with 39 additions and 4 deletions

View File

@ -96,6 +96,8 @@ export default ['jobData', 'jobDataOptions', 'jobLabels', 'jobFinished', 'count'
$scope.followTooltip = "Currently following standard out as it comes in. Click to unfollow.";
}
$scope.events = {};
// EVENT STUFF BELOW
// This is where the async updates to the UI actually happen.
@ -145,10 +147,21 @@ export default ['jobData', 'jobDataOptions', 'jobLabels', 'jobFinished', 'count'
if(change === 'stdout'){
// put stdout elements in stdout container
// this scopes the event to that particular
// block of stdout.
// If you need to see the event a particular
// stdout block is from, you can:
// angular.element($0).scope().event
$scope.events[mungedEvent.counter] = $scope.$new();
$scope.events[mungedEvent.counter]
.event = mungedEvent;
angular
.element(".JobResultsStdOut-stdoutContainer")
.append($compile(mungedEvent
.stdout)($scope));
.stdout)($scope.events[mungedEvent
.counter]));
// move the followAnchor to the bottom of the
// container
@ -158,6 +171,11 @@ export default ['jobData', 'jobDataOptions', 'jobLabels', 'jobFinished', 'count'
// if follow is engaged,
// scroll down to the followAnchor
if ($scope.followEngaged) {
if (!$scope.followScroll) {
$scope.followScroll = function() {
return null;
}
}
$scope.followScroll();
}
}

View File

@ -39,7 +39,6 @@ describe('Controller: jobResultsController', () => {
'populate',
'markProcessed'
]);
$compile = jasmine.createSpy('$compile');
$provide.value('jobData', jobData);
$provide.value('jobDataOptions', jobDataOptions);
@ -50,7 +49,6 @@ describe('Controller: jobResultsController', () => {
$provide.value('ParseVariableString', ParseVariableString);
$provide.value('jobResultsService', jobResultsService);
$provide.value('eventQueue', eventQueue);
$provide.value('$compile', $compile);
});
};
@ -554,6 +552,25 @@ describe('Controller: jobResultsController', () => {
});
});
// TODO: stdout change tests
describe('populate - stdout', () => {
beforeEach(() => {
populateResolve = {
counter: 12,
stdout: "line",
changes: ['stdout']
};
bootstrapTest();
$scope.followEngaged = true;
$scope.$apply();
});
it('creates new child scope for the event', () => {
expect($scope.events[12].event).toBe(populateResolve);
});
});
});
});