modify for grunt checking

This commit is contained in:
root 2016-07-11 18:38:51 +08:00
parent 0c5e6caa5e
commit 7ededc7fe2
22 changed files with 46 additions and 81 deletions

View File

@ -31,18 +31,18 @@
scope.close = function() { scope.close = function() {
scope.toggleAlert = false; scope.toggleAlert = false;
} };
scope.$on('raiseAlert', function(e, val) { scope.$on('raiseAlert', function(e, val) {
console.log('received raiseAlert:' + angular.toJson(val)); console.log('received raiseAlert:' + angular.toJson(val));
if(val.show) { if(val.show) {
scope.message = val.message; scope.message = val.message;
scope.toggleAlert = true; scope.toggleAlert = true;
}else{ }else{
scope.message = '' scope.message = '';
scope.toggleAlert = false; scope.toggleAlert = false;
} }
}); });
} }
} }
})(); })();

View File

@ -36,10 +36,10 @@
return {'h' : w.height()}; return {'h' : w.height()};
}; };
if(!angular.isDefined(scope.subsHeight)) scope.subsHeight = 110; if(!angular.isDefined(scope.subsHeight)) {scope.subsHeight = 110;}
if(!angular.isDefined(scope.subsSection)) scope.subsSection = 32; if(!angular.isDefined(scope.subsSection)) {scope.subsSection = 32;}
if(!angular.isDefined(scope.subsSubPane)) scope.subsSubPane = 226; if(!angular.isDefined(scope.subsSubPane)) {scope.subsSubPane = 226;}
if(!angular.isDefined(scope.subsTblBody)) scope.subsTblBody = 40; if(!angular.isDefined(scope.subsTblBody)) {scope.subsTblBody = 40;}
scope.$watch(scope.getDimension, function(current) { scope.$watch(scope.getDimension, function(current) {
if(current) { if(current) {
@ -59,4 +59,4 @@
} }
} }
})(); })();

View File

@ -51,12 +51,12 @@
if(current) { if(current) {
ctrl.contentType = current; ctrl.contentType = current;
} }
}) });
scope.$watch('confirmOnly', function(current) { scope.$watch('confirmOnly', function(current) {
if(current) { if(current) {
ctrl.confirmOnly = current; ctrl.confirmOnly = current;
} }
}) });
scope.$watch('vm.modalMessage', function(current) { scope.$watch('vm.modalMessage', function(current) {
if(current) { if(current) {
@ -87,4 +87,4 @@
} }
} }
})(); })();

View File

@ -71,7 +71,7 @@
vm.hasError = true; vm.hasError = true;
vm.errorMessage = 'failed_to_add_member'; vm.errorMessage = 'failed_to_add_member';
} }
if(status === 409 && pm.username != '') { if(status === 409 && pm.username !== '') {
vm.hasError = true; vm.hasError = true;
vm.errorMessage = 'username_already_exist'; vm.errorMessage = 'username_already_exist';
} }

View File

@ -38,11 +38,10 @@
for(var i = 0; i < r.length; i++) { for(var i = 0; i < r.length; i++) {
var role = r[i]; var role = r[i];
if(query.key === 'roleName' && role.roleName === query.value if(query.key === 'roleName' && role.roleName === query.value || query.key === 'roleId' && role.id === String(query.value)) {
|| query.key === 'roleId' && role.id === String(query.value)) {
return role; return role;
} }
} }
} }
} }
})(); })();

View File

@ -55,13 +55,13 @@
function addProjectFailed(data, status) { function addProjectFailed(data, status) {
vm.hasError = true; vm.hasError = true;
if(status === 400 && vm0.projectName!= '' && vm0.projectName.length < 4) { if(status === 400 && vm0.projectName !== '' && vm0.projectName.length < 4) {
vm.errorMessage = 'project_name_is_too_short'; vm.errorMessage = 'project_name_is_too_short';
} }
if(status === 400 && vm0.projectName.length > 30) { if(status === 400 && vm0.projectName.length > 30) {
vm.errorMessage = 'project_name_is_too_long'; vm.errorMessage = 'project_name_is_too_long';
} }
if(status === 409 && vm0.projectName != '') { if(status === 409 && vm0.projectName !== '') {
vm.errorMessage = 'project_already_exist'; vm.errorMessage = 'project_already_exist';
} }
console.log('Failed to add project:' + status); console.log('Failed to add project:' + status);

View File

@ -256,7 +256,7 @@
vm0.name = replicationPolicy.name; vm0.name = replicationPolicy.name;
vm0.description = replicationPolicy.description; vm0.description = replicationPolicy.description;
vm0.enabled = (replicationPolicy.enabled == 1); vm0.enabled = (replicationPolicy.enabled === 1);
angular.forEach(vm.destinations, function(item) { angular.forEach(vm.destinations, function(item) {
if(item.id === vm.targetId) { if(item.id === vm.targetId) {
@ -431,4 +431,4 @@
} }
} }
})(); })();

View File

@ -34,7 +34,7 @@
{'key': 'finished', 'value':$filter('tr')('finished')}, {'key': 'finished', 'value':$filter('tr')('finished')},
{'key': 'canceled', 'value': $filter('tr')('canceled')} {'key': 'canceled', 'value': $filter('tr')('canceled')}
]; ];
} };
} }
ListReplicationController.$inject = ['$scope', 'getParameterByName', '$location', 'ListReplicationPolicyService', 'ToggleReplicationPolicyService', 'ListReplicationJobService', '$window', '$filter', 'trFilter', 'jobStatus']; ListReplicationController.$inject = ['$scope', 'getParameterByName', '$location', 'ListReplicationPolicyService', 'ToggleReplicationPolicyService', 'ListReplicationJobService', '$window', '$filter', 'trFilter', 'jobStatus'];
@ -134,6 +134,7 @@
case 'operation': case 'operation':
case 'status': case 'status':
item[key] = $filter('tr')(value); item[key] = $filter('tr')(value);
break;
default: default:
break; break;
} }
@ -143,7 +144,7 @@
$scope.$emit('raiseAlert', alertInfo); $scope.$emit('raiseAlert', alertInfo);
vm.searchJobTIP = false; vm.searchJobTIP = false;
vm.refreshJobTIP = false; vm.refreshJobTIP = false;
}searchReplicationJob }
function listReplicationJobFailed(data, status) { function listReplicationJobFailed(data, status) {
console.log('Failed to list replication job:' + data); console.log('Failed to list replication job:' + data);
@ -186,7 +187,7 @@
'contentType': 'text/html', 'contentType': 'text/html',
'confirmOnly': false, 'confirmOnly': false,
'action': vm.togglePolicy 'action': vm.togglePolicy
} };
$scope.$emit('raiseInfo', emitInfo); $scope.$emit('raiseInfo', emitInfo);
} }
@ -319,4 +320,4 @@
} }
} }
})(); })();

View File

@ -64,7 +64,7 @@
function getTagFailed(data) { function getTagFailed(data) {
$scope.$emit('modalTitle', $filter('tr')('error')); $scope.$emit('modalTitle', $filter('tr')('error'));
$scope.$emit('modalMessage', $filter('tr')('failed_to_get_tag') + response); $scope.$emit('modalMessage', $filter('tr')('failed_to_get_tag') + data);
$scope.$emit('raiseError', true); $scope.$emit('raiseError', true);
console.log('Failed to get tag:' + data); console.log('Failed to get tag:' + data);
} }
@ -97,4 +97,4 @@
} }
})(); })();

View File

@ -77,7 +77,7 @@
'contentType': 'text/html', 'contentType': 'text/html',
'confirmOnly': false, 'confirmOnly': false,
'action': vm.togglePolicy 'action': vm.togglePolicy
} };
$scope.$emit('raiseInfo', emitInfo); $scope.$emit('raiseInfo', emitInfo);
} }
@ -127,4 +127,4 @@
} }
} }
})(); })();

View File

@ -30,7 +30,7 @@
.error(listIntegratedLogFailed); .error(listIntegratedLogFailed);
function listIntegratedLogSuccess(data) { function listIntegratedLogSuccess(data) {
vm.integratedLogs = data || [] vm.integratedLogs = data || [];
} }
function listIntegratedLogFailed(data, status) { function listIntegratedLogFailed(data, status) {
@ -54,4 +54,4 @@
return directive; return directive;
} }
})(); })();

View File

@ -25,7 +25,7 @@
function ToggleAdminController($scope, ToggleAdminService, $filter, trFilter) { function ToggleAdminController($scope, ToggleAdminService, $filter, trFilter) {
var vm = this; var vm = this;
vm.isAdmin = (vm.hasAdminRole == 1) ? true : false; vm.isAdmin = (vm.hasAdminRole === 1) ? true : false;
vm.enabled = vm.isAdmin ? 0 : 1; vm.enabled = vm.isAdmin ? 0 : 1;
vm.toggle = toggle; vm.toggle = toggle;
@ -77,4 +77,4 @@
} }
} }
})(); })();

View File

@ -20,7 +20,7 @@
.module('harbor.validator') .module('harbor.validator')
.directive('projectName', projectName); .directive('projectName', projectName);
projectName.$inject = ['PROJECT_REGEXP'] projectName.$inject = ['PROJECT_REGEXP'];
function projectName(PROJECT_REGEXP) { function projectName(PROJECT_REGEXP) {
var directive = { var directive = {
@ -38,4 +38,4 @@
} }
} }
})(); })();

View File

@ -106,7 +106,7 @@
function filter(input, pattern) { function filter(input, pattern) {
var d = new Date(input || ''); var d = new Date(input || '');
if(d.getTime() <= 0) return '-'; if(d.getTime() <= 0) {return '-';}
return moment(d).format(pattern); return moment(d).format(pattern);
} }
} }
@ -130,4 +130,4 @@
} }
} }
})(); })();

View File

@ -69,7 +69,7 @@
vm.action = function() { vm.action = function() {
val.action(); val.action();
$scope.$broadcast('showDialog', false); $scope.$broadcast('showDialog', false);
} };
vm.contentType = val.contentType; vm.contentType = val.contentType;
vm.confirmOnly = val.confirmOnly; vm.confirmOnly = val.confirmOnly;
@ -91,4 +91,4 @@
} }
} }
})(); })();

View File

@ -95,7 +95,7 @@
var message; var message;
$scope.$emit('modalTitle', $filter('tr')('error')); $scope.$emit('modalTitle', $filter('tr')('error'));
console.log('Failed to change password:' + data); console.log('Failed to change password:' + data);
if(data == 'old_password_is_not_correct') { if(data === 'old_password_is_not_correct') {
message = $filter('tr')('old_password_is_incorrect'); message = $filter('tr')('old_password_is_incorrect');
}else{ }else{
message = $filter('tr')('failed_to_change_password'); message = $filter('tr')('failed_to_change_password');

View File

@ -60,7 +60,7 @@
vm.action = function() { vm.action = function() {
val.action(); val.action();
$scope.$broadcast('showDialog', false); $scope.$broadcast('showDialog', false);
} };
vm.contentType = val.contentType; vm.contentType = val.contentType;
vm.confirmOnly = val.confirmOnly; vm.confirmOnly = val.confirmOnly;
@ -73,4 +73,4 @@
} }
} }
})(); })();

View File

@ -92,7 +92,7 @@
vm.action = function() { vm.action = function() {
val.action(); val.action();
$scope.$broadcast('showDialog', false); $scope.$broadcast('showDialog', false);
} };
vm.contentType = val.contentType; vm.contentType = val.contentType;
vm.confirmOnly = val.confirmOnly; vm.confirmOnly = val.confirmOnly;
@ -102,4 +102,4 @@
} }
})(); })();

View File

@ -35,4 +35,4 @@
} }
} }
})() })();

View File

@ -34,4 +34,4 @@
} }
} }
})() })();

View File

@ -35,8 +35,8 @@
'description': policy.description, 'description': policy.description,
'cron_str': policy.cronStr, 'cron_str': policy.cronStr,
'start_time': policy.startTime 'start_time': policy.startTime
}) });
} }
} }
})(); })();

View File

@ -1,35 +0,0 @@
/*
Copyright (c) 2016 VMware, Inc. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
(function() {
'use strict';
angular
.module('harbor.services.user')
.factory('IsAdminService', IsAdminService);
IsAdminService.$inject = ['$http', '$log'];
function IsAdminService($http, $log) {
return IsAdmin;
function IsAdmin() {
}
}
})