[Browse] tighter tree view integration

BrowseController uses new MCTTreeView parameters to prevent navigation
events before triggering digests.  It also no longer sets navigation
more frequently than it should.

https://github.com/nasa/openmct/issues/1360
This commit is contained in:
Pete Richards 2016-12-20 15:29:00 -08:00
parent 6328bd9354
commit 89be1c810a

@ -48,11 +48,16 @@ define(
defaultPath
) {
var initialPath = ($route.current.params.ids || defaultPath).split("/");
var currentIds = $route.current.params.ids;
var currentIds;
$scope.treeModel = {
selectedObject: undefined
selectedObject: undefined,
onSelection: function (object) {
navigationService.setNavigation(object, true);
},
allowSelection: function (object) {
return navigationService.shouldNavigate();
}
};
function idsForObject(domainObject) {
@ -103,7 +108,6 @@ define(
function navigateToObject(desiredObject) {
$scope.navigatedObject = desiredObject;
$scope.treeModel.selectedObject = desiredObject;
navigationService.setNavigation(desiredObject);
currentIds = idsForObject(desiredObject);
$route.current.pathParams.ids = currentIds;
$location.path('/browse/' + currentIds);
@ -114,10 +118,11 @@ define(
.then(function (root) {
return findViaComposition(root, path);
})
.then(navigateToObject);
.then(function (object) {
navigationService.setNavigation(object);
});
}
getObject('ROOT')
.then(function (root) {
$scope.domainObject = root;
@ -137,15 +142,6 @@ define(
// Listen for changes in navigation state.
navigationService.addListener(navigateDirectlyToModel);
// Also listen for changes which come from the tree. Changes in
// the tree will trigger a change in browse navigation state.
$scope.$watch("treeModel.selectedObject", function (newObject, oldObject) {
if (oldObject !== newObject) {
navigateDirectlyToModel(newObject);
}
});
// Listen for route changes which are caused by browser events
// (e.g. bookmarks to pages in OpenMCT) and prevent them. Instead,
// navigate to the path ourselves, which results in it being