mirror of
https://github.com/nasa/openmct.git
synced 2025-06-19 23:53:49 +00:00
[Forms] Update selector controller
Update controller for domain object selector, for WTD-987.
This commit is contained in:
@ -88,6 +88,11 @@
|
|||||||
{
|
{
|
||||||
"key": "SplitPaneController",
|
"key": "SplitPaneController",
|
||||||
"implementation": "controllers/SplitPaneController.js"
|
"implementation": "controllers/SplitPaneController.js"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "SelectorController",
|
||||||
|
"implementation": "controllers/SelectorController.js",
|
||||||
|
"depends": [ "objectService", "$scope" ]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"directives": [
|
"directives": [
|
||||||
@ -185,6 +190,12 @@
|
|||||||
"uses": [ "view" ]
|
"uses": [ "view" ]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
"controls": [
|
||||||
|
{
|
||||||
|
"key": "selector",
|
||||||
|
"templateUrl": "templates/controls/selector.html"
|
||||||
|
}
|
||||||
|
],
|
||||||
"licenses": [
|
"licenses": [
|
||||||
{
|
{
|
||||||
"name": "Modernizr",
|
"name": "Modernizr",
|
||||||
|
@ -22,11 +22,11 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class='col col-2'>
|
<div class='col col-2'>
|
||||||
<div class='btn-holder valign-mid btns-add-remove'>
|
<div class='btn-holder valign-mid btns-add-remove'>
|
||||||
<a class='btn major' href=''
|
<a class='btn major'
|
||||||
ng-click="selector.select(selector.treeModel.selectedObject)">
|
ng-click="selector.select(selector.treeModel.selectedObject)">
|
||||||
<span class='ui-symbol'>></span>
|
<span class='ui-symbol'>></span>
|
||||||
</a>
|
</a>
|
||||||
<a class='btn major' href=''
|
<a class='btn major'
|
||||||
ng-click="selector.deselect(selector.listModel.selectedObject)">
|
ng-click="selector.deselect(selector.listModel.selectedObject)">
|
||||||
<span class='ui-symbol'><</span>
|
<span class='ui-symbol'><</span>
|
||||||
</a>
|
</a>
|
||||||
|
@ -28,7 +28,7 @@ define(
|
|||||||
|
|
||||||
// Get the value of the field being edited
|
// Get the value of the field being edited
|
||||||
function getField() {
|
function getField() {
|
||||||
return $scope.ngModel[$scope.field];
|
return $scope.ngModel[$scope.field] || [];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the value of the field being edited
|
// Get the value of the field being edited
|
||||||
@ -65,7 +65,7 @@ define(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Look up objects by id, then populate right-hand list
|
// Look up objects by id, then populate right-hand list
|
||||||
objectService.get(ids).then(updateSelectedObjects);
|
objectService.getObjects(ids).then(updateSelectedObjects);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reject attempts to select objects of the wrong type
|
// Reject attempts to select objects of the wrong type
|
||||||
@ -75,7 +75,7 @@ define(
|
|||||||
$scope.$watchCollection(getField, updateList);
|
$scope.$watchCollection(getField, updateList);
|
||||||
|
|
||||||
// Look up root object, then store it
|
// Look up root object, then store it
|
||||||
objectService.get(ROOT_ID).then(storeRoot);
|
objectService.getObjects([ROOT_ID]).then(storeRoot);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
/**
|
/**
|
||||||
@ -112,8 +112,17 @@ define(
|
|||||||
setField(list.filter(function (otherId) {
|
setField(list.filter(function (otherId) {
|
||||||
return otherId !== id;
|
return otherId !== id;
|
||||||
}));
|
}));
|
||||||
|
// Clear the current list selection
|
||||||
|
delete listModel.selectedObject;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
/**
|
||||||
|
* Get the currently-selected domain objects.
|
||||||
|
* @returns {DomainObject[]} the current selection
|
||||||
|
*/
|
||||||
|
selected: function () {
|
||||||
|
return selectedObjects;
|
||||||
|
},
|
||||||
// Expose tree/list model for use in template directly
|
// Expose tree/list model for use in template directly
|
||||||
treeModel: treeModel,
|
treeModel: treeModel,
|
||||||
listModel: listModel
|
listModel: listModel
|
||||||
|
Reference in New Issue
Block a user