mirror of
https://github.com/nasa/openmct.git
synced 2025-06-21 08:39:59 +00:00
[Addressability] Work around reload again
Work around Angular's page refresh on URL change to avoid unintended effects when chosen view changes (such as tree collapse), WTD-1149.
This commit is contained in:
@ -3,11 +3,13 @@
|
|||||||
"routes": [
|
"routes": [
|
||||||
{
|
{
|
||||||
"when": "/browse/:ids*",
|
"when": "/browse/:ids*",
|
||||||
"templateUrl": "templates/browse.html"
|
"templateUrl": "templates/browse.html",
|
||||||
|
"reloadOnSearch": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"when": "",
|
"when": "",
|
||||||
"templateUrl": "templates/browse.html"
|
"templateUrl": "templates/browse.html",
|
||||||
|
"reloadOnSearch": false
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"controllers": [
|
"controllers": [
|
||||||
@ -19,7 +21,7 @@
|
|||||||
{
|
{
|
||||||
"key": "BrowseObjectController",
|
"key": "BrowseObjectController",
|
||||||
"implementation": "BrowseObjectController.js",
|
"implementation": "BrowseObjectController.js",
|
||||||
"depends": [ "$scope", "$location" ]
|
"depends": [ "$scope", "$location", "$route" ]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"key": "CreateMenuController",
|
"key": "CreateMenuController",
|
||||||
|
@ -47,8 +47,9 @@ define(
|
|||||||
);
|
);
|
||||||
|
|
||||||
function updateRoute(domainObject) {
|
function updateRoute(domainObject) {
|
||||||
var context = domainObject.getCapability('context'),
|
var context = domainObject &&
|
||||||
objectPath = context.getPath(),
|
domainObject.getCapability('context'),
|
||||||
|
objectPath = context ? context.getPath() : [],
|
||||||
ids = objectPath.map(function (domainObject) {
|
ids = objectPath.map(function (domainObject) {
|
||||||
return domainObject.getId();
|
return domainObject.getId();
|
||||||
}),
|
}),
|
||||||
|
@ -31,7 +31,7 @@ define(
|
|||||||
* object (the right-hand side of Browse mode.)
|
* object (the right-hand side of Browse mode.)
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
function BrowseObjectController($scope, $location) {
|
function BrowseObjectController($scope, $location, $route) {
|
||||||
function setViewForDomainObject(domainObject) {
|
function setViewForDomainObject(domainObject) {
|
||||||
var locationViewKey = $location.search().view;
|
var locationViewKey = $location.search().view;
|
||||||
|
|
||||||
@ -48,8 +48,14 @@ define(
|
|||||||
}
|
}
|
||||||
|
|
||||||
function updateQueryParam(viewKey) {
|
function updateQueryParam(viewKey) {
|
||||||
|
var unlisten, priorRoute = $route.current;
|
||||||
|
|
||||||
if (viewKey) {
|
if (viewKey) {
|
||||||
$location.search('view', viewKey);
|
$location.search('view', viewKey);
|
||||||
|
unlisten = $scope.$on('$locationChangeSuccess', function () {
|
||||||
|
$route.current = priorRoute;
|
||||||
|
unlisten();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user