diff --git a/awx/ui/static/js/app.js b/awx/ui/static/js/app.js index edd2ae1ecf..9418471650 100644 --- a/awx/ui/static/js/app.js +++ b/awx/ui/static/js/app.js @@ -587,6 +587,10 @@ angular.module('Tower', [ $log.debug('Job summary_complete ' + data.unified_job_id); $rootScope.$emit('JobSummaryComplete', data); }); + sock.on("schedule_change", function(data) { + $log.debug('schedule changed to ' + data.status); + $rootScope.$emit('ScheduleChange', data); + }); } openSocket(); diff --git a/awx/ui/static/js/config.js b/awx/ui/static/js/config.js index d5aaad5979..abed710242 100644 --- a/awx/ui/static/js/config.js +++ b/awx/ui/static/js/config.js @@ -5,8 +5,8 @@ * config.js * * Gobal configuration variables for controlling application behavior. - * - * Do NOT change this file, unless the changes should be included in + * + * Do NOT change this file, unless the changes should be included in * production builds. For development, copy this file to local_config.js, * and make changes. git will ignore local_config.js * diff --git a/awx/ui/static/js/controllers/Home.js b/awx/ui/static/js/controllers/Home.js index 76c45ca7f5..e3f20d2ce0 100644 --- a/awx/ui/static/js/controllers/Home.js +++ b/awx/ui/static/js/controllers/Home.js @@ -25,12 +25,12 @@ * Host count graph should only be loaded if the user is a super user * */ -function Home($scope, $compile, $routeParams, $rootScope, $location, Wait, DashboardCounts, HostGraph, JobStatusGraph, HostPieChart, DashboardJobs, +function Home($scope, $compile, $routeParams, $rootScope, $location, $log, Wait, DashboardCounts, HostGraph, JobStatusGraph, HostPieChart, DashboardJobs, ClearScope, Stream, Rest, GetBasePath, ProcessErrors, Button){ ClearScope('home'); - var buttons, html, e, waitCount, loadedCount,borderStyles; + var buttons, html, e, waitCount, loadedCount,borderStyles, jobs_scope, schedule_scope; // Add buttons to the top of the Home page. We're using lib/ansible/generator_helpers.js-> Buttons() // to build buttons dynamically and insure all styling and icons match the rest of the application. @@ -77,8 +77,12 @@ function Home($scope, $compile, $routeParams, $rootScope, $location, Wait, Dashb if ($scope.removeWidgetLoaded) { $scope.removeWidgetLoaded(); } - $scope.removeWidgetLoaded = $scope.$on('WidgetLoaded', function () { + $scope.removeWidgetLoaded = $scope.$on('WidgetLoaded', function (e, label, jobscope, schedulescope) { // Once all the widgets report back 'loaded', turn off Wait widget + if(label==="dashboard_jobs"){ + jobs_scope = jobscope; + schedule_scope = schedulescope; + } loadedCount++; if (loadedCount === waitCount) { $(window).resize(_.debounce(function() { @@ -92,8 +96,6 @@ function Home($scope, $compile, $routeParams, $rootScope, $location, Wait, Dashb } }); - - if ($scope.removeDashboardReady) { $scope.removeDashboardReady(); } @@ -135,8 +137,6 @@ function Home($scope, $compile, $routeParams, $rootScope, $location, Wait, Dashb else{ $('#dash-host-count-graph').remove(); //replaceWith("
"); } - - DashboardJobs({ scope: $scope, target: 'dash-jobs-list', @@ -150,6 +150,23 @@ function Home($scope, $compile, $routeParams, $rootScope, $location, Wait, Dashb }); + if ($rootScope.removeJobStatusChange) { + $rootScope.removeJobStatusChange(); + } + $rootScope.removeJobStatusChange = $rootScope.$on('JobStatusChange', function() { + jobs_scope.refreshJobs(); + $scope.$emit('ReloadJobStatusGraph'); + + }); + + if ($rootScope.removeScheduleChange) { + $rootScope.removeScheduleChange(); + } + $rootScope.removeScheduleChange = $rootScope.$on('ScheduleChange', function() { + schedule_scope.refreshSchedules(); + $scope.$emit('ReloadJobStatusGraph'); + }); + $scope.showActivity = function () { Stream({ scope: $scope @@ -174,7 +191,7 @@ function Home($scope, $compile, $routeParams, $rootScope, $location, Wait, Dashb } -Home.$inject = ['$scope', '$compile', '$routeParams', '$rootScope', '$location', 'Wait', 'DashboardCounts', 'HostGraph','JobStatusGraph', 'HostPieChart', 'DashboardJobs', +Home.$inject = ['$scope', '$compile', '$routeParams', '$rootScope', '$location', '$log','Wait', 'DashboardCounts', 'HostGraph','JobStatusGraph', 'HostPieChart', 'DashboardJobs', 'ClearScope', 'Stream', 'Rest', 'GetBasePath', 'ProcessErrors', 'Button' ]; diff --git a/awx/ui/static/js/hostcount.json b/awx/ui/static/js/hostcount.json deleted file mode 100644 index 0ef475d16d..0000000000 --- a/awx/ui/static/js/hostcount.json +++ /dev/null @@ -1,28 +0,0 @@ -[ - { - "key" : "Hosts" , - "color" : "#1778c3", - "values" : [ - [1340755200000 , 2] , [1340762400000 , 4] , - [1340769600000 , 8] , [1340776800000 , 16] , - [1340784000000 , 32] , [1340791200000 , 64] , - [1340798400000 , 128] , [1340805600000 , 150] , - [1340812800000 , 175] , [1340820000000 , 180] , - [1340827200000 , 190] , [1340834400000 , 195] , - [1343347200000 , 195] - ] - }, - { - "key" : "License" , - "color" : "#171717", - "values" : [ - [1340755200000 , 500] , [1340762400000 , 500] , - [1340769600000 , 500] , [1340776800000 , 500] , - [1340784000000 , 500] , [1340791200000 , 500] , - [1340798400000 , 500] , [1340805600000 , 500] , - [1340812800000 , 500] , [1340820000000 , 500] , - [1340827200000 , 500] , [1340834400000 , 500] , - [1343347200000 , 500] - ] - } -] \ No newline at end of file diff --git a/awx/ui/static/js/jobstatusdata.json b/awx/ui/static/js/jobstatusdata.json deleted file mode 100644 index 5d8ff06e3a..0000000000 --- a/awx/ui/static/js/jobstatusdata.json +++ /dev/null @@ -1,30 +0,0 @@ -[ - { - "key" : "Successful" , - "color" : "#1778c3", - "values" : [ - [1340755200000 , 100] , [1340762400000 , 101] , - [1340769600000 , 102] , [1340776800000 , 103] , - [1340784000000 , 103] , [1340791200000 , 103] , - [1340798400000 , 103] , [1340805600000 , 103] , - [1340812800000 , 103] , [1340820000000 , 103] , - [1340827200000 , 103] , [1340834400000 , 103] , - [1343347200000 , 103] - ] - }, - { - "key" : "Failed" , - "color" : "#aa0000", - "values" : [ - [1340755200000 , 50] , [1340762400000 , 50] , - [1340769600000 , 50] , [1340776800000 , 50] , - [1340784000000 , 50] , [1340791200000 , 50] , - [1340798400000 , 50] , [1340805600000 , 50] , - [1340812800000 , 50] , [1340820000000 , 50] , - [1340827200000 , 50] , [1340834400000 , 50] , - [1343347200000 , 50] - ] - } -] - - diff --git a/awx/ui/static/js/widgets/DashboardJobs.js b/awx/ui/static/js/widgets/DashboardJobs.js index 7dc39c3176..99beb23957 100644 --- a/awx/ui/static/js/widgets/DashboardJobs.js +++ b/awx/ui/static/js/widgets/DashboardJobs.js @@ -55,7 +55,7 @@ angular.module('DashboardJobsWidget', ['RestServices', 'Utilities']) listCount++; if (listCount === 1) { //api_complete = true; - scope.$emit('WidgetLoaded'); + scope.$emit('WidgetLoaded', "dashboard_jobs", jobs_scope, scheduled_scope); } }); diff --git a/awx/ui/static/js/widgets/JobStatusGraph.js b/awx/ui/static/js/widgets/JobStatusGraph.js index ef313d7c1f..6477ca7b6f 100644 --- a/awx/ui/static/js/widgets/JobStatusGraph.js +++ b/awx/ui/static/js/widgets/JobStatusGraph.js @@ -81,6 +81,13 @@ angular.module('JobStatusGraphWidget', ['RestServices', 'Utilities']) }); } + if ($rootScope.removeReloadJobStatusGraph) { + $rootScope.removeReloadJobStatusGraph(); + } + $rootScope.removeReloadJobStatusGraph = $rootScope.$on('ReloadJobStatusGraph', function() { + createGraph(); + }); + element = angular.element(document.getElementById(target)); element.html(html); $compile(element)(scope);