[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:
slhale 2015-08-27 11:28:27 -07:00
parent 01f5a4886b
commit bcf6bbf627
4 changed files with 48 additions and 7 deletions

View File

@ -143,6 +143,9 @@ define(
$scope.treeModel = { $scope.treeModel = {
selectedObject: navigationService.getNavigation() 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. // Listen for changes in navigation state.
navigationService.addListener(setNavigation); navigationService.addListener(setNavigation);

View File

@ -36,7 +36,7 @@
key="'label'" key="'label'"
mct-object="domainObject" mct-object="domainObject"
ng-model="ngModel" ng-model="ngModel"
ng-click="ngModel.selectedObject = domainObject" ng-click="ngModel.selectedObject = domainObject; ngModel.inspectionObjects = []; ngModel.inspectionObjects[0] = domainObject"
> >
</mct-representation> </mct-representation>
</span> </span>

View File

@ -41,10 +41,16 @@ define(
// Gets an array of the contextual parents/anscestors of the selected object // Gets an array of the contextual parents/anscestors of the selected object
function getContextualPath() { function getContextualPath() {
var currentObj = $scope.ngModel && $scope.ngModel.selectedObject, var currentObj,
currentParent, currentParent,
parents = []; parents = [];
if ($scope.ngModel && $scope.ngModel.inspectionObjects) {
currentObj = $scope.ngModel.inspectionObjects[0];
} else {
currentObj = $scope.ngModel && $scope.ngModel.selectedObject;
}
currentParent = currentObj && currentParent = currentObj &&
currentObj.hasCapability('context') && currentObj.hasCapability('context') &&
currentObj.getCapability('context').getParent(); currentObj.getCapability('context').getParent();
@ -69,7 +75,12 @@ define(
// If this the the initial call of this recursive function // If this the the initial call of this recursive function
if (!current) { 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 = []; $scope.primaryParents = [];
} }
@ -87,9 +98,16 @@ define(
// Gets the metadata for the selected object // Gets the metadata for the selected object
function getMetadata() { function getMetadata() {
$scope.metadata = $scope.ngModel && $scope.ngModel.selectedObject && // We want to get info from the inspectionObjects, but otherwise just use
$scope.ngModel.selectedObject.hasCapability('metadata') && // the selectedObject.
$scope.ngModel.selectedObject.useCapability('metadata'); 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 // Set scope variables when the selected object changes
@ -109,6 +127,23 @@ define(
getMetadata(); 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; return ObjectInspectorController;

View File

@ -30,12 +30,15 @@
<span class='plot-legend-item' <span class='plot-legend-item'
ng-repeat="telemetryObject in subplot.getTelemetryObjects()" ng-repeat="telemetryObject in subplot.getTelemetryObjects()"
ng-class="plot.getLegendClass(telemetryObject)" ng-class="plot.getLegendClass(telemetryObject)"
ng-click="ngModel.selectedObject = telemetryObject"> ng-click="ngModel.inspectionObjects[0] = telemetryObject">
<span class='plot-color-swatch' <span class='plot-color-swatch'
ng-style="{ 'background-color': plot.getColor($index) }"> ng-style="{ 'background-color': plot.getColor($index) }">
</span> </span>
<span class='title-label'>{{telemetryObject.getModel().name}}</span> <span class='title-label'>{{telemetryObject.getModel().name}}</span>
</span> </span>
<!--{{ log(domainObject.getModel()); log(selectedObject.getModel()) }}-->
{{ log(ngModel.inspectionObjects[0].getModel()); log(ngModel.selectedObject.getModel()) }}
</div> </div>
<div <div