Merge pull request #260 from xiahaoshawn/new-version-of-ui

fix JavaScript code error detect by JSHint
This commit is contained in:
kun wang 2016-05-24 10:51:24 +08:00
commit a48e3298f7
24 changed files with 55 additions and 42 deletions

View File

@ -58,7 +58,7 @@
if($routeParams.project_id){
angular.forEach(vm.projects, function(value, index) {
if(value['ProjectId'] == $routeParams.project_id) {
if(value['ProjectId'] === $routeParams.project_id) {
vm.selectedProject = value;
}
});
@ -117,7 +117,7 @@
controller: RetrieveProjectsController,
bindToController: true,
controllerAs: 'vm'
}
};
return directive;

View File

@ -42,7 +42,7 @@
controller: SwitchPaneProjectsController,
controllerAs: 'vm',
bindToController: true
}
};
return directive;

View File

@ -24,7 +24,7 @@
vm.op = [];
vm.op.push('all');
function checkOperation(e) {
if(e.checked == 'all') {
if(e.checked === 'all') {
vm.opCreate = vm.opAll;
vm.opPull = vm.opAll;
vm.opPush = vm.opAll;
@ -48,7 +48,7 @@
if(vm.opDelete) {
vm.op.push('delete');
}
if(vm.opOthers && vm.others != "") {
if(vm.opOthers && vm.others !== "") {
vm.op.push(vm.others);
}
}

View File

@ -33,7 +33,7 @@
retrieve(vm.queryParams);
function search(e) {
if(e.op[0] == 'all') {
if(e.op[0] === 'all') {
vm.queryParams.keywords = '';
}else {
vm.queryParams.keywords = e.op.join('/') ;
@ -68,7 +68,7 @@
}
function toUTCSeconds(date, hour, min, sec) {
if(date == "") {
if(date === "") {
return 0;
}
@ -96,7 +96,7 @@
controller: ListLogController,
controllerAs: 'vm',
bindToController: true
}
};
return directive;
}

View File

@ -55,7 +55,7 @@
vm.hasError = true;
vm.errorMessage = 'username_already_exist';
}
if(status == 404) {
if(status === 404) {
vm.hasError = true;
vm.errorMessage = 'username_does_not_exist';
}
@ -76,7 +76,8 @@
'controller': AddProjectMemberController,
'controllerAs': 'vm',
'bindToController': true
}
};
return directive;
}

View File

@ -60,7 +60,8 @@
controller: ListProjectMemberController,
controllerAs: 'vm',
bindToController: true
}
};
return directive;
}

View File

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

View File

@ -44,7 +44,7 @@
vm.hasError = true;
vm.errorMessage = 'project_already_exist';
}
if(status == 500) {
if(status === 500) {
vm.hasError = true;
vm.errorMessage = 'project_name_is_invalid';
}

View File

@ -12,7 +12,7 @@
var vm = this;
vm.toggle = toggle;
if(vm.isPublic == 1) {
if(vm.isPublic === 1) {
vm.isPublic = true;
}else{
vm.isPublic = false;

View File

@ -98,7 +98,7 @@
controller: ListRepositoryController,
controllerAs: 'vm',
bindToController: true
}
};
return directive;

View File

@ -40,7 +40,7 @@
$scope.$emit('modalTitle', $filter('tr')('alert_delete_tag_title', [e.tag]));
var message;
if(vm.tags.length == 1) {
if(vm.tags.length === 1) {
message = $filter('tr')('alert_delete_last_tag', [e.tag]);
}else {
message = $filter('tr')('alert_delete_tag', [e.tag]);

View File

@ -66,15 +66,15 @@
'<div class="form-group"><label class="col-sm-3 control-label">Created</label>' +
'<div class="col-sm-9"><p class="form-control-static">' + ctrl.manifest['Created'] + '</p></div></div>' +
'<div class="form-group"><label class="col-sm-3 control-label">Duration Days</label>' +
'<div class="col-sm-9"><p class="form-control-static">' + (ctrl.manifest['Duration Days'] == '' ? 'N/A' : ctrl.manifest['Duration Days']) + ' days</p></div></div>' +
'<div class="col-sm-9"><p class="form-control-static">' + (ctrl.manifest['Duration Days'] === '' ? 'N/A' : ctrl.manifest['Duration Days']) + ' days</p></div></div>' +
'<div class="form-group"><label class="col-sm-3 control-label">Author</label>' +
'<div class="col-sm-9"><p class="form-control-static">' + (ctrl.manifest['Author'] == '' ? 'N/A' : ctrl.manifest['Author']) + '</p></div></div>' +
'<div class="col-sm-9"><p class="form-control-static">' + (ctrl.manifest['Author'] === '' ? 'N/A' : ctrl.manifest['Author']) + '</p></div></div>' +
'<div class="form-group"><label class="col-sm-3 control-label">Architecture</label>' +
'<div class="col-sm-9"><p class="form-control-static">' + (ctrl.manifest['Architecture'] == '' ? 'N/A' : ctrl.manifest['Architecture']) + '</p></div></div>' +
'<div class="col-sm-9"><p class="form-control-static">' + (ctrl.manifest['Architecture'] === '' ? 'N/A' : ctrl.manifest['Architecture']) + '</p></div></div>' +
'<div class="form-group"><label class="col-sm-3 control-label">Docker Version</label>' +
'<div class="col-sm-9"><p class="form-control-static">' + (ctrl.manifest['Docker Version'] == '' ? 'N/A' : ctrl.manifest['Docker Version']) + '</p></div></div>' +
'<div class="col-sm-9"><p class="form-control-static">' + (ctrl.manifest['Docker Version'] === '' ? 'N/A' : ctrl.manifest['Docker Version']) + '</p></div></div>' +
'<div class="form-group"><label class="col-sm-3 control-label">OS</label>' +
'<div class="col-sm-9"><p class="form-control-static">' + (ctrl.manifest['OS'] == '' ? 'N/A' : ctrl.manifest['OS']) + '</p></div></div>' +
'<div class="col-sm-9"><p class="form-control-static">' + (ctrl.manifest['OS'] === '' ? 'N/A' : ctrl.manifest['OS']) + '</p></div></div>' +
'</form>';
return content;
}

View File

@ -60,7 +60,8 @@
'controller': SignInController,
'controllerAs': 'vm',
'bindToController': true
}
};
return directive;
}

View File

@ -11,7 +11,7 @@
function ToggleAdminController($scope, ToggleAdminService) {
var vm = this;
vm.isAdmin = (vm.hasAdminRole == 1) ? true : false;
vm.isAdmin = (vm.hasAdminRole === 1) ? true : false;
vm.toggle = toggle;
function toggle() {

View File

@ -21,7 +21,7 @@
ctrl.$validators.compareTo = validator;
function validator(modelValue) {
return modelValue == scope.otherModelValue;
return modelValue === scope.otherModelValue;
}
scope.$watch("otherModelValue", function(current, origin) {

View File

@ -19,8 +19,14 @@
name = name.replace(/[\[\]]/g, "\\$&");
var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
results = regex.exec(url);
if (!results) return null;
if (!results[2]) return '';
if (!results) {
return null;
}
if (!results[2]) {
return '';
}
return decodeURIComponent(results[2].replace(/\+/g, " "));
}
}

View File

@ -20,7 +20,7 @@
unset: function() {
$cookies.remove('user', {'path': '/'});
}
}
};
}
currentProjectMember.$inject = ['$cookies'];
@ -36,7 +36,7 @@
unset: function() {
$cookies.remove('member', {'path': '/'});
}
}
};
}
})();

View File

@ -35,10 +35,10 @@
input = input || [];
var filteredResults = [];
if (filterInput != '') {
if (filterInput !== '') {
for(var i = 0; i < input.length; i++) {
var item = input[i];
if((key == "" && item.indexOf(filterInput) >= 0) || (key != "" && item[key].indexOf(filterInput) >= 0)) {
if((key === "" && item.indexOf(filterInput) >= 0) || (key !== "" && item[key].indexOf(filterInput) >= 0)) {
filteredResults.push(item);
continue;
}

View File

@ -32,7 +32,7 @@
controller: NavigationDetailsController,
controllerAs: 'vm',
bindToController: true
}
};
return directive;

View File

@ -22,13 +22,13 @@
controller: NavigationHeaderController,
controllerAs: 'vm',
bindToController: true
}
};
return directive;
function link(scope, element, attrs, ctrl) {
var visited = ctrl.url;
if (visited != "/ng") {
if (visited !== "/ng") {
element.find('a[href*="' + visited + '"]').addClass('active');
}
element.find('a').on('click', click);

View File

@ -59,7 +59,7 @@
}
function showAddButton() {
if(vm.publicity == 0) {
if(vm.publicity === 0) {
return true;
}else{
return false;

View File

@ -18,15 +18,16 @@
};
var isSupportLanguage = function(language) {
for (var i in supportLanguages) {
if(language == i) {
if(language === i) {
return true;
}
}
return false;
}
};
return tr;
function tr() {
return {
'setCurrentLanguage': function(language) {
if(!angular.isDefined(language) || !isSupportLanguage(language)) {
@ -52,7 +53,8 @@
'getValue': function(key) {
return messages[key];
}
}
};
}
}

View File

@ -17,8 +17,9 @@
headers: {'Content-Type': 'application/x-www-form-urlencoded'},
transformRequest: function(obj) {
var str = [];
for(var p in obj)
str.push(encodeURIComponent(p) + "=" + encodeURIComponent(obj[p]));
for(var p in obj) {
str.push(encodeURIComponent(p) + "=" + encodeURIComponent(obj[p]));
}
return str.join("&");
},
data: {'reset_uuid': uuid, 'password': password}

View File

@ -19,8 +19,9 @@
headers: {'Content-Type': 'application/x-www-form-urlencoded'},
transformRequest: function(obj) {
var str = [];
for(var p in obj)
str.push(encodeURIComponent(p) + "=" + encodeURIComponent(obj[p]));
for(var p in obj) {
str.push(encodeURIComponent(p) + "=" + encodeURIComponent(obj[p]));
}
return str.join("&");
},
data: {'principal': principal, 'password': password}