function renderPlugin_ps(data) {
var directives = {
MemoryUsage: {
html: function () {
return '
' + this.MemoryUsage + '%
';
}
},
CPUUsage: {
html: function () {
return '' + this.CPUUsage + '%
';
}
},
Name: {
html: function () {
return this.Name.replace(/AAAAAAAA/g, "AAAAAAAA").replace(/,/g, ",").replace(/\s/g, " ").replace(/\./g, ".").replace(/-/g, "-").replace(/\//g, "/"); /* split long name */
}
}
};
if (data.Plugins.Plugin_PS !== undefined) {
var psitems = items(data.Plugins.Plugin_PS.Process);
if (psitems.length > 0) {
var html = "", ps_item = [], expanded = 0, memwas = false, cpuwas = false;
for (var i = 0; i < psitems.length ; i++) {
ps_item = psitems[i]["@attributes"];
if (ps_item.ParentID === "0") {
html+="";
} else {
html+="
";
}
html+=" | ";
html+=" | ";
html+=" | ";
html+=" | ";
html+=" | ";
html+="
";
}
$("#ps-data").empty().append(html);
$('#ps').treegrid({
initialState: 'expanded',
expanderExpandedClass: 'normalicon normalicon-down',
expanderCollapsedClass: 'normalicon normalicon-right'
});
for (var j = 0; j < psitems.length ; j++) {
ps_item = psitems[j]["@attributes"];
$('#ps-'+(j+1)).render(ps_item, directives);
if (!memwas && (ps_item.MemoryUsage !== undefined)) {
memwas = true;
}
if (!cpuwas && (ps_item.CPUUsage !== undefined)) {
cpuwas = true;
}
expanded = ps_item.Expanded;
if ((expanded !== undefined) && (expanded === "0")) {
$('#ps-'+(j+1)).treegrid('collapse');
}
}
if (memwas) {
$('#ps td:nth-child(4),#ps th:nth-child(4)').show();
} else {
$('#ps td:nth-child(4),#ps th:nth-child(4)').hide();
}
if (cpuwas) {
$('#ps td:nth-child(5),#ps th:nth-child(5)').show();
} else {
$('#ps td:nth-child(5),#ps th:nth-child(5)').hide();
}
$('#block_ps').show();
} else {
$('#block_ps').hide();
}
} else {
$('#block_ps').hide();
}
}