Bug 1221064 - change source endpoint for the similar jobs panel

Let's use the new endpoint to keep the sorting in the similar jobs list
right.
This commit is contained in:
Mauro Doglio 2015-11-03 19:51:31 +00:00
Родитель caa8cb0f82
Коммит 6cdbfa89b1
3 изменённых файлов: 14 добавлений и 11 удалений

Просмотреть файл

@ -30,8 +30,12 @@ treeherder.factory('ThJobModel', [
config = config || {};
var timeout = config.timeout || null;
var fetch_all = config.fetch_all || false;
// The `uri` config allows to fetch a list of jobs from an arbitrary
// endpoint e.g. the similar jobs endpoint. It defaults to the job
// list endpoint.
var uri = config.uri || ThJobModel.get_uri(repoName);
return $http.get(ThJobModel.get_uri(repoName),{
return $http.get(uri,{
params: options,
timeout: timeout
}).
@ -79,6 +83,14 @@ treeherder.factory('ThJobModel', [
});
};
ThJobModel.get_similar_jobs = function(repoName, pk, options, config){
config = config || {};
// The similar jobs endpoints returns the same type of objects as
// the job list endpoint, so let's reuse the get_list method logic.
config.uri = ThJobModel.get_uri(repoName)+pk+"/similar_jobs/";
return ThJobModel.get_list(repoName, options, config);
};
ThJobModel.retrigger = function(repoName, job_id_list, config) {
config = config || {};
var timeout = config.timeout || null;

Просмотреть файл

@ -27,7 +27,7 @@ treeherder.controller('SimilarJobsPluginCtrl', [
options[key] = $scope.job[key];
}
});
ThJobModel.get_list($scope.repoName, options)
ThJobModel.get_similar_jobs($scope.repoName, $scope.job.id, options)
.then(function(data){
if(data.length > 0){
if(data.length > $scope.page_size){
@ -90,7 +90,6 @@ treeherder.controller('SimilarJobsPluginCtrl', [
$scope.similar_jobs_filters = {
"machine_id": false,
"job_type_id": true,
"build_platform_id": true,
"option_collection_hash": true
};
@ -143,5 +142,3 @@ treeherder.controller('SimilarJobsPluginCtrl', [
});
};
}]);

Просмотреть файл

@ -38,11 +38,6 @@
</div>
<div class="right_panel">
<form role="form" class="form form-inline">
<div class="checkbox">
<input ng-change="update_similar_jobs()" type="checkbox" ng-model="similar_jobs_filters.job_type_id"/>
<small>Same job type</small>
</div>
<div class="checkbox">
<input ng-change="update_similar_jobs()" type="checkbox" ng-model="similar_jobs_filters.build_platform_id"/>
<small>Same platform</small>
@ -126,4 +121,3 @@
</div>
</div>
</div>