asysmon-res.js.ctrl-envvar.js Maven / Gradle / Ivy
angular.module('ASysMonApp').controller('CtrlEnvVar', function($scope, $log, Rest, escapeHtml) {
$('.btn').tooltip({
container: 'body',
html: true
});
var rootLevel = 0;
var nodesByFqn = {};
function initFromResponse(data) {
reorder(data.envTree);
$scope.envTree = data.envTree;
nodesByFqn = {};
initTreeNodes($scope.envTree, 0, '');
$('#theTree').html(htmlForAllTrees());
$('.data-row.with-children')
.click(function() {
var fqn = $(this).children('.fqn-holder').text();
var childrenDiv = $(this).next();
var nodeIconDiv = $(this).children('.node-icon');
var isExpanded = nodeIconDiv.hasClass('node-icon-expanded');
childrenDiv.slideToggle(50, function() {
if(isExpanded) {
nodeIconDiv.addClass('node-icon-collapsed').removeClass('node-icon-expanded');
}
else {
nodeIconDiv.removeClass('node-icon-collapsed').addClass('node-icon-expanded');
}
});
});
expandFirstNode();
}
function expandFirstNode() {
var dataRow = $('.data-row-0').first();
var childrenDiv = dataRow.next();
var nodeIconDiv = dataRow.children('.node-icon');
childrenDiv.show();
nodeIconDiv.addClass('node-icon-expanded').removeClass('node-icon-collapsed');
}
function reorder(rootNodes) {
for(var i=0; i' +
htmlForTreeNode(rootNode) +
'