Pleasing the JSHint gods

This commit is contained in:
kevgliss 2015-07-21 13:36:03 -07:00
parent c75e20a1ea
commit a826bd16f7
14 changed files with 37 additions and 28 deletions

View File

@ -1,4 +1,2 @@
tests/ lemur/static//dist/
lemur/static/lemur/scripts/lib/ lemur/static/app/vendor/
lemur/static/lemur/dist/
lemur/static/lemur/vendor/

View File

@ -65,11 +65,11 @@ lemur.factory('LemurRestangular', function (Restangular, $location, $auth) {
RestangularConfigurer.setBaseUrl('http://localhost:5000/api/1'); RestangularConfigurer.setBaseUrl('http://localhost:5000/api/1');
RestangularConfigurer.setDefaultHttpFields({withCredentials: true}); RestangularConfigurer.setDefaultHttpFields({withCredentials: true});
RestangularConfigurer.addResponseInterceptor(function (data, operation, what, url, response, deferred) { RestangularConfigurer.addResponseInterceptor(function (data, operation) {
var extractedData; var extractedData;
// .. to look for getList operations // .. to look for getList operations
if (operation === "getList") { if (operation === 'getList') {
// .. and handle the data and meta data // .. and handle the data and meta data
extractedData = data.items; extractedData = data.items;
extractedData.total = data.total; extractedData.total = data.total;
@ -79,7 +79,7 @@ lemur.factory('LemurRestangular', function (Restangular, $location, $auth) {
return extractedData; return extractedData;
}); });
RestangularConfigurer.addFullRequestInterceptor(function (element, operation, route, url, headers, params, httpConfig) { RestangularConfigurer.addFullRequestInterceptor(function (element, operation, route, url, headers, params) {
// We want to make sure the user is auth'd before any requests // We want to make sure the user is auth'd before any requests
if (!$auth.isAuthenticated()) { if (!$auth.isAuthenticated()) {
$location.path('/login'); $location.path('/login');
@ -97,7 +97,7 @@ lemur.factory('LemurRestangular', function (Restangular, $location, $auth) {
newParams.sortDir = params[item]; newParams.sortDir = params[item];
} else if (item.indexOf(f) > -1) { } else if (item.indexOf(f) > -1) {
var key = regExp.exec(item)[1]; var key = regExp.exec(item)[1];
newParams['filter'] = key + ";" + params[item]; newParams.filter = key + ';' + params[item];
} else { } else {
newParams[item] = params[item]; newParams[item] = params[item];
} }

View File

@ -28,7 +28,7 @@ angular.module('lemur')
AuthenticationService.authenticate = function (provider) { AuthenticationService.authenticate = function (provider) {
$auth.authenticate(provider) $auth.authenticate(provider)
.then( .then(
function (user) { function () {
UserService.getCurrentUser(); UserService.getCurrentUser();
$rootScope.$emit('user:login'); $rootScope.$emit('user:login');
$location.url('/certificates'); $location.url('/certificates');
@ -56,7 +56,7 @@ angular.module('lemur')
body: 'You have been successfully logged out.' body: 'You have been successfully logged out.'
}); });
$location.path('/'); $location.path('/');
}) });
}; };
}); });

View File

@ -19,10 +19,10 @@ angular.module('lemur')
$scope.loading = false; $scope.loading = false;
$scope.create = function (authority) { $scope.create = function (authority) {
WizardHandler.wizard().context.loading = true; WizardHandler.wizard().context.loading = true;
AuthorityService.create(authority).then(function (resposne) { AuthorityService.create(authority).then(function () {
WizardHandler.wizard().context.loading = false; WizardHandler.wizard().context.loading = false;
$modalInstance.close(); $modalInstance.close();
}) });
}; };
PluginService.get('issuer').then(function (plugins) { PluginService.get('issuer').then(function (plugins) {

View File

@ -16,7 +16,7 @@ angular.module('lemur')
$scope.create = function (certificate) { $scope.create = function (certificate) {
WizardHandler.wizard().context.loading = true; WizardHandler.wizard().context.loading = true;
CertificateService.create(certificate).then(function (response) { CertificateService.create(certificate).then(function () {
WizardHandler.wizard().context.loading = false; WizardHandler.wizard().context.loading = false;
$modalInstance.close(); $modalInstance.close();
}); });

View File

@ -1,6 +1,5 @@
/** 'use strict';
* Created by kglisson on 1/19/15.
*/
angular.module('lemur') angular.module('lemur')
.service('CertificateApi', function (LemurRestangular, DomainService) { .service('CertificateApi', function (LemurRestangular, DomainService) {
LemurRestangular.extendModel('certificates', function (obj) { LemurRestangular.extendModel('certificates', function (obj) {
@ -102,7 +101,7 @@ angular.module('lemur')
CertificateService.create = function (certificate) { CertificateService.create = function (certificate) {
certificate.attachSubAltName(); certificate.attachSubAltName();
return CertificateApi.post(certificate).then( return CertificateApi.post(certificate).then(
function (response) { function () {
toaster.pop({ toaster.pop({
type: 'success', type: 'success',
title: certificate.name, title: certificate.name,
@ -132,8 +131,8 @@ angular.module('lemur')
}; };
CertificateService.upload = function (certificate) { CertificateService.upload = function (certificate) {
CertificateApi.customPOST(certificate, "upload").then( CertificateApi.customPOST(certificate, 'upload').then(
function (response) { function () {
toaster.pop({ toaster.pop({
type: 'success', type: 'success',
title: certificate.name, title: certificate.name,
@ -163,7 +162,7 @@ angular.module('lemur')
certificate.privateKey = response.key; certificate.privateKey = response.key;
} }
}, },
function (response) { function () {
toaster.pop({ toaster.pop({
type: 'error', type: 'error',
title: certificate.name, title: certificate.name,

View File

@ -1,3 +1,5 @@
'use strict';
angular.module('lemur'). angular.module('lemur').
filter('titleCase', function () { filter('titleCase', function () {
return function (str) { return function (str) {

View File

@ -7,9 +7,8 @@ angular.module('lemur')
controller: 'DashboardController' controller: 'DashboardController'
}); });
}) })
.controller('DashboardController', function ($scope, $rootScope, $filter, $location, LemurRestangular, ngTableParams) { .controller('DashboardController', function ($scope, $rootScope, $filter, $location, LemurRestangular) {
var baseStats = LemurRestangular.all('stats');
var baseAccounts = LemurRestangular.all('accounts'); var baseAccounts = LemurRestangular.all('accounts');
baseAccounts.getList() baseAccounts.getList()
@ -78,16 +77,16 @@ angular.module('lemur')
LemurRestangular.all('certificates').customGET('stats', {metric: 'issuer'}) LemurRestangular.all('certificates').customGET('stats', {metric: 'issuer'})
.then(function (data) { .then(function (data) {
$scope.issuers = data['items']; $scope.issuers = data.items;
}); });
LemurRestangular.all('certificates').customGET('stats', {metric: 'bits'}) LemurRestangular.all('certificates').customGET('stats', {metric: 'bits'})
.then(function (data) { .then(function (data) {
$scope.bits = data['items']; $scope.bits = data.items;
}); });
LemurRestangular.all('certificates').customGET('stats', {metric: 'not_after'}) LemurRestangular.all('certificates').customGET('stats', {metric: 'not_after'})
.then(function (data) { .then(function (data) {
$scope.expiring = {labels: data['items']['labels'], values: [data['items']['values']]}; $scope.expiring = {labels: data.items.labels, values: [data.items.values]};
}); });
}); });

View File

@ -1,3 +1,5 @@
'use strict';
angular.module('lemur') angular.module('lemur')
.service('DomainApi', function (LemurRestangular) { .service('DomainApi', function (LemurRestangular) {
return LemurRestangular.all('domains'); return LemurRestangular.all('domains');

View File

@ -1,5 +1,7 @@
'use strict';
angular.module('lemur') angular.module('lemur')
.service('ELBApi', function (LemurRestangular, ListenerService) { .service('ELBApi', function (LemurRestangular) {
LemurRestangular.extendModel('elbs', function (obj) { LemurRestangular.extendModel('elbs', function (obj) {
return angular.extend(obj, { return angular.extend(obj, {
attachListener: function (listener) { attachListener: function (listener) {

View File

@ -1,3 +1,5 @@
'use strict';
angular.module('lemur') angular.module('lemur')
.service('ListenerApi', function (LemurRestangular) { .service('ListenerApi', function (LemurRestangular) {
return LemurRestangular.all('listeners'); return LemurRestangular.all('listeners');

View File

@ -1,3 +1,5 @@
'use strict';
angular.module('lemur') angular.module('lemur')
.service('PluginApi', function (LemurRestangular) { .service('PluginApi', function (LemurRestangular) {
return LemurRestangular.all('plugins'); return LemurRestangular.all('plugins');

View File

@ -1,3 +1,5 @@
'use strict';
angular.module('lemur') angular.module('lemur')
.service('RoleApi', function (LemurRestangular) { .service('RoleApi', function (LemurRestangular) {
LemurRestangular.extendModel('roles', function (obj) { LemurRestangular.extendModel('roles', function (obj) {
@ -108,7 +110,7 @@ angular.module('lemur')
role.username = response.username; role.username = response.username;
} }
}, },
function (response) { function () {
toaster.pop({ toaster.pop({
type: 'error', type: 'error',
title: role.name, title: role.name,

View File

@ -62,10 +62,11 @@
"pretest": "npm install && npm run build_static", "pretest": "npm install && npm run build_static",
"build_static": "gulp build", "build_static": "gulp build",
"prelint": "npm install", "prelint": "npm install",
"lint": "jshint app/", "lint": "jshint lemur/static/app/",
"test": "gulp test" "test": "gulp test"
}, },
"devDependencies": { "devDependencies": {
"jshint": "^2.8.0",
"karma-chrome-launcher": "^0.2.0" "karma-chrome-launcher": "^0.2.0"
} }
} }