зеркало из https://github.com/mozilla/treeherder.git
Bug1413156 - lodash to ES6: replace _.without _.values _.last usage (#3338)
This commit is contained in:
Родитель
50034a713b
Коммит
5f68792a58
|
@ -165,7 +165,7 @@ export default class PushList extends React.Component {
|
|||
// since we fetched more pushes, we need to persist the
|
||||
// push state in the URL.
|
||||
const rsArray = this.ThResultSetStore.getPushArray();
|
||||
const updatedLastRevision = _.last(rsArray).revision;
|
||||
const updatedLastRevision = rsArray[rsArray.length - 1].revision;
|
||||
if (this.$location.search().fromchange !== updatedLastRevision) {
|
||||
this.$rootScope.skipNextPageReload = true;
|
||||
this.$location.search('fromchange', updatedLastRevision);
|
||||
|
|
|
@ -212,7 +212,7 @@ treeherderApp.controller('MainCtrl', [
|
|||
*/
|
||||
|
||||
$scope.isSingleTierSelected = function () {
|
||||
return _.without(_.values($scope.tiers), false).length === 1;
|
||||
return Object.values($scope.tiers).filter(value => (value !== false)).length === 1;
|
||||
};
|
||||
|
||||
$scope.isTierShowing = function (tier) {
|
||||
|
|
|
@ -278,7 +278,7 @@ treeherder.factory('ThRepositoryModel', [
|
|||
|
||||
// To get the current repo to display first, we must
|
||||
// ensure it's added to the array last, as per normal user interaction
|
||||
storedWatched = _.without(storedWatched, options.name);
|
||||
storedWatched = storedWatched.filter(value => (value !== options.name));
|
||||
unwatchRepo(options.name);
|
||||
|
||||
// Add the repos in reverse order, like the user would (oldest to newest)
|
||||
|
|
|
@ -147,7 +147,7 @@ treeherder.factory('ThResultSetStore', [
|
|||
jobList = _.flatten(jobList);
|
||||
if (jobList.length > 0) {
|
||||
lastJobUpdate = getLastModifiedJobTime(jobList);
|
||||
var jobListByPush = _.values(
|
||||
var jobListByPush = Object.values(
|
||||
_.groupBy(jobList, 'result_set_id')
|
||||
);
|
||||
jobListByPush
|
||||
|
@ -364,7 +364,7 @@ treeherder.factory('ThResultSetStore', [
|
|||
}
|
||||
|
||||
repoData.pushes.sort(rsCompare);
|
||||
repoData.rsMapOldestTimestamp = _.last(repoData.pushes).push_timestamp;
|
||||
repoData.rsMapOldestTimestamp = repoData.pushes[repoData.pushes.length - 1].push_timestamp;
|
||||
};
|
||||
|
||||
var mapPlatforms = function (rs_obj) {
|
||||
|
|
|
@ -296,7 +296,7 @@ treeherder.factory('thJobFilters', [
|
|||
if (value) {
|
||||
const oldQsVal = _getFiltersOrDefaults(field);
|
||||
if (oldQsVal && oldQsVal.length) {
|
||||
newQsVal = _.without(oldQsVal, value);
|
||||
newQsVal = oldQsVal.filter(filterValue => (filterValue !== value));
|
||||
}
|
||||
if (!newQsVal || !newQsVal.length || _matchesDefaults(field, newQsVal)) {
|
||||
newQsVal = null;
|
||||
|
|
|
@ -148,7 +148,7 @@ treeherder.controller('PinboardCtrl', [
|
|||
|
||||
$scope.retriggerAllPinnedJobs = function () {
|
||||
// pushing pinned jobs to a list.
|
||||
$scope.retriggerJob(_.values($scope.pinnedJobs));
|
||||
$scope.retriggerJob(Object.values($scope.pinnedJobs));
|
||||
};
|
||||
|
||||
$scope.cancelAllPinnedJobsTitle = function () {
|
||||
|
@ -162,14 +162,14 @@ treeherder.controller('PinboardCtrl', [
|
|||
};
|
||||
|
||||
$scope.canCancelAllPinnedJobs = function () {
|
||||
const cancellableJobs = _.values($scope.pinnedJobs).filter(
|
||||
const cancellableJobs = Object.values($scope.pinnedJobs).filter(
|
||||
job => (job.state === 'pending' || job.state === 'running'));
|
||||
return $scope.user.loggedin && cancellableJobs.length > 0;
|
||||
};
|
||||
|
||||
$scope.cancelAllPinnedJobs = function () {
|
||||
if (window.confirm('This will cancel all the selected jobs. Are you sure?')) {
|
||||
$scope.cancelJobs(_.values($scope.pinnedJobs));
|
||||
$scope.cancelJobs(Object.values($scope.pinnedJobs));
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче