зеркало из https://github.com/mozilla/treeherder.git
Bug 1413156 - lodash to ES6: _.size to .length (#3332)
This commit is contained in:
Родитель
53870092f9
Коммит
31dc8dec99
|
@ -29,7 +29,7 @@ treeherder.factory('ThRepositoryModel', [
|
|||
|
||||
|
||||
const getOrderedRepoGroups = function () {
|
||||
if (!_.size(orderedRepoGroups)) {
|
||||
if (!Object.keys(orderedRepoGroups).length) {
|
||||
const groups = _.groupBy($rootScope.repos, function (r) { return r.repository_group.name; });
|
||||
_.each(groups, function (reposAr, gName) {
|
||||
orderedRepoGroups[thRepoGroupOrder[gName] || gName] = { name: gName, repos: reposAr };
|
||||
|
@ -84,7 +84,7 @@ treeherder.factory('ThRepositoryModel', [
|
|||
const newStatuses = {};
|
||||
|
||||
const updateStatusesIfDone = function () {
|
||||
if (_.size(newStatuses) === repoNames.length) {
|
||||
if (Object.keys(newStatuses).length === repoNames.length) {
|
||||
// we've received all the statuses we expect to
|
||||
_.defer(function () {
|
||||
_.each(newStatuses, function (status) {
|
||||
|
@ -189,7 +189,7 @@ treeherder.factory('ThRepositoryModel', [
|
|||
// don't want to just replace the watchedRepos object because
|
||||
// controllers, etc, are watching the reference to it, which would
|
||||
// be lost by replacing.
|
||||
if (_.size(watchedRepos) <= 1) {
|
||||
if (watchedRepos.length <= 1) {
|
||||
_.each(watchedRepos, function (r, rname) {
|
||||
unwatchRepo(rname);
|
||||
});
|
||||
|
|
|
@ -278,7 +278,7 @@ treeherder.factory('ThResultSetStore', [
|
|||
if (jMap.job_obj.visible) {
|
||||
shownJobs.push(jMap.job_obj);
|
||||
}
|
||||
if (_.size(shownJobs) === spaceRemaining) {
|
||||
if (shownJobs.length === spaceRemaining) {
|
||||
thNotify.send(errorMessage, 'danger');
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -66,7 +66,7 @@ treeherder.factory('thPinboard', [
|
|||
pinJob: function (job) {
|
||||
if (api.spaceRemaining() > 0) {
|
||||
pinnedJobs[job.id] = job;
|
||||
api.count.numPinnedJobs = _.size(pinnedJobs);
|
||||
api.count.numPinnedJobs = Object.keys(pinnedJobs).length;
|
||||
$rootScope.$emit(thEvents.pulsePinCount);
|
||||
} else {
|
||||
thNotify.send(thPinboardCountError, 'danger');
|
||||
|
@ -79,7 +79,7 @@ treeherder.factory('thPinboard', [
|
|||
|
||||
unPinJob: function (id) {
|
||||
delete pinnedJobs[id];
|
||||
api.count.numPinnedJobs = _.size(pinnedJobs);
|
||||
api.count.numPinnedJobs = Object.keys(pinnedJobs).length;
|
||||
},
|
||||
|
||||
// clear all pinned jobs and related bugs
|
||||
|
@ -90,12 +90,12 @@ treeherder.factory('thPinboard', [
|
|||
for (const bid in relatedBugs) {
|
||||
if (relatedBugs.hasOwnProperty(bid)) { delete relatedBugs[bid]; }
|
||||
}
|
||||
api.count.numPinnedJobs = _.size(pinnedJobs);
|
||||
api.count.numPinnedJobs = Object.keys(pinnedJobs).length;
|
||||
},
|
||||
|
||||
addBug: (bug, job) => {
|
||||
relatedBugs[bug.id] = bug;
|
||||
api.count.numRelatedBugs = _.size(relatedBugs);
|
||||
api.count.numRelatedBugs = Object.keys(relatedBugs).length;
|
||||
|
||||
if (job) {
|
||||
api.pinJob(job);
|
||||
|
@ -104,7 +104,7 @@ treeherder.factory('thPinboard', [
|
|||
|
||||
removeBug: function (id) {
|
||||
delete relatedBugs[id];
|
||||
api.count.numRelatedBugs = _.size(relatedBugs);
|
||||
api.count.numRelatedBugs = Object.keys(relatedBugs).length;
|
||||
},
|
||||
|
||||
// open form to create a new note. default to intermittent
|
||||
|
@ -176,4 +176,3 @@ treeherder.factory('thPinboard', [
|
|||
|
||||
return api;
|
||||
}]);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче