mirror of
https://github.com/ansible/awx.git
synced 2026-03-27 22:05:07 -02:30
Switch to using element instead of attribute
This commit is contained in:
@@ -1,8 +1,8 @@
|
|||||||
angular.module('GraphDirectives', [])
|
angular.module('GraphDirectives', [])
|
||||||
.directive('jobStatusGraph', ['$rootScope', '$compile', '$location' , '$window', 'Wait', 'jobStatusGraphData',
|
.directive('jobStatusGraph', ['$rootScope', '$compile', '$location' , '$window', 'Wait', 'jobStatusGraphData',
|
||||||
function ($rootScope, $compile , $location, $window, Rest, Wait, jobStatusGraphData) {
|
function ($rootScope, $compile , $location, $window, Wait, jobStatusGraphData) {
|
||||||
return {
|
return {
|
||||||
restrict: 'A',
|
restrict: 'E',
|
||||||
templateUrl: '/static/partials/job_status_graph.html',
|
templateUrl: '/static/partials/job_status_graph.html',
|
||||||
link: link
|
link: link
|
||||||
};
|
};
|
||||||
@@ -26,17 +26,12 @@ angular.module('GraphDirectives', [])
|
|||||||
|
|
||||||
cleanup = _.compose(
|
cleanup = _.compose(
|
||||||
[ cleanup,
|
[ cleanup,
|
||||||
scope.$on('DataReceived:JobStatusGraph',
|
|
||||||
function(e, data) {
|
|
||||||
scope.$emit('graphDataReady', data);
|
|
||||||
})
|
|
||||||
]);
|
]);
|
||||||
|
|
||||||
function createGraph(period, jobtype){
|
function createGraph(period, jobtype){
|
||||||
console.log('createGraph');
|
jobStatusGraphData.get(period, jobtype).then(function(data) {
|
||||||
// jobStatusGraphData.get(period, jobtype).then(function(data) {
|
scope.$emit('graphDataReady', data);
|
||||||
// scope.$emit('graphDataReady', data);
|
});
|
||||||
// });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cleanup = _.compose(
|
cleanup = _.compose(
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
<div id="dash-counts" class="col-sm-12 col-xs-12"></div>
|
<div id="dash-counts" class="col-sm-12 col-xs-12"></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<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 class="right-side col-sm-6 col-xs-12"><div id="dash-host-status-graph" class="graph-container"></div></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
|||||||
@@ -15,12 +15,9 @@ describe('Job Status Graph Directive', function() {
|
|||||||
$httpBackend.whenGET('/static/partials/job_status_graph.html')
|
$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>");
|
.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();
|
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
|
// 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
|
// Then looks at each array of arrays, where index 0 is the timestamp & index 1 is the count of jobs with that status
|
||||||
|
|||||||
Reference in New Issue
Block a user