Fix jshint errors in my updates

This commit is contained in:
Joe Fiorini
2015-01-30 10:27:01 -05:00
parent ffc12c3065
commit 2464d68b38
9 changed files with 507 additions and 513 deletions

View File

@@ -30,7 +30,7 @@ function Home($scope, $compile, $routeParams, $rootScope, $location, $log, Wait,
ClearScope('home'); ClearScope('home');
var buttons, html, e, borderStyles, jobs_scope, schedule_scope; var buttons, html, e, borderStyles;
// Add buttons to the top of the Home page. We're using lib/ansible/generator_helpers.js-> Buttons() // 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. // to build buttons dynamically and insure all styling and icons match the rest of the application.

View File

@@ -5,7 +5,7 @@ angular.module('DashboardGraphs')
// fit into a single a page; assumes there are 2 rows // fit into a single a page; assumes there are 2 rows
// of modules, with the available height being offset // of modules, with the available height being offset
// by the navbar & the count summaries module // by the navbar & the count summaries module
return function(scope, element, attr) { return function(scope, element) {
// We need to trigger a resize on the first call // We need to trigger a resize on the first call
// to this when the view things load; but we don't want // to this when the view things load; but we don't want

View File

@@ -8,20 +8,32 @@ angular.module('DashboardGraphs').
}; };
function link(scope, element, attr) { function link(scope, element, attr) {
var url, license, license_graph; var license_graph;
scope.$watch(attr.data, function(data) { scope.$watch(attr.data, function(data) {
if(!data) return;
if(!data) {
return;
}
createGraph(data.hosts, data.license); createGraph(data.hosts, data.license);
}); });
function onResize() { function onResize() {
if(!license_graph) return;
if(!license_graph) {
return;
}
adjustGraphSize(license_graph, element); adjustGraphSize(license_graph, element);
} }
angular.element($window).on('resize', function(e) { angular.element($window).on('resize', function() {
if(!license_graph) return;
if(!license_graph) {
return;
}
adjustGraphSize(license_graph, element); adjustGraphSize(license_graph, element);
}); });
@@ -34,13 +46,11 @@ angular.module('DashboardGraphs').
function createGraph(data, license) { function createGraph(data, license) {
//url = getBasePath('dashboard')+'graphs/'; //url = getBasePath('dashboard')+'graphs/';
var graphData = [ var graphData = [
{ { "key" : "Hosts" ,
"key" : "Hosts" ,
"color" : "#1778c3", "color" : "#1778c3",
"values": data.hosts "values": data.hosts
}, },
{ { "key" : "License" ,
"key" : "License" ,
"color" : "#171717", "color" : "#171717",
"values": data.hosts "values": data.hosts
} }

View File

@@ -8,7 +8,7 @@ angular.module('DashboardGraphs')
}; };
function link(scope, element, attr) { function link(scope, element, attr) {
var html, canvas, context, winHeight, available_height, host_pie_chart; var host_pie_chart;
scope.$watch(attr.data, function(data) { scope.$watch(attr.data, function(data) {
if (data && data.hosts) { if (data && data.hosts) {
@@ -43,20 +43,16 @@ angular.module('DashboardGraphs')
function createGraph(data) { function createGraph(data) {
if(data.hosts.total+data.hosts.failed>0){ if(data.hosts.total+data.hosts.failed>0){
data = [ data = [
{ { "label": "Successful",
"label": "Successful",
"color": "#00aa00", "color": "#00aa00",
"value" : data.hosts.total "value" : data.hosts.total
} , } ,
{ { "label": "Failed",
"label": "Failed",
"color" : "#aa0000", "color" : "#aa0000",
"value" : data.hosts.failed "value" : data.hosts.failed
} }
]; ];
var width = $('.graph-container').width(), // nv.utils.windowSize().width/3,
height = $('.graph-container').height()*0.7; //nv.utils.windowSize().height/5,
host_pie_chart = nv.models.pieChart() host_pie_chart = nv.models.pieChart()
.margin({top: 5, right: 75, bottom: 25, left: 85}) .margin({top: 5, right: 75, bottom: 25, left: 85})
.x(function(d) { return d.label; }) .x(function(d) { return d.label; })

View File

@@ -1,6 +1,6 @@
angular.module('DashboardGraphs') angular.module('DashboardGraphs')
.directive('jobStatusGraph', ['$rootScope', '$compile', '$location' , '$window', 'Wait', 'adjustGraphSize', 'jobStatusGraphData', .directive('jobStatusGraph', ['$rootScope', '$compile', '$location' , '$window', 'Wait', 'adjustGraphSize', 'jobStatusGraphData',
function ($rootScope, $compile , $location, $window, Wait, adjustGraphSize, jobStatusGraphData) { function ($rootScope, $compile , $location, $window, Wait, adjustGraphSize) {
return { return {
restrict: 'E', restrict: 'E',
templateUrl: '/static/partials/job_status_graph.html', templateUrl: '/static/partials/job_status_graph.html',
@@ -8,15 +8,11 @@ angular.module('DashboardGraphs')
}; };
function link(scope, element, attr) { function link(scope, element, attr) {
var html; var job_type, job_status_chart = nv.models.lineChart();
var url;
var job_status_chart = nv.models.lineChart();
var cleanup = angular.noop;
scope.period="month"; scope.period="month";
scope.jobType="all"; scope.jobType="all";
var data;
scope.$watch(attr.data, function(value) { scope.$watch(attr.data, function(value) {
if (value) { if (value) {
createGraph(value, scope.period, scope.jobType); createGraph(value, scope.period, scope.jobType);
@@ -29,13 +25,11 @@ angular.module('DashboardGraphs')
scope.jobType = jobtype; scope.jobType = jobtype;
var timeFormat, graphData = [ var timeFormat, graphData = [
{ { "color": "#00aa00",
"color": "#00aa00",
"key": "Successful", "key": "Successful",
"values": data.jobs.successful "values": data.jobs.successful
}, },
{ { "key" : "Failed" ,
"key" : "Failed" ,
"color" : "#aa0000", "color" : "#aa0000",
"values": data.jobs.failed "values": data.jobs.failed
} }
@@ -66,9 +60,6 @@ angular.module('DashboardGraphs')
.showXAxis(true); //Show the x-axis .showXAxis(true); //Show the x-axis
var width = $('.graph-container').width(); // nv.utils.windowSize().width/3,
var height = $('.graph-container').height()*0.7; //nv.utils.windowSize().height/5,
job_status_chart.xAxis job_status_chart.xAxis
.axisLabel("Time")//.showMaxMin(true) .axisLabel("Time")//.showMaxMin(true)
.tickFormat(function(d) { .tickFormat(function(d) {

View File

@@ -83,8 +83,8 @@ angular.module('DashboardGraphs').
.call(chartModel.xAxis); .call(chartModel.xAxis);
graph.selectAll('.line') graph.selectAll('.line')
.attr('d', chartModel.lines) .attr('d', chartModel.lines);
chartModel.update(); chartModel.update();
} };
}); });

View File

@@ -15,17 +15,17 @@ function HostCountGraphData(Rest, getBasePath, processErrors, $q) {
} }
function getLicenseData() { function getLicenseData() {
url = getBasePath('config'); var url = getBasePath('config');
Rest.setUrl(url); Rest.setUrl(url);
return Rest.get() return Rest.get()
.then(function (data){ .then(function (data){
license = data.data.license_info.instance_count; var license = data.data.license_info.instance_count;
return license; return license;
}) });
} }
function getHostData() { function getHostData() {
url = getBasePath('dashboard')+'graphs/inventory/'; var url = getBasePath('dashboard')+'graphs/inventory/';
Rest.setUrl(url); Rest.setUrl(url);
return pluck('data', Rest.get()); return pluck('data', Rest.get());
} }

View File

@@ -4,12 +4,9 @@ angular.module('DataServices')
"GetBasePath", "GetBasePath",
"ProcessErrors", "ProcessErrors",
"$rootScope", "$rootScope",
"$q",
JobStatusGraphData]); JobStatusGraphData]);
function JobStatusGraphData(Rest, getBasePath, processErrors, $rootScope, $q) { function JobStatusGraphData(Rest, getBasePath, processErrors, $rootScope) {
var callbacks = {};
var currentCallbackId = 0;
function pluck(property, promise) { function pluck(property, promise) {
return promise.then(function(value) { return promise.then(function(value) {