Object has no children fix (#2038)

* Added files for PR 1904

* Added new lines

* space fix

* Implemented changes

* Space fix

* checkstyle fix

Fixes #1826
This commit is contained in:
Aayush Arora (angularboy)
2018-06-30 00:27:45 +05:30
committed by Pete Richards
parent b8f278cabf
commit eaa9514453
5 changed files with 24 additions and 19 deletions

View File

@@ -27,9 +27,9 @@ define([
'./TreeLabelView'
], function ($, nodeTemplate, ToggleView, TreeLabelView) {
function TreeNodeView(gestureService, subtreeFactory, selectFn) {
function TreeNodeView(gestureService, subtreeFactory, selectFn, openmct) {
this.li = $('<li>');
this.openmct = openmct;
this.statusClasses = [];
this.toggleView = new ToggleView(false);
@@ -81,11 +81,14 @@ define([
}
this.activeObject = domainObject;
if (domainObject && domainObject.hasCapability('composition')) {
$(this.toggleView.elements()).removeClass('no-children');
} else {
$(this.toggleView.elements()).addClass('no-children');
if (domainObject && domainObject.hasCapability('adapter')) {
var obj = domainObject.useCapability('adapter');
var hasComposition = this.openmct.composition.get(obj) !== undefined;
if (hasComposition) {
$(this.toggleView.elements()).removeClass('no-children');
} else {
$(this.toggleView.elements()).addClass('no-children');
}
}
if (domainObject && domainObject.hasCapability('status')) {
@@ -150,6 +153,5 @@ define([
return this.li;
};
return TreeNodeView;
});