[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:
@@ -48,11 +48,16 @@ define(
|
|||||||
defaultPath
|
defaultPath
|
||||||
) {
|
) {
|
||||||
var initialPath = ($route.current.params.ids || defaultPath).split("/");
|
var initialPath = ($route.current.params.ids || defaultPath).split("/");
|
||||||
|
var currentIds;
|
||||||
var currentIds = $route.current.params.ids;
|
|
||||||
|
|
||||||
$scope.treeModel = {
|
$scope.treeModel = {
|
||||||
selectedObject: undefined
|
selectedObject: undefined,
|
||||||
|
onSelection: function (object) {
|
||||||
|
navigationService.setNavigation(object, true);
|
||||||
|
},
|
||||||
|
allowSelection: function (object) {
|
||||||
|
return navigationService.shouldNavigate();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
function idsForObject(domainObject) {
|
function idsForObject(domainObject) {
|
||||||
@@ -103,7 +108,6 @@ define(
|
|||||||
function navigateToObject(desiredObject) {
|
function navigateToObject(desiredObject) {
|
||||||
$scope.navigatedObject = desiredObject;
|
$scope.navigatedObject = desiredObject;
|
||||||
$scope.treeModel.selectedObject = desiredObject;
|
$scope.treeModel.selectedObject = desiredObject;
|
||||||
navigationService.setNavigation(desiredObject);
|
|
||||||
currentIds = idsForObject(desiredObject);
|
currentIds = idsForObject(desiredObject);
|
||||||
$route.current.pathParams.ids = currentIds;
|
$route.current.pathParams.ids = currentIds;
|
||||||
$location.path('/browse/' + currentIds);
|
$location.path('/browse/' + currentIds);
|
||||||
@@ -114,10 +118,11 @@ define(
|
|||||||
.then(function (root) {
|
.then(function (root) {
|
||||||
return findViaComposition(root, path);
|
return findViaComposition(root, path);
|
||||||
})
|
})
|
||||||
.then(navigateToObject);
|
.then(function (object) {
|
||||||
|
navigationService.setNavigation(object);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
getObject('ROOT')
|
getObject('ROOT')
|
||||||
.then(function (root) {
|
.then(function (root) {
|
||||||
$scope.domainObject = root;
|
$scope.domainObject = root;
|
||||||
@@ -137,15 +142,6 @@ define(
|
|||||||
// Listen for changes in navigation state.
|
// Listen for changes in navigation state.
|
||||||
navigationService.addListener(navigateDirectlyToModel);
|
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
|
// Listen for route changes which are caused by browser events
|
||||||
// (e.g. bookmarks to pages in OpenMCT) and prevent them. Instead,
|
// (e.g. bookmarks to pages in OpenMCT) and prevent them. Instead,
|
||||||
// navigate to the path ourselves, which results in it being
|
// navigate to the path ourselves, which results in it being
|
||||||
|
|||||||
Reference in New Issue
Block a user