зеркало из https://github.com/mozilla/treeherder.git
Bug 1220680 - Add links to graphs from compare view
As long as there is at least one non-try repo in the comparison view, we should allow users to visualize results on a graph.
This commit is contained in:
Родитель
36e27df932
Коммит
edf7548545
|
@ -267,6 +267,20 @@ to { opacity: 0; }
|
|||
border-bottom: 1px dotted #777;
|
||||
}
|
||||
|
||||
.compare-table .result-links span,
|
||||
.compare-table .result-links a {
|
||||
color: transparent;
|
||||
transition: color 150ms ease-in-out;
|
||||
}
|
||||
|
||||
.compare-table tr:hover .result-links span {
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.compare-table tr:hover .result-links a {
|
||||
color: #23527c;
|
||||
}
|
||||
|
||||
.compare-table .num-runs {
|
||||
text-align: right;
|
||||
}
|
||||
|
|
|
@ -90,12 +90,13 @@ perf.controller('CompareResultsCtrl', [
|
|||
'$state', '$stateParams', '$scope', '$rootScope', '$location',
|
||||
'thServiceDomain', 'ThOptionCollectionModel', 'ThRepositoryModel',
|
||||
'ThResultSetModel', '$http', '$q', '$timeout', 'PhSeries', 'math',
|
||||
'isReverseTest', 'PhCompare',
|
||||
'isReverseTest', 'phTimeRanges', 'PhCompare',
|
||||
function CompareResultsCtrl($state, $stateParams, $scope,
|
||||
$rootScope, $location,
|
||||
thServiceDomain, ThOptionCollectionModel,
|
||||
ThRepositoryModel, ThResultSetModel, $http,
|
||||
$q, $timeout, PhSeries, math, isReverseTest,
|
||||
phTimeRanges,
|
||||
PhCompare) {
|
||||
function displayComparison() {
|
||||
$scope.testList = [];
|
||||
|
@ -175,18 +176,34 @@ perf.controller('CompareResultsCtrl', [
|
|||
return;
|
||||
}
|
||||
|
||||
var detailsLink = 'perf.html#/comparesubtest?';
|
||||
detailsLink += _.map(_.pairs({
|
||||
originalProject: $scope.originalProject.name,
|
||||
originalRevision: $scope.originalRevision,
|
||||
newProject: $scope.newProject.name,
|
||||
newRevision: $scope.newRevision,
|
||||
originalSignature: oldSig,
|
||||
newSignature: newSig
|
||||
}), function(kv) { return kv[0]+"="+kv[1]; }).join("&");
|
||||
cmap.links = [];
|
||||
|
||||
if (testName.indexOf("summary") > 0) {
|
||||
cmap.detailsLink = detailsLink;
|
||||
var detailsLink = 'perf.html#/comparesubtest?';
|
||||
detailsLink += _.map(_.pairs({
|
||||
originalProject: $scope.originalProject.name,
|
||||
originalRevision: $scope.originalRevision,
|
||||
newProject: $scope.newProject.name,
|
||||
newRevision: $scope.newRevision,
|
||||
originalSignature: oldSig,
|
||||
newSignature: newSig
|
||||
}), function(kv) { return kv[0]+"="+kv[1]; }).join("&");
|
||||
cmap.links.push({
|
||||
title: 'subtests',
|
||||
href: detailsLink
|
||||
});
|
||||
}
|
||||
|
||||
var graphsLink = PhCompare.getGraphsLink(
|
||||
$scope.originalProject, $scope.newProject, oldSig,
|
||||
$scope.originalResultSet, $scope.newResultSet);
|
||||
if (graphsLink) {
|
||||
cmap.links.push({
|
||||
title: 'graph',
|
||||
href: graphsLink
|
||||
});
|
||||
}
|
||||
|
||||
cmap.name = platform;
|
||||
if (Object.keys($scope.compareResults).indexOf(testName) < 0)
|
||||
$scope.compareResults[testName] = [];
|
||||
|
@ -348,6 +365,18 @@ perf.controller('CompareSubtestResultsCtrl', [
|
|||
}
|
||||
|
||||
cmap.name = page;
|
||||
|
||||
var graphsLink = PhCompare.getGraphsLink(
|
||||
$scope.originalProject, $scope.newProject, oldSig,
|
||||
$scope.originalResultSet, $scope.newResultSet);
|
||||
if (graphsLink) {
|
||||
cmap.links = [{
|
||||
title: 'graph',
|
||||
href: graphsLink
|
||||
}];
|
||||
}
|
||||
|
||||
|
||||
$scope.compareResults[testName].push(cmap);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -480,6 +480,48 @@ perf.factory('PhCompare', [ '$q', '$http', 'thServiceDomain', 'PhSeries',
|
|||
return resultsMap;
|
||||
});
|
||||
},
|
||||
getGraphsLink: function(baseProject, newProject, signature, baseResultSet, newResultSet) {
|
||||
var graphsLink = 'perf.html#/graphs?';
|
||||
function getSeriesParam(projectName, signature) {
|
||||
return 'series=[' + [ projectName, signature,
|
||||
1 ].join(',') + ']';
|
||||
}
|
||||
|
||||
if (baseProject.name === newProject.name) {
|
||||
// Case 1: old/new push same repository
|
||||
graphsLink += getSeriesParam(
|
||||
baseProject.name, signature);
|
||||
} else {
|
||||
// Case 2: different repositories
|
||||
_.forEach(
|
||||
[baseProject, newProject],
|
||||
function(project) {
|
||||
if (graphsLink[graphsLink.length-1] !== '?') {
|
||||
graphsLink += '&';
|
||||
}
|
||||
graphsLink += getSeriesParam(
|
||||
project.name, signature);
|
||||
});
|
||||
}
|
||||
_.forEach([baseResultSet.revision, newResultSet.revision],
|
||||
function(revision) {
|
||||
graphsLink += '&highlightedRevisions=' + revision;
|
||||
});
|
||||
|
||||
graphsLink += '&timerange=' + _.max(
|
||||
_.map([baseResultSet, newResultSet],
|
||||
function(resultSet) {
|
||||
return _.find(
|
||||
_.pluck(phTimeRanges, 'value'),
|
||||
function(t) {
|
||||
return ((Date.now() / 1000.0) -
|
||||
resultSet.push_timestamp) < t;
|
||||
});
|
||||
}));
|
||||
|
||||
return graphsLink;
|
||||
}
|
||||
|
||||
};
|
||||
}]);
|
||||
|
||||
|
|
|
@ -13,9 +13,12 @@
|
|||
<th class="test-warning" style="width: 30px"><!-- warning if not enough --></th>
|
||||
</tr>
|
||||
<tr ng-class="getCompareClasses(compareResult, 'row')" ng-repeat="compareResult in compareResults[testName] | orderBy: 'name'" ng-show="filterPlatform(compareResult)">
|
||||
<td class="test-title">{{compareResult.name}}
|
||||
<span ng-if="compareResult.detailsLink">
|
||||
(<a ng-href="{{compareResult.detailsLink}}" ng-show="compareResult.detailsLink">subtests</a>)
|
||||
<td class="test-title">{{compareResult.name}}
|
||||
<span class="result-links" ng-if="compareResult.links.length > 0">
|
||||
<span ng-repeat="link in compareResult.links">
|
||||
<a ng-href="{{link.href}}">{{link.title}}</a>
|
||||
<span ng-if="!$last"> · </span>
|
||||
</span>
|
||||
</span>
|
||||
</td>
|
||||
<td>
|
||||
|
|
Загрузка…
Ссылка в новой задаче