mirror of
https://github.com/nasa/openmct.git
synced 2024-12-28 08:58:52 +00:00
[Inspector] Lay groundwork for multiple selection
Created a new ngModel property for inspection which is an array. Currently the array only holds one object at a time, but it can be expanded in the future.
This commit is contained in:
parent
01f5a4886b
commit
bcf6bbf627
@ -143,6 +143,9 @@ define(
|
||||
$scope.treeModel = {
|
||||
selectedObject: navigationService.getNavigation()
|
||||
};
|
||||
// Create an array of objects which will allow for multiple selection
|
||||
// for the object inspector.
|
||||
$scope.inspectionObjects = [$scope.selectedObject];
|
||||
|
||||
// Listen for changes in navigation state.
|
||||
navigationService.addListener(setNavigation);
|
||||
|
@ -36,7 +36,7 @@
|
||||
key="'label'"
|
||||
mct-object="domainObject"
|
||||
ng-model="ngModel"
|
||||
ng-click="ngModel.selectedObject = domainObject"
|
||||
ng-click="ngModel.selectedObject = domainObject; ngModel.inspectionObjects = []; ngModel.inspectionObjects[0] = domainObject"
|
||||
>
|
||||
</mct-representation>
|
||||
</span>
|
||||
|
@ -41,10 +41,16 @@ define(
|
||||
|
||||
// Gets an array of the contextual parents/anscestors of the selected object
|
||||
function getContextualPath() {
|
||||
var currentObj = $scope.ngModel && $scope.ngModel.selectedObject,
|
||||
var currentObj,
|
||||
currentParent,
|
||||
parents = [];
|
||||
|
||||
if ($scope.ngModel && $scope.ngModel.inspectionObjects) {
|
||||
currentObj = $scope.ngModel.inspectionObjects[0];
|
||||
} else {
|
||||
currentObj = $scope.ngModel && $scope.ngModel.selectedObject;
|
||||
}
|
||||
|
||||
currentParent = currentObj &&
|
||||
currentObj.hasCapability('context') &&
|
||||
currentObj.getCapability('context').getParent();
|
||||
@ -69,7 +75,12 @@ define(
|
||||
|
||||
// If this the the initial call of this recursive function
|
||||
if (!current) {
|
||||
current = $scope.ngModel.selectedObject;
|
||||
if ($scope.ngModel && $scope.ngModel.inspectionObjects) {
|
||||
current = $scope.ngModel.inspectionObjects[0];
|
||||
} else {
|
||||
current = $scope.ngModel && $scope.ngModel.selectedObject;
|
||||
}
|
||||
|
||||
$scope.primaryParents = [];
|
||||
}
|
||||
|
||||
@ -87,10 +98,17 @@ define(
|
||||
|
||||
// Gets the metadata for the selected object
|
||||
function getMetadata() {
|
||||
// We want to get info from the inspectionObjects, but otherwise just use
|
||||
// the selectedObject.
|
||||
if ($scope.ngModel && $scope.ngModel.inspectionObjects &&
|
||||
$scope.ngModel.inspectionObjects[0].hasCapability('metadata')) {
|
||||
$scope.metadata = $scope.ngModel.inspectionObjects[0].useCapability('metadata');
|
||||
} else {
|
||||
$scope.metadata = $scope.ngModel && $scope.ngModel.selectedObject &&
|
||||
$scope.ngModel.selectedObject.hasCapability('metadata') &&
|
||||
$scope.ngModel.selectedObject.useCapability('metadata');
|
||||
}
|
||||
}
|
||||
|
||||
// Set scope variables when the selected object changes
|
||||
$scope.$watch('ngModel.selectedObject', function () {
|
||||
@ -109,6 +127,23 @@ define(
|
||||
|
||||
getMetadata();
|
||||
});
|
||||
|
||||
$scope.$watch('ngModel.inspectionObjects[0]', function () {
|
||||
var isLink = $scope && $scope.ngModel &&
|
||||
$scope.ngModel.inspectionObjects &&
|
||||
$scope.ngModel.inspectionObjects[0].hasCapability('location') &&
|
||||
$scope.ngModel.inspectionObjects[0].getCapability('location').isLink();
|
||||
|
||||
if (isLink) {
|
||||
getPrimaryPath();
|
||||
getContextualPath();
|
||||
} else {
|
||||
$scope.primaryParents = [];
|
||||
getContextualPath();
|
||||
}
|
||||
|
||||
getMetadata();
|
||||
});
|
||||
}
|
||||
|
||||
return ObjectInspectorController;
|
||||
|
@ -30,12 +30,15 @@
|
||||
<span class='plot-legend-item'
|
||||
ng-repeat="telemetryObject in subplot.getTelemetryObjects()"
|
||||
ng-class="plot.getLegendClass(telemetryObject)"
|
||||
ng-click="ngModel.selectedObject = telemetryObject">
|
||||
ng-click="ngModel.inspectionObjects[0] = telemetryObject">
|
||||
<span class='plot-color-swatch'
|
||||
ng-style="{ 'background-color': plot.getColor($index) }">
|
||||
</span>
|
||||
<span class='title-label'>{{telemetryObject.getModel().name}}</span>
|
||||
</span>
|
||||
|
||||
<!--{{ log(domainObject.getModel()); log(selectedObject.getModel()) }}-->
|
||||
{{ log(ngModel.inspectionObjects[0].getModel()); log(ngModel.selectedObject.getModel()) }}
|
||||
</div>
|
||||
|
||||
<div
|
||||
|
Loading…
Reference in New Issue
Block a user