
This adds new dataset parameter to the home page (defaulting to #0 as before) to ensure that the current state of the page can always be shared via URL. Additionally, the timeline route is also changed to follow the new scheme. Change-Id: Ieadd4724b24c612fbba2a614728563c1c00b92be
30 lines
607 B
JavaScript
30 lines
607 B
JavaScript
'use strict';
|
|
|
|
var controllersModule = require('./_index');
|
|
|
|
/**
|
|
* @ngInject
|
|
*/
|
|
function HomeCtrl($scope, $state, datasetService) {
|
|
|
|
// ViewModel
|
|
var vm = this;
|
|
vm.focus = $state.params.datasetId;
|
|
|
|
datasetService.list().then(function(response) {
|
|
vm.tempest = response.data.tempest;
|
|
});
|
|
|
|
// update the page url as the focus id changes, but don't reload
|
|
$scope.$watch(function() {
|
|
return vm.focus;
|
|
}, function(value, old) {
|
|
if (value !== old) {
|
|
$state.go('home', { datasetId: value }, { notify: false });
|
|
}
|
|
});
|
|
|
|
}
|
|
|
|
controllersModule.controller('HomeCtrl', HomeCtrl);
|