mirror of
https://github.com/nasa/openmct.git
synced 2025-01-04 12:24:10 +00:00
[Addressability] Update path on navigation
Update path in browse mode when navigation state changes. WTD-1149.
This commit is contained in:
parent
9fae2db04a
commit
084d6b6859
@ -14,7 +14,7 @@
|
|||||||
{
|
{
|
||||||
"key": "BrowseController",
|
"key": "BrowseController",
|
||||||
"implementation": "BrowseController.js",
|
"implementation": "BrowseController.js",
|
||||||
"depends": [ "$scope", "$routeParams", "objectService", "navigationService" ]
|
"depends": [ "$scope", "$route", "$location", "objectService", "navigationService" ]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"key": "CreateMenuController",
|
"key": "CreateMenuController",
|
||||||
|
@ -41,17 +41,28 @@ define(
|
|||||||
*
|
*
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
function BrowseController($scope, $routeParams, objectService, navigationService) {
|
function BrowseController($scope, $routeParams, $location, objectService, navigationService) {
|
||||||
var path = [ROOT_ID].concat(
|
var path = [ROOT_ID].concat(
|
||||||
($routeParams.ids || DEFAULT_PATH).split("/")
|
($routeParams.ids || DEFAULT_PATH).split("/")
|
||||||
);
|
);
|
||||||
|
|
||||||
|
function updateRoute(domainObject) {
|
||||||
|
var context = domainObject.getCapability('context'),
|
||||||
|
objectPath = context.getPath(),
|
||||||
|
ids = objectPath.map(function (domainObject) {
|
||||||
|
return domainObject.getId();
|
||||||
|
});
|
||||||
|
|
||||||
|
$location.path("/browse/" + ids.slice(1).join("/"));
|
||||||
|
}
|
||||||
|
|
||||||
// Callback for updating the in-scope reference to the object
|
// Callback for updating the in-scope reference to the object
|
||||||
// that is currently navigated-to.
|
// that is currently navigated-to.
|
||||||
function setNavigation(domainObject) {
|
function setNavigation(domainObject) {
|
||||||
$scope.navigatedObject = domainObject;
|
$scope.navigatedObject = domainObject;
|
||||||
$scope.treeModel.selectedObject = domainObject;
|
$scope.treeModel.selectedObject = domainObject;
|
||||||
navigationService.setNavigation(domainObject);
|
navigationService.setNavigation(domainObject);
|
||||||
|
updateRoute(domainObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
function navigateTo(domainObject) {
|
function navigateTo(domainObject) {
|
||||||
|
Loading…
Reference in New Issue
Block a user