1
0
mirror of https://github.com/ansible/awx.git synced 2024-10-31 06:51:10 +03:00

Merge pull request #2875 from mabashian/2868-lodash

Upgrades lodash to ~4.17.10
This commit is contained in:
Michael Abashian 2018-08-24 13:27:07 -04:00 committed by GitHub
commit d824508cfb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 64 additions and 56 deletions

View File

@ -349,7 +349,7 @@ angular
$rootScope.$broadcast("RemoveIndicator");
}
if(_.contains(trans.from().name, 'output') && trans.to().name === 'jobs'){
if(_.includes(trans.from().name, 'output') && trans.to().name === 'jobs'){
$state.reload();
}
});
@ -375,7 +375,7 @@ angular
$rootScope.user_is_system_auditor = Authorization.getUserInfo('is_system_auditor');
// state the user refreshes we want to open the socket, except if the user is on the login page, which should happen after the user logs in (see the AuthService module for that call to OpenSocket)
if (!_.contains($location.$$url, '/login')) {
if (!_.includes($location.$$url, '/login')) {
ConfigService.getConfig().then(function() {
Timer.init().then(function(timer) {
$rootScope.sessionTimer = timer;

View File

@ -90,7 +90,7 @@ export default
if(streamConfig && streamConfig.activityStream) {
if(streamConfig.activityStreamTarget) {
stateGoParams.target = streamConfig.activityStreamTarget;
let isTemplateTarget = _.contains(['template', 'job_template', 'workflow_job_template'], streamConfig.activityStreamTarget);
let isTemplateTarget = _.includes(['template', 'job_template', 'workflow_job_template'], streamConfig.activityStreamTarget);
stateGoParams.activity_search = {
or__object1__in: isTemplateTarget ? 'job_template,workflow_job_template' : streamConfig.activityStreamTarget,
or__object2__in: isTemplateTarget ? 'job_template,workflow_job_template' : streamConfig.activityStreamTarget,

View File

@ -25,7 +25,7 @@ export default
if(expandedBreadcrumbWidth > availableWidth) {
let widthToTrim = expandedBreadcrumbWidth - availableWidth;
// Sort the crumbs from biggest to smallest
let sortedCrumbs = _.sortByOrder(crumbs, ["origWidth"], ["desc"]);
let sortedCrumbs = _.orderBy(crumbs, ["origWidth"], ["desc"]);
let maxWidth;
for(let i=0; i<sortedCrumbs.length; i++) {
if(sortedCrumbs[i+1]) {

View File

@ -252,7 +252,7 @@ export default [
},
];
var forms = _.pluck(authForms, 'formDef');
var forms = _.map(authForms, 'formDef');
_.each(forms, function(form) {
var keys = _.keys(form.fields);
_.each(keys, function(key) {

View File

@ -119,7 +119,7 @@ export default [
}));
$('.select2-selection__choice').each(function(i, element){
if(!_.contains($scope.$parent.configDataResolve.AD_HOC_COMMANDS.default, element.title)){
if(!_.includes($scope.$parent.configDataResolve.AD_HOC_COMMANDS.default, element.title)){
$(`#configuration_jobs_template_AD_HOC_COMMANDS option[value='${element.title}']`).remove();
element.remove();
}

View File

@ -106,7 +106,7 @@ export default [
id: 'system-misc-form'
}];
var forms = _.pluck(systemForms, 'formDef');
var forms = _.map(systemForms, 'formDef');
_.each(forms, function(form) {
var keys = _.keys(form.fields);
_.each(keys, function(key) {

View File

@ -17,8 +17,8 @@ function CapacityAdjuster (templateUrl, ProcessErrors, Wait, strings) {
value: scope.state.mem_capacity
}];
scope.min_capacity = _.min(adjustment_values, 'value');
scope.max_capacity = _.max(adjustment_values, 'value');
scope.min_capacity = _.minBy(adjustment_values, 'value');
scope.max_capacity = _.maxBy(adjustment_values, 'value');
capacityAdjusterController.init();
},
@ -72,4 +72,4 @@ CapacityAdjuster.$inject = [
'InstanceGroupsStrings'
];
export default CapacityAdjuster;
export default CapacityAdjuster;

View File

@ -205,7 +205,7 @@ export default ['Rest', 'Wait', 'NotificationsFormObject',
return $scope[i];
}
params.notification_configuration = _.object(Object.keys(form.fields)
params.notification_configuration = _.fromPairs(Object.keys(form.fields)
.filter(i => (form.fields[i].ngShow && form.fields[i].ngShow.indexOf(v) > -1))
.map(i => [i, processValue($scope[i], i, form.fields[i])]));

View File

@ -36,10 +36,10 @@ export default ['$scope',
$scope.selection.selectedItems =
_items.filter(function(item) {
return item.isSelected;
}).pluck('value').value();
}).map('value').value();
$scope.selection.deselectedItems =
_items.pluck('value').difference($scope.selection.selectedItems)
_items.map('value').difference($scope.selection.selectedItems)
.value();
/**

View File

@ -310,12 +310,12 @@ function QuerysetService ($q, Rest, ProcessErrors, $rootScope, Wait, DjangoSearc
return [];
}
if(defaultParams) {
let stripped =_.pick(params, (value, key) => {
let stripped =_.pickBy(params, (value, key) => {
// setting the default value of a term to null in a state definition is a very explicit way to ensure it will NEVER generate a search tag, even with a non-default value
return defaultParams[key] !== value && key !== 'order_by' && key !== 'page' && key !== 'page_size' && defaultParams[key] !== null;
});
let strippedCopy = _.cloneDeep(stripped);
if(_.keys(_.pick(defaultParams, _.keys(strippedCopy))).length > 0){
if(_.keys(_.pickBy(defaultParams, _.keys(strippedCopy))).length > 0){
for (var key in strippedCopy) {
if (strippedCopy.hasOwnProperty(key)) {
let value = strippedCopy[key];
@ -418,7 +418,7 @@ function QuerysetService ($q, Rest, ProcessErrors, $rootScope, Wait, DjangoSearc
termParams = searchWithoutKey(term, singleSearchParam);
}
params = _.merge(params, termParams, combineSameSearches);
params = _.mergeWith(params, termParams, combineSameSearches);
});
return params;

View File

@ -102,7 +102,7 @@ function SmartSearchController (
const listName = $scope.list.name;
const baseRelatedTypePath = `models.${listName}.base.${rootField}.type`;
const isRelatedSearchTermField = (_.contains($scope.models[listName].related, rootField));
const isRelatedSearchTermField = (_.includes($scope.models[listName].related, rootField));
const isBaseModelRelatedSearchTermField = (_.get($scope, baseRelatedTypePath) === 'field');
return (isRelatedSearchTermField || isBaseModelRelatedSearchTermField);
@ -254,7 +254,7 @@ function SmartSearchController (
defaults[key] = queryset[key];
}
});
const cleared = _(defaults).omit(_.isNull).value();
const cleared = _(defaults).omitBy(_.isNull).value();
delete cleared.page;
queryset = cleared;

View File

@ -21,7 +21,9 @@ export default ['$scope', '$rootScope', '$stateParams', 'TeamForm', 'Rest',
$scope.canEdit = me.get('summary_fields.user_capabilities.edit');
$scope.isOrgAdmin = me.get('related.admin_of_organizations.count') > 0;
$scope.team_id = id;
setScopeFields(data);
_.forEach(form.fields, (value, key) => {
$scope[key] = data[key];
});
$scope.organization_name = data.summary_fields.organization.name;
OrgAdminLookup.checkForAdminAccess({organization: data.organization})
@ -36,19 +38,6 @@ export default ['$scope', '$rootScope', '$stateParams', 'TeamForm', 'Rest',
});
}
// @issue I think all this really want to do is _.forEach(form.fields, (field) =>{ $scope[field] = data[field]})
function setScopeFields(data) {
_(data)
.pick(function(value, key) {
return form.fields.hasOwnProperty(key) === true;
})
.forEach(function(value, key) {
$scope[key] = value;
})
.value();
return;
}
// prepares a data payload for a PUT request to the API
function processNewData(fields) {
var data = {};

View File

@ -17,7 +17,7 @@ export default ['$scope', '$rootScope', '$stateParams', 'UserForm', 'Rest',
'$state', 'i18n', 'resolvedModels', 'resourceData',
function($scope, $rootScope, $stateParams, UserForm, Rest, ProcessErrors,
GetBasePath, Wait, CreateSelect2, $state, i18n, models, resourceData) {
for (var i = 0; i < user_type_options.length; i++) {
user_type_options[i].label = i18n._(user_type_options[i].label);
}
@ -28,12 +28,16 @@ export default ['$scope', '$rootScope', '$stateParams', 'UserForm', 'Rest',
id = $stateParams.user_id,
defaultUrl = GetBasePath('users') + id,
user_obj = resourceData.data;
$scope.breadcrumb.user_name = user_obj.username;
init();
function init() {
_.forEach(form.fields, (value, key) => {
$scope[key] = user_obj[key];
});
$scope.canEdit = me.get('summary_fields.user_capabilities.edit');
$scope.isOrgAdmin = me.get('related.admin_of_organizations.count') > 0;
$scope.isCurrentlyLoggedInUser = (parseInt(id) === $rootScope.current_user.id);
@ -73,9 +77,6 @@ export default ['$scope', '$rootScope', '$stateParams', 'UserForm', 'Rest',
$scope.$watch('user_obj.summary_fields.user_capabilities.edit', function(val) {
$scope.canAdd = (val === false) ? false : true;
});
setScopeFields(user_obj);
}
function user_type_sync($scope) {
@ -107,19 +108,6 @@ export default ['$scope', '$rootScope', '$stateParams', 'UserForm', 'Rest',
};
}
function setScopeFields(data) {
_(data)
.pick(function(value, key) {
return form.fields.hasOwnProperty(key) === true;
})
.forEach(function(value, key) {
$scope[key] = value;
})
.value();
return;
}
$scope.redirectToResource = function(resource) {
let type = resource.summary_fields.resource_type.replace(/ /g , "_");
var id = resource.related[type].split("/")[4];

View File

@ -223,6 +223,11 @@
}
}
},
"lodash": {
"version": "3.8.0",
"from": "lodash@>=3.8.0 <3.9.0",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-3.8.0.tgz"
},
"rrule": {
"version": "2.2.0-dev",
"from": "jkbrzt/rrule#4ff63b2f8524fd6d5ba6e80db770953b5cd08a0c",
@ -233,7 +238,7 @@
"angular-tz-extensions": {
"version": "0.5.2",
"from": "git+https://git@github.com/ansible/angular-tz-extensions.git#v0.5.2",
"resolved": "git+https://git@github.com/ansible/angular-tz-extensions.git#9cabb05d58079092bfb29ccae721b35b46f28af6",
"resolved": "git://github.com/ansible/angular-tz-extensions.git#9cabb05d58079092bfb29ccae721b35b46f28af6",
"dependencies": {
"jquery": {
"version": "3.3.1",
@ -1496,7 +1501,15 @@
"version": "0.19.0",
"from": "cheerio@>=0.19.0 <0.20.0",
"resolved": "https://registry.npmjs.org/cheerio/-/cheerio-0.19.0.tgz",
"dev": true
"dev": true,
"dependencies": {
"lodash": {
"version": "3.10.1",
"from": "lodash@>=3.2.0 <4.0.0",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-3.10.1.tgz",
"dev": true
}
}
},
"chokidar": {
"version": "1.7.0",
@ -5420,6 +5433,12 @@
"resolved": "https://registry.npmjs.org/karma/-/karma-1.7.1.tgz",
"dev": true,
"dependencies": {
"lodash": {
"version": "3.10.1",
"from": "lodash@>=3.8.0 <4.0.0",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-3.10.1.tgz",
"dev": true
},
"source-map": {
"version": "0.5.7",
"from": "source-map@>=0.5.3 <0.6.0",
@ -5723,6 +5742,12 @@
"from": "inquirer@>=0.8.2 <0.9.0",
"resolved": "https://registry.npmjs.org/inquirer/-/inquirer-0.8.5.tgz",
"dev": true
},
"lodash": {
"version": "3.10.1",
"from": "lodash@>=3.6.0 <4.0.0",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-3.10.1.tgz",
"dev": true
}
}
},
@ -5796,9 +5821,9 @@
"dev": true
},
"lodash": {
"version": "3.8.0",
"from": "lodash@>=3.8.0 <3.9.0",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-3.8.0.tgz"
"version": "4.17.10",
"from": "lodash@>=4.17.10 <4.18.0",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.10.tgz"
},
"lodash._arraycopy": {
"version": "3.0.0",
@ -6317,6 +6342,12 @@
"from": "glob@>=5.0.0 <6.0.0",
"resolved": "https://registry.npmjs.org/glob/-/glob-5.0.15.tgz",
"dev": true
},
"lodash": {
"version": "3.10.1",
"from": "lodash@>=3.0.0 <4.0.0",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-3.10.1.tgz",
"dev": true
}
}
},

View File

@ -121,7 +121,7 @@
"jquery-ui": "^1.12.1",
"js-yaml": "^3.2.7",
"legacy-loader": "0.0.2",
"lodash": "~3.8.0",
"lodash": "~4.17.10",
"lr-infinite-scroll": "git+https://git@github.com/lorenzofox3/lrInfiniteScroll",
"moment": "^2.19.4",
"ng-toast": "git+https://git@github.com/ansible/ngToast#v2.1.1",