
This patch adds the ability for users to share a selected timeline item via the page URL. When an item is selected, the page address is updated to include the current test name as a parameter. If this link is shared, the test named in the URL will automatically be highlighed when the page is loaded. Change-Id: I228d58e68ee986f621a3763bba1a565300c79023
38 lines
789 B
JavaScript
38 lines
789 B
JavaScript
'use strict';
|
|
|
|
var controllersModule = require('./_index');
|
|
|
|
/**
|
|
* @ngInject
|
|
*/
|
|
function TimelineCtrl($scope, $location, $stateParams, datasetService) {
|
|
|
|
// ViewModel
|
|
var vm = this;
|
|
|
|
datasetService.get($stateParams.datasetId).then(function(dataset) {
|
|
vm.dataset = dataset;
|
|
}, function(reason) {
|
|
vm.error = "Unable to load dataset: " + reason;
|
|
});
|
|
|
|
vm.hoveredItem = null;
|
|
vm.selectedItem = null;
|
|
|
|
vm.preselect = $location.search().test;
|
|
|
|
$scope.$watch(function() {
|
|
return vm.selectedItem;
|
|
}, function(value) {
|
|
if (value) {
|
|
$location.search({ test: value.name });
|
|
vm.preselect = null;
|
|
} else if (vm.preselect === null) {
|
|
$location.search({ test: null });
|
|
}
|
|
});
|
|
|
|
}
|
|
|
|
controllersModule.controller('TimelineCtrl', TimelineCtrl);
|