зеркало из https://github.com/mozilla/treeherder.git
Bug 1134780 - add related platforms or branches more easily
This commit is contained in:
Родитель
d061270a8c
Коммит
abab1ae7f8
|
@ -665,14 +665,20 @@ perf.controller('GraphsCtrl', [
|
|||
ThRepositoryModel.get_list().then(function(response) {
|
||||
|
||||
$scope.projects = response.data;
|
||||
$scope.addTestData = function() {
|
||||
$scope.addTestData = function(option, seriesSignature) {
|
||||
var defaultProjectName, defaultPlatform;
|
||||
var options = {};
|
||||
if ($scope.seriesList.length > 0) {
|
||||
var lastSeries = $scope.seriesList.slice(-1)[0];
|
||||
defaultProjectName = lastSeries.projectName;
|
||||
defaultPlatform = lastSeries.platform;
|
||||
}
|
||||
|
||||
if (option !== undefined) {
|
||||
var series = _.findWhere($scope.seriesList, {"signature": seriesSignature});
|
||||
options = { option: option, relatedSeries: series };
|
||||
}
|
||||
|
||||
var modalInstance = $modal.open({
|
||||
templateUrl: 'partials/perf/testdatachooser.html',
|
||||
controller: 'TestChooserCtrl',
|
||||
|
@ -691,7 +697,8 @@ perf.controller('GraphsCtrl', [
|
|||
return $scope.seriesList;
|
||||
},
|
||||
defaultProjectName: function() { return defaultProjectName; },
|
||||
defaultPlatform: function() { return defaultPlatform; }
|
||||
defaultPlatform: function() { return defaultPlatform; },
|
||||
options: function() { return options; }
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -726,15 +733,15 @@ perf.controller('TestChooserCtrl', function($scope, $modalInstance, $http,
|
|||
projects, optionCollectionMap,
|
||||
timeRange, thServiceDomain,
|
||||
thDefaultRepo, PhSeries,
|
||||
defaultProjectName, defaultPlatform,
|
||||
testsDisplayed) {
|
||||
defaultProjectName, defaultPlatform, $q,
|
||||
testsDisplayed, options, thPerformanceBranches) {
|
||||
$scope.timeRange = timeRange;
|
||||
$scope.projects = projects;
|
||||
$scope.selectedProject = _.findWhere(projects, {
|
||||
name: defaultProjectName ? defaultProjectName : thDefaultRepo
|
||||
});
|
||||
$scope.loadingTestData = false;
|
||||
|
||||
$scope.loadingRelatedSignatures = true;
|
||||
var series = [];
|
||||
$scope.addTestData = function () {
|
||||
if (($scope.testsToAdd.length + testsDisplayed.length) > 6) {
|
||||
|
@ -797,6 +804,71 @@ perf.controller('TestChooserCtrl', function($scope, $modalInstance, $http,
|
|||
});
|
||||
};
|
||||
|
||||
var loadingExtraDataPromise = $q.defer();
|
||||
var addRelatedPlatforms = function(relatedSeries) {
|
||||
PhSeries.getAllSeries(relatedSeries.projectName,
|
||||
$scope.timeRange, optionCollectionMap).then(
|
||||
function(seriesData) {
|
||||
var platformList = seriesData.platformList;
|
||||
platformList.forEach(function(platform) {
|
||||
// query all the tests with specific platform, then find
|
||||
// out the test which has same with the existed test
|
||||
var testList = _.sortBy(_.filter(seriesData.seriesList,
|
||||
{ platform: platform }), 'name');
|
||||
var temp = _.findWhere(testList, {"name": relatedSeries.name});
|
||||
// if found something different from the series we already have,
|
||||
// then we push it into the testsToAdd list.
|
||||
if (temp !== undefined && temp.signature !== relatedSeries.signature) {
|
||||
$scope.testsToAdd.push(_.clone(temp));
|
||||
}
|
||||
});
|
||||
}
|
||||
).then(function() {
|
||||
// resolve the testsToAdd's length after every thing was done
|
||||
// so we don't need timeout here
|
||||
loadingExtraDataPromise.resolve($scope.testsToAdd.length);
|
||||
});
|
||||
};
|
||||
|
||||
var addRelatedBranches = function(relatedSeries) {
|
||||
var branchList = [];
|
||||
thPerformanceBranches.forEach(function (branch) {
|
||||
if (branch !== relatedSeries.projectName) {
|
||||
branchList.push(_.findWhere($scope.projects, {name: branch}));
|
||||
}
|
||||
});
|
||||
// get each project's series data from remote and use promise to
|
||||
// ensure each step will be executed after last on has finished
|
||||
$q.all(branchList.map(function (project) {
|
||||
return PhSeries.getAllSeries(project.name,
|
||||
$scope.timeRange, optionCollectionMap);
|
||||
})).then(function (seriesList) {
|
||||
seriesList.forEach(function (series) {
|
||||
var testList = _.sortBy(_.filter(series.seriesList,
|
||||
{platform: relatedSeries.platform}), 'name');
|
||||
var temp = _.findWhere(testList, {"name": relatedSeries.name});
|
||||
$scope.testsToAdd.push(_.clone(temp));
|
||||
});
|
||||
}).then(function () {
|
||||
loadingExtraDataPromise.resolve($scope.testsToAdd.length);
|
||||
});
|
||||
};
|
||||
if (options.option !== undefined) {
|
||||
$scope.loadingRelatedSignatures = false;
|
||||
if (options.option === "addRelatedPlatform") {
|
||||
addRelatedPlatforms(options.relatedSeries);
|
||||
} else if (options.option === "addRelatedBranches") {
|
||||
addRelatedBranches(options.relatedSeries);
|
||||
}
|
||||
loadingExtraDataPromise.promise.then(function(length){
|
||||
if (length > 0) {
|
||||
$scope.loadingRelatedSignatures = true;
|
||||
} else {
|
||||
window.alert("Oops, no related platforms or branches have been found.");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$scope.updateTestInput = function() {
|
||||
$scope.addTestDataDisabled = true;
|
||||
$scope.loadingTestData = true;
|
||||
|
|
|
@ -169,3 +169,7 @@ treeherder.value("thJobNavSelectors",
|
|||
}
|
||||
}
|
||||
);
|
||||
|
||||
treeherder.value("thPerformanceBranches", [
|
||||
"mozilla-inbound", "mozilla-central", "fx-team", "b2g-inbound"
|
||||
]);
|
||||
|
|
|
@ -16,8 +16,8 @@
|
|||
<td width="10px" class="graph-legend" style="padding: 4px; background-color: {{series.blockColor}}" ></td>
|
||||
<td class="graph-legend" ng-class="{'series-inactive':!series.active}">
|
||||
<b>{{series.name}}</b><br/>
|
||||
{{series.projectName}}<br/>
|
||||
{{series.platform}}<br/>
|
||||
<a href="#" ng-click="addTestData('addRelatedBranches', series.signature)" title="Add related branches">{{series.projectName}}</a><br/>
|
||||
<a href="#" ng-click="addTestData('addRelatedPlatform', series.signature)" title="Add related platforms">{{series.platform}}</a><br/>
|
||||
<div class="signature"><small>{{series.signature}}</small></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
|
|
@ -2,7 +2,10 @@
|
|||
<button type="button" class="close" ng-click="cancel()"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button>
|
||||
<h3 class="modal-title">Add test data</h3>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="modal-body" ng-show="!loadingRelatedSignatures">
|
||||
<p class="blink" >Getting related test information ...</p>
|
||||
</div>
|
||||
<div class="modal-body" ng-show="loadingRelatedSignatures">
|
||||
<div class="test-chooser">
|
||||
<h4>Project</h4>
|
||||
<select class="form-control" ng-change="updateTestInput()" ng-model="selectedProject" ng-options="project.name for project in projects">
|
||||
|
|
Загрузка…
Ссылка в новой задаче