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/lemur/scripts/lib/
lemur/static/lemur/dist/
lemur/static/lemur/vendor/
lemur/static//dist/
lemur/static/app/vendor/

View File

@ -65,11 +65,11 @@ lemur.factory('LemurRestangular', function (Restangular, $location, $auth) {
RestangularConfigurer.setBaseUrl('http://localhost:5000/api/1');
RestangularConfigurer.setDefaultHttpFields({withCredentials: true});
RestangularConfigurer.addResponseInterceptor(function (data, operation, what, url, response, deferred) {
RestangularConfigurer.addResponseInterceptor(function (data, operation) {
var extractedData;
// .. to look for getList operations
if (operation === "getList") {
if (operation === 'getList') {
// .. and handle the data and meta data
extractedData = data.items;
extractedData.total = data.total;
@ -79,7 +79,7 @@ lemur.factory('LemurRestangular', function (Restangular, $location, $auth) {
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
if (!$auth.isAuthenticated()) {
$location.path('/login');
@ -97,7 +97,7 @@ lemur.factory('LemurRestangular', function (Restangular, $location, $auth) {
newParams.sortDir = params[item];
} else if (item.indexOf(f) > -1) {
var key = regExp.exec(item)[1];
newParams['filter'] = key + ";" + params[item];
newParams.filter = key + ';' + params[item];
} else {
newParams[item] = params[item];
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -7,9 +7,8 @@ angular.module('lemur')
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');
baseAccounts.getList()
@ -78,16 +77,16 @@ angular.module('lemur')
LemurRestangular.all('certificates').customGET('stats', {metric: 'issuer'})
.then(function (data) {
$scope.issuers = data['items'];
$scope.issuers = data.items;
});
LemurRestangular.all('certificates').customGET('stats', {metric: 'bits'})
.then(function (data) {
$scope.bits = data['items'];
$scope.bits = data.items;
});
LemurRestangular.all('certificates').customGET('stats', {metric: 'not_after'})
.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')
.service('DomainApi', function (LemurRestangular) {
return LemurRestangular.all('domains');

View File

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

View File

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

View File

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

View File

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

View File

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