jshint fixes

This commit is contained in:
Joe Fiorini
2015-02-06 18:04:10 -05:00
parent 4134857794
commit 6dbfba7f69
10 changed files with 106 additions and 107 deletions

View File

@@ -17,11 +17,11 @@ if ($basePath) {
urlPrefix = $basePath; urlPrefix = $basePath;
} }
import * as Helpers from 'tower/helpers'; import 'tower/helpers';
import * as Forms from 'tower/forms'; import 'tower/forms';
import * as Lists from 'tower/lists'; import 'tower/lists';
import * as Widgets from 'tower/widgets'; import 'tower/widgets';
import * as Help from 'tower/help'; import 'tower/help';
import {Home, HomeGroups, HomeHosts} from 'tower/controllers/Home'; import {Home, HomeGroups, HomeHosts} from 'tower/controllers/Home';
import {SocketsController} from 'tower/controllers/Sockets'; import {SocketsController} from 'tower/controllers/Sockets';
import {Authenticate} from 'tower/controllers/Authentication'; import {Authenticate} from 'tower/controllers/Authentication';
@@ -56,7 +56,7 @@ var tower = angular.module('Tower', [
dashboardGraphs.name, dashboardGraphs.name,
'AuthService', 'AuthService',
'Utilities', 'Utilities',
Helpers.License.name, 'License',
'OrganizationFormDefinition', 'OrganizationFormDefinition',
'UserFormDefinition', 'UserFormDefinition',
'FormGenerator', 'FormGenerator',

View File

@@ -55,4 +55,4 @@ export
SurveyQuestion, SurveyQuestion,
Teams, Teams,
Users Users
} };

View File

@@ -8,4 +8,4 @@ export
FirefoxSocketHelp, FirefoxSocketHelp,
InventoryGroups, InventoryGroups,
SafariSocketHelp SafariSocketHelp
} };

View File

@@ -79,4 +79,4 @@ export
RelatedSearch, RelatedSearch,
Search, Search,
Teams Teams
} };

View File

@@ -7,10 +7,10 @@
* *
*/ */
/** /**
* @ngdoc function * @ngdoc function
* @name helpers.function:JobTemplatesHelper * @name helpers.function:JobTemplatesHelper
* @description Routines shared by job related controllers * @description Routines shared by job related controllers
*/ */
export default export default
angular.module('JobTemplatesHelper', ['Utilities']) angular.module('JobTemplatesHelper', ['Utilities'])

View File

@@ -58,4 +58,4 @@ export
Streams, Streams,
Teams, Teams,
Users Users
} };

View File

@@ -86,4 +86,4 @@ export default function() {
chartModel.update(); chartModel.update();
}; };
}; }

View File

@@ -1,48 +1,47 @@
HostCountGraphData.$inject = export default
[ "Rest", [ "Rest",
"GetBasePath", "GetBasePath",
"ProcessErrors", "ProcessErrors",
"$q" "$q",
] HostCountGraphData
];
export default function HostCountGraphData(Rest, getBasePath, processErrors, $q) {
function HostCountGraphData(Rest, getBasePath, processErrors, $q) {
function pluck(property, promise) { function pluck(property, promise) {
return promise.then(function(value) { return promise.then(function(value) {
return value[property]; return value[property];
}); });
}
function getLicenseData() {
var url = getBasePath('config');
Rest.setUrl(url);
return Rest.get()
.then(function (data){
var license = data.data.license_info.instance_count;
return license;
});
}
function getHostData() {
var url = getBasePath('dashboard')+'graphs/inventory/';
Rest.setUrl(url);
return pluck('data', Rest.get());
}
return {
get: function() {
return $q.all({
license: getLicenseData(),
hosts: getHostData()
}).catch(function (response) {
var errorMessage = 'Failed to get: ' + response.url + ' GET returned: ' + response.status;
processErrors(null, response.data, response.status, null, { hdr: 'Error!',
msg: errorMessage
});
return response;
return $q.reject(response);
});
}
};
} }
function getLicenseData() {
var url = getBasePath('config');
Rest.setUrl(url);
return Rest.get()
.then(function (data){
var license = data.data.license_info.instance_count;
return license;
});
}
function getHostData() {
var url = getBasePath('dashboard')+'graphs/inventory/';
Rest.setUrl(url);
return pluck('data', Rest.get());
}
return {
get: function() {
return $q.all({
license: getLicenseData(),
hosts: getHostData()
}).catch(function (response) {
var errorMessage = 'Failed to get: ' + response.url + ' GET returned: ' + response.status;
processErrors(null, response.data, response.status, null, { hdr: 'Error!',
msg: errorMessage
});
return $q.reject(response);
});
}
};
}

View File

@@ -6,54 +6,54 @@ export default
"$q", "$q",
JobStatusGraphData]; JobStatusGraphData];
function JobStatusGraphData(Rest, getBasePath, processErrors, $rootScope, $q) { function JobStatusGraphData(Rest, getBasePath, processErrors, $rootScope, $q) {
function pluck(property, promise) { function pluck(property, promise) {
return promise.then(function(value) { return promise.then(function(value) {
return value[property]; return value[property];
}); });
}
function getData(period, jobType) {
var url = getBasePath('dashboard')+'graphs/jobs/?period='+period+'&job_type='+jobType;
Rest.setUrl(url);
var result = Rest.get()
.catch(function(response) {
var errorMessage = 'Failed to get: ' + response.url + ' GET returned: ' + response.status;
processErrors(null,
response.data,
response.status,
null, {
hdr: 'Error!',
msg: errorMessage
});
return $q.reject(response);
});
return pluck('data', result);
}
return {
destroyWatcher: angular.noop,
setupWatcher: function(period, jobType) {
this.destroyWatcher =
$rootScope.$on('JobStatusChange', function() {
getData(period, jobType).then(function(result) {
$rootScope.
$broadcast('DataReceived:JobStatusGraph',
result);
return result;
});
});
},
get: function(period, jobType) {
this.destroyWatcher();
this.setupWatcher(period, jobType);
return getData(period, jobType);
}
};
} }
function getData(period, jobType) {
var url = getBasePath('dashboard')+'graphs/jobs/?period='+period+'&job_type='+jobType;
Rest.setUrl(url);
var result = Rest.get()
.catch(function(response) {
var errorMessage = 'Failed to get: ' + response.url + ' GET returned: ' + response.status;
processErrors(null,
response.data,
response.status,
null, {
hdr: 'Error!',
msg: errorMessage
});
return $q.reject(response);
});
return pluck('data', result);
}
return {
destroyWatcher: angular.noop,
setupWatcher: function(period, jobType) {
this.destroyWatcher =
$rootScope.$on('JobStatusChange', function() {
getData(period, jobType).then(function(result) {
$rootScope.
$broadcast('DataReceived:JobStatusGraph',
result);
return result;
});
});
},
get: function(period, jobType) {
this.destroyWatcher();
this.setupWatcher(period, jobType);
return getData(period, jobType);
}
};
}

View File

@@ -22,4 +22,4 @@ export
PortalJobs, PortalJobs,
SCMSyncStatus, SCMSyncStatus,
Stream Stream
} };