1
0
mirror of https://github.com/ansible/awx.git synced 2024-11-02 01:21:21 +03:00

Fix live events on dashboard

This commit is contained in:
Joe Fiorini 2015-03-04 14:16:29 -05:00
parent e653e9561a
commit f8c3fd11da
3 changed files with 21 additions and 2 deletions

View File

@ -94,6 +94,17 @@ export function Home($scope, $compile, $routeParams, $rootScope, $location, $log
$scope.graphData = graphData;
var cleanupJobListener =
$rootScope.$on('DataReceived:JobStatusGraph', function(e, data) {
$scope.refresh();
$scope.graphData.jobStatus = data;
});
$scope.$on('$destroy', function() {
cleanupJobListener();
});
DashboardJobs({
scope: $scope,
target: 'dash-jobs-list',

View File

@ -12,6 +12,9 @@ export default
function JobStatusGraph($rootScope, $compile , $location, $window, Wait, adjustGraphSize) {
return {
restrict: 'E',
scope: {
data: '='
},
templateUrl: '/static/partials/job_status_graph.html',
link: link
};
@ -22,11 +25,12 @@ function JobStatusGraph($rootScope, $compile , $location, $window, Wait, adjustG
scope.period="month";
scope.jobType="all";
scope.$watch(attr.data, function(value) {
scope.$watch('data', function(value) {
if (value) {
createGraph(value, scope.period, scope.jobType);
}
});
}, true);
function createGraph(data, period, jobtype){

View File

@ -48,6 +48,10 @@ angular.module('DashboardJobsWidget', ['RestServices', 'Utilities'])
e.html(html);
$compile(e)(scope);
$rootScope.$on('JobStatusChange', function() {
jobs_scope.refreshJobs();
});
if (scope.removeListLoaded) {
scope.removeListLoaded();
}