From 92e643d60d9ef6f9e053dca17e1bc455f26f9b71 Mon Sep 17 00:00:00 2001 From: Joe Fiorini Date: Wed, 4 Mar 2015 14:16:58 -0500 Subject: [PATCH] Fix filtering job status graph --- .../static/js/directives/job-status-graph.js | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/awx/ui/static/js/directives/job-status-graph.js b/awx/ui/static/js/directives/job-status-graph.js index 0bb06afce9..7b54e1e8e0 100644 --- a/awx/ui/static/js/directives/job-status-graph.js +++ b/awx/ui/static/js/directives/job-status-graph.js @@ -9,7 +9,7 @@ export default JobStatusGraph ]; -function JobStatusGraph($rootScope, $compile , $location, $window, Wait, adjustGraphSize) { +function JobStatusGraph($rootScope, $compile , $location, $window, Wait, adjustGraphSize, graphDataService) { return { restrict: 'E', scope: { @@ -27,12 +27,20 @@ function JobStatusGraph($rootScope, $compile , $location, $window, Wait, adjustG scope.$watch('data', function(value) { if (value) { - createGraph(value, scope.period, scope.jobType); + createGraph(scope.period, scope.jobType, value); } }, true); + function recreateGraph(period, jobType) { + graphDataService.get(period, jobType) + .then(function(data) { + scope.data = data; + scope.period = period; + scope.jobType = jobType; + }); + } - function createGraph(data, period, jobtype){ + function createGraph(period, jobtype, data){ scope.period = period; scope.jobType = jobtype; @@ -100,7 +108,7 @@ function JobStatusGraph($rootScope, $compile , $location, $window, Wait, adjustG period = this.getAttribute("id"); $('#period-dropdown').replaceWith(""+this.text+"\n"); - createGraph(data, period, job_type); + recreateGraph(period, job_type); }); //On click, update with new data @@ -109,7 +117,7 @@ function JobStatusGraph($rootScope, $compile , $location, $window, Wait, adjustG job_type = this.getAttribute("id"); $('#type-dropdown').replaceWith(""+this.text+"\n"); - createGraph(data, period, job_type); + recreateGraph(period, job_type); }); adjustGraphSize(job_status_chart, element);