Files
stackviz/app/js/controllers/home.js
Austin Clark 093c02d0b9 Fix lint errors and update eslint
Fixes a couple of lint errors caught by `npm run lint` in timeline-
overview.js and timeline-viewport.js. Also restructures the test-
details controller to use appropriate `this.` syntax instead of
`$scope.`

In addition, eslint and eslint-config-openstack have been updated,
and a new .eslintrc.json config file has been created to tweak some
specific rules for stackviz.

Change-Id: I9e1fe5121621730eb3efda4b99e9fe182f399aee
2016-02-04 13:52:12 -07:00

30 lines
613 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('HomeController', HomeCtrl);