mirror of
https://github.com/nasa/openmct.git
synced 2025-01-30 16:13:53 +00:00
[Tree] Show tree with toggle
This commit is contained in:
parent
d4b15525ca
commit
dc2b3e85cc
3
main.js
3
main.js
@ -45,6 +45,9 @@ requirejs.config({
|
|||||||
},
|
},
|
||||||
"moment-duration-format": {
|
"moment-duration-format": {
|
||||||
"deps": [ "moment" ]
|
"deps": [ "moment" ]
|
||||||
|
},
|
||||||
|
"zepto": {
|
||||||
|
"exports": "Zepto"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -1,8 +1,4 @@
|
|||||||
<span class="tree-item menus-to-left">
|
<span class="tree-item menus-to-left">
|
||||||
<span class='ui-symbol view-control flex-elem'>
|
|
||||||
</span>
|
|
||||||
<span class="rep-object-label">
|
|
||||||
</span>
|
|
||||||
</span>
|
</span>
|
||||||
<span class="tree-item-subtree">
|
<span class="tree-item-subtree">
|
||||||
</span>
|
</span>
|
||||||
|
@ -36,6 +36,11 @@ define([
|
|||||||
return type.getGlyph();
|
return type.getGlyph();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isLink(domainObject) {
|
||||||
|
var location = domainObject.getCapability('location');
|
||||||
|
return location.isLink();
|
||||||
|
}
|
||||||
|
|
||||||
TreeLabelView.prototype.updateView = function (domainObject) {
|
TreeLabelView.prototype.updateView = function (domainObject) {
|
||||||
var titleEl = this.el.find('.t-title-label'),
|
var titleEl = this.el.find('.t-title-label'),
|
||||||
glyphEl = this.el.find('.t-item-icon-glyph'),
|
glyphEl = this.el.find('.t-item-icon-glyph'),
|
||||||
|
@ -24,8 +24,9 @@
|
|||||||
define([
|
define([
|
||||||
'angular',
|
'angular',
|
||||||
'text!../../res/templates/tree/node.html',
|
'text!../../res/templates/tree/node.html',
|
||||||
'./ToggleView'
|
'./ToggleView',
|
||||||
], function (angular, nodeTemplate, ToggleView) {
|
'./TreeLabelView'
|
||||||
|
], function (angular, nodeTemplate, ToggleView, TreeLabelView) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var $ = angular.element.bind(angular);
|
var $ = angular.element.bind(angular);
|
||||||
@ -45,13 +46,16 @@ define([
|
|||||||
$(this.subtreeView.elements()).addClass('hidden');
|
$(this.subtreeView.elements()).addClass('hidden');
|
||||||
}
|
}
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
}
|
|
||||||
|
|
||||||
TreeNodeView.prototype.populateContents = function (domainObject) {
|
this.labelView = new TreeLabelView();
|
||||||
if (this.li.children().length === 0) {
|
|
||||||
this.li.append($(nodeTemplate));
|
this.li.append($(nodeTemplate));
|
||||||
|
this.li.find('span').eq(0)
|
||||||
|
.append(this.toggleView.elements())
|
||||||
|
.append(this.labelView.elements());
|
||||||
|
|
||||||
|
this.model(undefined);
|
||||||
}
|
}
|
||||||
};
|
|
||||||
|
|
||||||
TreeNodeView.prototype.model = function (domainObject) {
|
TreeNodeView.prototype.model = function (domainObject) {
|
||||||
if (this.unlisten) {
|
if (this.unlisten) {
|
||||||
@ -60,14 +64,13 @@ define([
|
|||||||
|
|
||||||
this.activeObject = domainObject;
|
this.activeObject = domainObject;
|
||||||
|
|
||||||
if (domainObject) {
|
if (domainObject && domainObject.hasCapability('composition')) {
|
||||||
this.unlisten = domainObject.getCapability('mutation')
|
$(this.toggleView.elements()).addClass('has-children');
|
||||||
.listen(this.populateContents.bind(this));
|
|
||||||
this.populateContents(domainObject);
|
|
||||||
} else {
|
} else {
|
||||||
this.li.empty();
|
$(this.toggleView.elements()).removeClass('has-children');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.labelView.model(domainObject);
|
||||||
if (this.subtreeView) {
|
if (this.subtreeView) {
|
||||||
this.subtreeView.model(domainObject);
|
this.subtreeView.model(domainObject);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user