mirror of
https://github.com/nasa/openmct.git
synced 2025-06-18 07:08:12 +00:00
[Edit] Refresh Library less aggressively
Update the root object (used to populate the Library pane) less often, to avoid recreating the whole tree and thereby causing the tree to collapse. WTD-788.
This commit is contained in:
@ -16,6 +16,11 @@
|
|||||||
"key": "EditActionController",
|
"key": "EditActionController",
|
||||||
"implementation": "EditActionController.js",
|
"implementation": "EditActionController.js",
|
||||||
"depends": [ "$scope" ]
|
"depends": [ "$scope" ]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "EditPanesController",
|
||||||
|
"implementation": "controllers/EditPanesController.js",
|
||||||
|
"depends": [ "$scope" ]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"actions": [
|
"actions": [
|
||||||
@ -72,7 +77,7 @@
|
|||||||
{
|
{
|
||||||
"key": "edit-object",
|
"key": "edit-object",
|
||||||
"templateUrl": "templates/edit-object.html",
|
"templateUrl": "templates/edit-object.html",
|
||||||
"uses": [ "view", "context" ]
|
"uses": [ "view" ]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"key": "edit-action-buttons",
|
"key": "edit-action-buttons",
|
||||||
|
@ -18,10 +18,13 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="splitter"></div>
|
<div class="splitter"></div>
|
||||||
<div class='abs pane right edit-objects menus-to-left'>
|
<div class='abs pane right edit-objects menus-to-left'>
|
||||||
<div class='holder abs split-layout horizontal'>
|
<div class='holder abs split-layout horizontal'
|
||||||
|
ng-controller='EditPanesController as editPanes'>
|
||||||
<div class="abs pane top accordion" ng-controller="ToggleController as toggle">
|
<div class="abs pane top accordion" ng-controller="ToggleController as toggle">
|
||||||
<mct-container key="accordion" title="Library">
|
<mct-container key="accordion" title="Library">
|
||||||
<mct-representation key="'tree'" alias="foo1" mct-object="context.getRoot()">
|
<mct-representation key="'tree'"
|
||||||
|
alias="foo1"
|
||||||
|
mct-object="editPanes.getRoot()">
|
||||||
</mct-representation>
|
</mct-representation>
|
||||||
</mct-container>
|
</mct-container>
|
||||||
</div>
|
</div>
|
||||||
|
@ -0,0 +1,47 @@
|
|||||||
|
/*global define*/
|
||||||
|
|
||||||
|
define(
|
||||||
|
[],
|
||||||
|
function () {
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Supports the Library and Elements panes in Edit mode.
|
||||||
|
* @constructor
|
||||||
|
*/
|
||||||
|
function EditPanesController($scope) {
|
||||||
|
var root;
|
||||||
|
|
||||||
|
// Update root object based on represented object
|
||||||
|
function updateRoot(domainObject) {
|
||||||
|
var context = domainObject &&
|
||||||
|
domainObject.getCapability('context'),
|
||||||
|
newRoot = context && context.getRoot(),
|
||||||
|
oldId = root && root.getId(),
|
||||||
|
newId = newRoot && newRoot.getId();
|
||||||
|
|
||||||
|
// Only update if this has actually changed,
|
||||||
|
// to avoid excessive refreshing.
|
||||||
|
if (oldId !== newId) {
|
||||||
|
root = newRoot;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update root when represented object changes
|
||||||
|
$scope.$watch('domainObject', updateRoot);
|
||||||
|
|
||||||
|
return {
|
||||||
|
/**
|
||||||
|
* Get the root-level domain object, as reported by the
|
||||||
|
* represented domain object.
|
||||||
|
* @returns {DomainObject} the root object
|
||||||
|
*/
|
||||||
|
getRoot: function () {
|
||||||
|
return root;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
return EditPanesController;
|
||||||
|
}
|
||||||
|
);
|
Reference in New Issue
Block a user