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');
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()
// to build buttons dynamically and insure all styling and icons match the rest of the application.

View File

@@ -1,11 +1,11 @@
angular.module('DashboardGraphs')
.directive('autoSizeModule', ['$window', '$timeout', function($window, $timeout) {
.directive('autoSizeModule', ['$window', '$timeout', function($window, $timeout) {
// Adjusts the size of the module so that all modules
// fit into a single a page; assumes there are 2 rows
// of modules, with the available height being offset
// 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
// 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) {
var url, license, license_graph;
var license_graph;
scope.$watch(attr.data, function(data) {
if(!data) return;
if(!data) {
return;
}
createGraph(data.hosts, data.license);
});
function onResize() {
if(!license_graph) return;
if(!license_graph) {
return;
}
adjustGraphSize(license_graph, element);
}
angular.element($window).on('resize', function(e) {
if(!license_graph) return;
angular.element($window).on('resize', function() {
if(!license_graph) {
return;
}
adjustGraphSize(license_graph, element);
});
@@ -34,13 +46,11 @@ angular.module('DashboardGraphs').
function createGraph(data, license) {
//url = getBasePath('dashboard')+'graphs/';
var graphData = [
{
"key" : "Hosts" ,
{ "key" : "Hosts" ,
"color" : "#1778c3",
"values": data.hosts
},
{
"key" : "License" ,
{ "key" : "License" ,
"color" : "#171717",
"values": data.hosts
}

View File

@@ -8,7 +8,7 @@ angular.module('DashboardGraphs')
};
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) {
if (data && data.hosts) {
@@ -43,20 +43,16 @@ angular.module('DashboardGraphs')
function createGraph(data) {
if(data.hosts.total+data.hosts.failed>0){
data = [
{
"label": "Successful",
{ "label": "Successful",
"color": "#00aa00",
"value" : data.hosts.total
} ,
{
"label": "Failed",
{ "label": "Failed",
"color" : "#aa0000",
"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()
.margin({top: 5, right: 75, bottom: 25, left: 85})
.x(function(d) { return d.label; })

View File

@@ -1,6 +1,6 @@
angular.module('DashboardGraphs')
.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 {
restrict: 'E',
templateUrl: '/static/partials/job_status_graph.html',
@@ -8,15 +8,11 @@ angular.module('DashboardGraphs')
};
function link(scope, element, attr) {
var html;
var url;
var job_status_chart = nv.models.lineChart();
var cleanup = angular.noop;
var job_type, job_status_chart = nv.models.lineChart();
scope.period="month";
scope.jobType="all";
var data;
scope.$watch(attr.data, function(value) {
if (value) {
createGraph(value, scope.period, scope.jobType);
@@ -29,13 +25,11 @@ angular.module('DashboardGraphs')
scope.jobType = jobtype;
var timeFormat, graphData = [
{
"color": "#00aa00",
{ "color": "#00aa00",
"key": "Successful",
"values": data.jobs.successful
},
{
"key" : "Failed" ,
{ "key" : "Failed" ,
"color" : "#aa0000",
"values": data.jobs.failed
}
@@ -66,9 +60,6 @@ angular.module('DashboardGraphs')
.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
.axisLabel("Time")//.showMaxMin(true)
.tickFormat(function(d) {

View File

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

View File

@@ -1,5 +1,5 @@
angular.module('DataServices')
.service('hostCountGraphData',
.service('hostCountGraphData',
["Rest",
"GetBasePath",
"ProcessErrors",
@@ -15,17 +15,17 @@ function HostCountGraphData(Rest, getBasePath, processErrors, $q) {
}
function getLicenseData() {
url = getBasePath('config');
var url = getBasePath('config');
Rest.setUrl(url);
return Rest.get()
.then(function (data){
license = data.data.license_info.instance_count;
var license = data.data.license_info.instance_count;
return license;
})
});
}
function getHostData() {
url = getBasePath('dashboard')+'graphs/inventory/';
var url = getBasePath('dashboard')+'graphs/inventory/';
Rest.setUrl(url);
return pluck('data', Rest.get());
}

View File

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