Switch to using element instead of attribute

This commit is contained in:
Joe Fiorini 2015-01-22 17:46:21 -05:00
parent 7f291c91b5
commit 8e092714fb
3 changed files with 7 additions and 15 deletions

View File

@ -1,8 +1,8 @@
angular.module('GraphDirectives', [])
.directive('jobStatusGraph', ['$rootScope', '$compile', '$location' , '$window', 'Wait', 'jobStatusGraphData',
function ($rootScope, $compile , $location, $window, Rest, Wait, jobStatusGraphData) {
function ($rootScope, $compile , $location, $window, Wait, jobStatusGraphData) {
return {
restrict: 'A',
restrict: 'E',
templateUrl: '/static/partials/job_status_graph.html',
link: link
};
@ -26,17 +26,12 @@ angular.module('GraphDirectives', [])
cleanup = _.compose(
[ cleanup,
scope.$on('DataReceived:JobStatusGraph',
function(e, data) {
scope.$emit('graphDataReady', data);
})
]);
function createGraph(period, jobtype){
console.log('createGraph');
// jobStatusGraphData.get(period, jobtype).then(function(data) {
// scope.$emit('graphDataReady', data);
// });
jobStatusGraphData.get(period, jobtype).then(function(data) {
scope.$emit('graphDataReady', data);
});
}
cleanup = _.compose(

View File

@ -12,7 +12,7 @@
<div id="dash-counts" class="col-sm-12 col-xs-12"></div>
</div>
<div class="row">
<div class="left-side col-sm-6 col-xs-12"><div id="dash-job-status-graph" class="graph-container"><div job-status-graph data="graphData.jobStatus"></div> </div></div>
<div class="left-side col-sm-6 col-xs-12"><div id="dash-job-status-graph" class="graph-container"><job-status-graph data="graphData.jobStatus" period="month" job-type="all"></job-status-graph> </div></div>
<div class="right-side col-sm-6 col-xs-12"><div id="dash-host-status-graph" class="graph-container"></div></div>
</div>
<div class="row">

View File

@ -15,12 +15,9 @@ describe('Job Status Graph Directive', function() {
$httpBackend.whenGET('/static/partials/job_status_graph.html')
.respond("<div class='m'></div><div class='n'></div><div class='job-status-graph'><svg></svg></div>");
// $httpBackend.whenGET('/api/').respond(200,
// {"available_versions": {"v1": "/api/v1/"}, "description": "Ansible Tower REST API", "current_version": "/api/v1/"});
scope = $rootScope.$new();
element = '<div job-status-graph class="job-status-graph" data="data"></div>';
element = '<job-status-graph class="job-status-graph" data="data" job-type="all" period="month"></job-status-graph>';
// Takes jobs grouped by result (successful or failure
// Then looks at each array of arrays, where index 0 is the timestamp & index 1 is the count of jobs with that status