mirror of
https://github.com/nasa/openmct.git
synced 2025-01-31 16:36:13 +00:00
Merge remote-tracking branch 'github/mobile' into open74-m-mobile
This commit is contained in:
commit
80a91970f6
@ -23,6 +23,6 @@
|
||||
<!-- Back Arrow Icon used on mobile-->
|
||||
<a ng-controller="BrowseController"
|
||||
class='type-icon icon ui-symbol s-back'
|
||||
ng-click='backArrow()'
|
||||
ng-class="checkRoot(); atRoot ? 'hidden' : ''">{
|
||||
ng-class="checkRoot(); atRoot ? 'hidden' : ''"
|
||||
ng-click='backArrow()'>{
|
||||
</a>
|
||||
|
@ -134,28 +134,70 @@ define(
|
||||
// is not the root, then user is navigated to
|
||||
// parent
|
||||
function navigateToParent() {
|
||||
var parent = navigationService.getNavigation().getCapability('context').getParent(),
|
||||
grandparent;
|
||||
if (parent.getId() !== ROOT_ID) {
|
||||
grandparent = parent.getCapability('context').getParent().getId();
|
||||
navigateTo(parent);
|
||||
if (grandparent && grandparent !== ROOT_ID) {
|
||||
$scope.atRoot = false;
|
||||
} else {
|
||||
var context = navigationService.getNavigation().getCapability('context'),
|
||||
parentContext,
|
||||
parent,
|
||||
grandparentId;
|
||||
|
||||
// Checks if the current object has a context
|
||||
if (context) {
|
||||
|
||||
// Sets the parent and the parent context
|
||||
// which is checked
|
||||
parent = context.getParent();
|
||||
parentContext = parent.getCapability('context');
|
||||
|
||||
if ((parent.getId() !== ROOT_ID) && parentContext) {
|
||||
// Gets the grandparent id
|
||||
grandparentId = parentContext.getParent().getId();
|
||||
|
||||
// Navigates to the parent
|
||||
navigateTo(parent);
|
||||
|
||||
// Checks after navigation if the user is located at the
|
||||
// root (grandparent of original selected object, after
|
||||
// navigation, user is at parent of original object and
|
||||
// child of grandparent)
|
||||
if (grandparentId && grandparentId !== ROOT_ID) {
|
||||
$scope.atRoot = false;
|
||||
return;
|
||||
}
|
||||
|
||||
// Set at root if no grandparent exists and
|
||||
// if grandparent is ROOT, after navigation
|
||||
$scope.atRoot = true;
|
||||
}
|
||||
} else {
|
||||
$scope.atRoot = true;
|
||||
}
|
||||
}
|
||||
|
||||
function checkRoot() {
|
||||
var parent = navigationService.getNavigation().getCapability('context').getParent();
|
||||
if (parent.getId() !== ROOT_ID) {
|
||||
$scope.atRoot = false;
|
||||
} else {
|
||||
$scope.atRoot = true;
|
||||
var context = navigationService.getNavigation().getCapability('context'),
|
||||
parentContext,
|
||||
parent,
|
||||
grandparent;
|
||||
|
||||
// Checks if the current object has a context
|
||||
if (context) {
|
||||
parent = context.getParent();
|
||||
parentContext = parent.getCapability('context');
|
||||
if ((parent.getId() !== ROOT_ID) && parentContext) {
|
||||
grandparent = parentContext.getParent();
|
||||
|
||||
// Checks if the grandparent exists
|
||||
// if it does not exist (for example in search),
|
||||
// than do not show the back button
|
||||
if (grandparent) {
|
||||
$scope.atRoot = false;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// In any other situation where the context or parent
|
||||
// context does not exist or the user is at ROOT, than
|
||||
// hide the back arrow
|
||||
$scope.atRoot = true;
|
||||
|
||||
}
|
||||
|
||||
// Load the root object, put it in the scope.
|
||||
|
@ -304,6 +304,19 @@ define(
|
||||
);
|
||||
|
||||
mockScope.checkRoot();
|
||||
|
||||
mockDomainObject.getCapability.andReturn(undefined);
|
||||
mockNavigationService.getNavigation.andReturn(mockDomainObject);
|
||||
|
||||
controller = new BrowseController(
|
||||
mockScope,
|
||||
mockRoute,
|
||||
mockLocation,
|
||||
mockObjectService,
|
||||
mockNavigationService
|
||||
);
|
||||
|
||||
mockScope.checkRoot();
|
||||
});
|
||||
|
||||
// Mocks the back arrow call that
|
||||
|
@ -29,8 +29,9 @@
|
||||
key="'label'"
|
||||
mct-object="domainObject"
|
||||
ng-model="ngModel"
|
||||
ng-click="!treeNode.checkMobile() || model.composition == undefined ?
|
||||
ngModel.selectedObject = domainObject : toggle.toggle(); treeNode.trackExpansion()"
|
||||
ng-click="!treeNode.checkMobile() || model.composition == undefined ||
|
||||
model.composition.length == 0 ? treeNode.setObject(ngModel, domainObject) : toggle.toggle();
|
||||
treeNode.trackExpansion()"
|
||||
>
|
||||
</mct-representation>
|
||||
<span
|
||||
|
Loading…
x
Reference in New Issue
Block a user