auditing .every() and replacing with .forEach()

This commit is contained in:
jaredevantabor
2017-02-14 14:36:19 -05:00
parent a36ce01537
commit 576984922d
9 changed files with 16 additions and 40 deletions

View File

@@ -138,15 +138,13 @@ export default ['addPermissionsTeamsList', 'addPermissionsUsersList', 'TemplateL
// Set the item type label // Set the item type label
if (list.fields.scm_type && scope.options && if (list.fields.scm_type && scope.options &&
scope.options.hasOwnProperty('scm_type')) { scope.options.hasOwnProperty('scm_type')) {
scope.options.scm_type.choices.every(function(choice) { scope.options.scm_type.choices.forEach(function(choice) {
if (choice[0] === item.scm_type) { if (choice[0] === item.scm_type) {
itm.type_label = choice[1]; itm.type_label = choice[1];
return false;
} }
return true;
}); });
} }
}); });
} }

View File

@@ -56,12 +56,10 @@ export function CredentialsList($scope, $rootScope, $location, $log,
// Set the item type label // Set the item type label
if (list.fields.kind && $scope.options && if (list.fields.kind && $scope.options &&
$scope.options.hasOwnProperty('kind')) { $scope.options.hasOwnProperty('kind')) {
$scope.options.kind.choices.every(function(choice) { $scope.options.kind.choices.forEach(function(choice) {
if (choice[0] === item.kind) { if (choice[0] === item.kind) {
itm.kind_label = choice[1]; itm.kind_label = choice[1];
return false;
} }
return true;
}); });
} }
}); });

View File

@@ -58,12 +58,10 @@ export function ProjectsList($scope, $rootScope, $location, $log, $stateParams,
// Set the item type label // Set the item type label
if (list.fields.scm_type && $scope.options && if (list.fields.scm_type && $scope.options &&
$scope.options.hasOwnProperty('scm_type')) { $scope.options.hasOwnProperty('scm_type')) {
$scope.options.scm_type.choices.every(function(choice) { $scope.options.scm_type.choices.forEach(function(choice) {
if (choice[0] === item.scm_type) { if (choice[0] === item.scm_type) {
itm.type_label = choice[1]; itm.type_label = choice[1];
return false;
} }
return true;
}); });
} }
@@ -275,7 +273,7 @@ export function ProjectsList($scope, $rootScope, $location, $log, $stateParams,
} catch (e) { } catch (e) {
// ignore // ignore
} }
$scope.projects.every(function(project) { $scope.projects.forEach(function(project) {
if (project.id === project_id) { if (project.id === project_id) {
if (project.scm_type === "Manual" || Empty(project.scm_type)) { if (project.scm_type === "Manual" || Empty(project.scm_type)) {
// Do not respond. Button appears greyed out as if it is disabled. Not disabled though, because we need mouse over event // Do not respond. Button appears greyed out as if it is disabled. Not disabled though, because we need mouse over event
@@ -286,9 +284,7 @@ export function ProjectsList($scope, $rootScope, $location, $log, $stateParams,
} else { } else {
ProjectUpdate({ scope: $scope, project_id: project.id }); ProjectUpdate({ scope: $scope, project_id: project.id });
} }
return false;
} }
return true;
}); });
}; };

View File

@@ -88,21 +88,17 @@ export default
// Set the item type label // Set the item type label
if (list.fields.type) { if (list.fields.type) {
parent_scope.type_choices.every(function(choice) { parent_scope.type_choices.forEach(function(choice) {
if (choice.value === item.type) { if (choice.value === item.type) {
itm.type_label = choice.label; itm.type_label = choice.label;
return false;
} }
return true;
}); });
} }
// Set the job status label // Set the job status label
parent_scope.status_choices.every(function(status) { parent_scope.status_choices.forEach(function(status) {
if (status.value === item.status) { if (status.value === item.status) {
itm.status_label = status.label; itm.status_label = status.label;
return false;
} }
return true;
}); });
if (list.name === 'completed_jobs' || list.name === 'running_jobs') { if (list.name === 'completed_jobs' || list.name === 'running_jobs') {

View File

@@ -58,12 +58,10 @@
// Set the item type label // Set the item type label
if (list.fields.type && $scope.options && if (list.fields.type && $scope.options &&
$scope.options.hasOwnProperty('type')) { $scope.options.hasOwnProperty('type')) {
$scope.options.type.choices.every(function(choice) { $scope.options.type.choices.forEach(function(choice) {
if (choice[0] === item.type) { if (choice[0] === item.type) {
itm.type_label = choice[1]; itm.type_label = choice[1];
return false;
} }
return true;
}); });
} }
buildTooltips(itm); buildTooltips(itm);

View File

@@ -50,14 +50,12 @@
// Set the item type label // Set the item type label
if (list.fields.notification_type && $scope.options && if (list.fields.notification_type && $scope.options &&
$scope.options.hasOwnProperty('notification_type')) { $scope.options.hasOwnProperty('notification_type')) {
$scope.options.notification_type.choices.every(function(choice) { $scope.options.notification_type.choices.forEach(function(choice) {
if (choice[0] === item.notification_type) { if (choice[0] === item.notification_type) {
itm.type_label = choice[1]; itm.type_label = choice[1];
var recent_notifications = itm.summary_fields.recent_notifications; var recent_notifications = itm.summary_fields.recent_notifications;
itm.status = recent_notifications && recent_notifications.length > 0 ? recent_notifications[0].status : "none"; itm.status = recent_notifications && recent_notifications.length > 0 ? recent_notifications[0].status : "none";
return false;
} }
return true;
}); });
} }
setStatus(itm); setStatus(itm);

View File

@@ -60,12 +60,10 @@ export default ['$scope', '$rootScope', '$location', '$log',
// Set the item type label // Set the item type label
if (list.fields.type && $scope.options && $scope.options.hasOwnProperty('type')) { if (list.fields.type && $scope.options && $scope.options.hasOwnProperty('type')) {
$scope.options.type.choices.every(function(choice) { $scope.options.type.choices.forEach(function(choice) {
if (choice[0] === item.type) { if (choice[0] === item.type) {
itm.type_label = choice[1]; itm.type_label = choice[1];
return false;
} }
return true;
}); });
} }
}); });

View File

@@ -85,12 +85,10 @@ export default ['$scope', '$rootScope', '$location', '$log',
// Set the item type label // Set the item type label
if (list.fields.scm_type && $scope.options && if (list.fields.scm_type && $scope.options &&
$scope.options.hasOwnProperty('scm_type')) { $scope.options.hasOwnProperty('scm_type')) {
$scope.options.scm_type.choices.every(function(choice) { $scope.options.scm_type.choices.forEach(function(choice) {
if (choice[0] === item.scm_type) { if (choice[0] === item.scm_type) {
itm.type_label = choice[1]; itm.type_label = choice[1];
return false;
} }
return true;
}); });
} }
@@ -301,7 +299,7 @@ export default ['$scope', '$rootScope', '$location', '$log',
} catch (e) { } catch (e) {
// ignore // ignore
} }
$scope.projects.every(function(project) { $scope.projects.forEach(function(project) {
if (project.id === project_id) { if (project.id === project_id) {
if (project.scm_type === "Manual" || Empty(project.scm_type)) { if (project.scm_type === "Manual" || Empty(project.scm_type)) {
// Do not respond. Button appears greyed out as if it is disabled. Not disabled though, because we need mouse over event // Do not respond. Button appears greyed out as if it is disabled. Not disabled though, because we need mouse over event
@@ -312,9 +310,7 @@ export default ['$scope', '$rootScope', '$location', '$log',
} else { } else {
ProjectUpdate({ scope: $scope, project_id: project.id }); ProjectUpdate({ scope: $scope, project_id: project.id });
} }
return false;
} }
return true;
}); });
}; };

View File

@@ -59,12 +59,10 @@ export default ['$scope', '$rootScope', '$location', '$stateParams', 'Rest',
// Set the item type label // Set the item type label
if (list.fields.type && $scope.options.hasOwnProperty('type')) { if (list.fields.type && $scope.options.hasOwnProperty('type')) {
$scope.options.type.choices.every(function(choice) { $scope.options.type.choices.forEach(function(choice) {
if (choice[0] === item.type) { if (choice[0] === item.type) {
itm.type_label = choice[1]; itm.type_label = choice[1];
return false;
} }
return true;
}); });
} }
}); });