Merge pull request #974 from wlach/1205789

Bug 1205789 - Fix and clarify changing time range in perfherder graphs
This commit is contained in:
William Lachance 2015-09-18 15:06:22 -04:00
Родитель f9d7a960b0 9f89bdb01a
Коммит fdff333b8f
1 изменённых файлов: 12 добавлений и 7 удалений

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

@ -14,9 +14,18 @@ perf.controller('GraphsCtrl', [
var optionCollectionMap = null;
$scope.highlightedRevisions = [ undefined, undefined ];
$scope.timeranges = phTimeRanges;
$scope.oldTimerange = _.find(phTimeRanges, {'value': parseInt($stateParams.timerange)});
$scope.myTimerange = $scope.oldTimerange;
if ($stateParams.timerange) {
$scope.oldTimerange = _.find(phTimeRanges,
{'value': parseInt($stateParams.timerange)});
$scope.myTimerange = $scope.oldTimerange;
}
if (!$scope.myTimerange) {
// 7 days is a sensible default
$scope.myTimerange = $scope.timeranges[1];
}
$scope.ttHideTimer = null;
$scope.selectedDataPoint = null;
$scope.showToolTipTimeout = null;
@ -415,15 +424,11 @@ perf.controller('GraphsCtrl', [
});
}
if (!$scope.myTimerange) {
// 7 days is a sensible default
$scope.myTimerange = $scope.timeranges[1];
}
$scope.timeRangeChanged = function() {
// if new === old (i.e. page is first loaded), skip the event
if (!$scope.oldTimerange ||
$scope.oldTimerange.value === $scope.myTimerange.value) {
$scope.oldTimerange = $scope.myTimerange;
return;
}