mirror of
https://github.com/ansible/awx.git
synced 2026-05-24 17:17:45 -02:30
Fix errors resizing job status graph
This commit is contained in:
@@ -8,48 +8,26 @@ angular.module('DashboardGraphs')
|
||||
};
|
||||
|
||||
function link(scope, element, attr) {
|
||||
var html, url, job_status_chart,
|
||||
period="month",
|
||||
job_type="all";
|
||||
|
||||
var html;
|
||||
var url;
|
||||
var job_status_chart;
|
||||
var job_status_chart;
|
||||
var cleanup = angular.noop;
|
||||
|
||||
scope.period="month";
|
||||
scope.jobType="all";
|
||||
|
||||
var data;
|
||||
scope.$watch(attr.data, function(value) {
|
||||
if (value) {
|
||||
scope.$emit('graphDataReady', value);
|
||||
createGraph(value, scope.period, scope.jobType);
|
||||
}
|
||||
});
|
||||
|
||||
scope.$on('$destroy', cleanup);
|
||||
function createGraph(data, period, jobtype){
|
||||
|
||||
cleanup = _.compose(
|
||||
[ cleanup,
|
||||
]);
|
||||
|
||||
function createGraph(period, jobtype){
|
||||
jobStatusGraphData.get(period, jobtype).then(function(data) {
|
||||
scope.$emit('graphDataReady', data);
|
||||
});
|
||||
}
|
||||
|
||||
var w = angular.element($window);
|
||||
|
||||
|
||||
angular.element($window).on('resize', function() {
|
||||
adjustGraphSize(job_status_chart, element);
|
||||
});
|
||||
|
||||
element.on('$destroy', function() {
|
||||
angular.element($window).off('resize', adjustGraphSize);
|
||||
});
|
||||
|
||||
if (scope.removeGraphDataReady) {
|
||||
scope.removeGraphDataReady();
|
||||
}
|
||||
|
||||
var job_status_chart;
|
||||
scope.removeGraphDataReady = scope.$on('graphDataReady', function (e, data) {
|
||||
scope.period = period;
|
||||
scope.jobType = jobtype;
|
||||
|
||||
var timeFormat, graphData = [
|
||||
{
|
||||
@@ -127,7 +105,7 @@ angular.module('DashboardGraphs')
|
||||
period = this.getAttribute("id");
|
||||
$('#period-dropdown').replaceWith("<a id=\"period-dropdown\" role=\"button\" data-toggle=\"dropdown\" data-target=\"#\" href=\"/page.html\">"+this.text+"<span class=\"caret\"><span>\n");
|
||||
|
||||
createGraph(period, job_type);
|
||||
createGraph(data, period, job_type);
|
||||
});
|
||||
|
||||
//On click, update with new data
|
||||
@@ -136,11 +114,30 @@ angular.module('DashboardGraphs')
|
||||
job_type = this.getAttribute("id");
|
||||
$('#type-dropdown').replaceWith("<a id=\"type-dropdown\" role=\"button\" data-toggle=\"dropdown\" data-target=\"#\" href=\"/page.html\">"+this.text+"<span class=\"caret\"><span>\n");
|
||||
|
||||
createGraph(period, job_type);
|
||||
createGraph(data, period, job_type);
|
||||
});
|
||||
|
||||
adjustGraphSize(job_status_chart, element);
|
||||
|
||||
}
|
||||
|
||||
var w = angular.element($window);
|
||||
|
||||
|
||||
angular.element($window).on('resize', function() {
|
||||
adjustGraphSize(job_status_chart, element);
|
||||
});
|
||||
|
||||
element.on('$destroy', function() {
|
||||
angular.element($window).off('resize', adjustGraphSize);
|
||||
});
|
||||
|
||||
if (scope.removeGraphDataReady) {
|
||||
scope.removeGraphDataReady();
|
||||
}
|
||||
|
||||
scope.removeGraphDataReady = scope.$on('graphDataReady', function (e, data) {
|
||||
|
||||
return job_status_chart;
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user