* Mon May 12 2025 Brian Read <brianr@koozali.org> 11.0.0-1.sme
- Adding SM2 panel [SME: 13004] - Upgrade to phpsysinfo 3.4.4 - Add code to delete inline styles and add css to make it look better. - version saved / built uses the static version, which means no drops downs and choices.
This commit is contained in:
@@ -32,43 +32,69 @@ var ps_show = false;
|
||||
* @param {jQuery} xml plugin-XML
|
||||
*/
|
||||
function ps_buildTable(xml) {
|
||||
var html = "", tree = [], closed = [2];
|
||||
var html = "", tree = [], closed = [], memwas = false, cpuwas = false, hostname = "";
|
||||
|
||||
$("#Plugin_PS #Plugin_PSTable").remove();
|
||||
|
||||
html += " <table id=\"Plugin_PSTable\" class=\"tablemain\" style=\"width:100%;\">\n";
|
||||
html += " <thead>\n";
|
||||
html += " <tr>\n";
|
||||
html += " <th>" + genlang(3, false, "PS") + "</th>\n";
|
||||
html += " <th style=\"width:80px;\">" + genlang(4, false, "PS") + "</th>\n";
|
||||
html += " <th style=\"width:80px;\">" + genlang(5, false, "PS") + "</th>\n";
|
||||
html += " <th style=\"width:110px;\">" + genlang(6, false, "PS") + "</th>\n";
|
||||
html += " </tr>\n";
|
||||
html += " </thead>\n";
|
||||
html += " <tbody class=\"tree\">\n";
|
||||
hostname = $("Plugins Plugin_PS", xml).attr('Hostname');
|
||||
if (hostname !== undefined) {
|
||||
$('span[class=Hostname_PS]').html(hostname);
|
||||
}
|
||||
|
||||
html += " <div style=\"overflow-x:auto;\">\n";
|
||||
html += " <table id=\"Plugin_PSTable\" class=\"tablemain\">\n";
|
||||
html += " <thead>\n";
|
||||
html += " <tr>\n";
|
||||
html += " <th>" + genlang(2, "PS") + "</th>\n";
|
||||
html += " <th style=\"width:6.6%;\">" + genlang(3, "PS") + "</th>\n";
|
||||
html += " <th style=\"width:6.6%;\">" + genlang(4, "PS") + "</th>\n";
|
||||
html += " <th style=\"width:15.25%;\">" + genlang(5, "PS") + "</th>\n";
|
||||
html += " <th style=\"width:15.25%;\">" + genlang(6, "PS") + "</th>\n";
|
||||
html += " </tr>\n";
|
||||
html += " </thead>\n";
|
||||
html += " <tbody class=\"tree\">\n";
|
||||
|
||||
$("Plugins Plugin_PS Process", xml).each(function ps_getprocess(id) {
|
||||
var close = 0, pid = 0, ppid = 0, name = "", percent = 0, parentId = 0, expanded = 0;
|
||||
name = $(this).attr("Name");
|
||||
var close = 0, pid = 0, ppid = 0, name = "", percent = 0, parentId = 0, expanded = 0, cpu = 0;
|
||||
name = $(this).attr("Name").replace(/AAAAAAAA/g, "A<wbr>A<wbr>A<wbr>A<wbr>A<wbr>A<wbr>A<wbr>A<wbr>").replace(/,/g, ",<wbr>").replace(/\s/g, " <wbr>").replace(/\./g, ".<wbr>").replace(/-/g, "<wbr>-").replace(/\//g, "<wbr>/"); /* split long name */
|
||||
parentId = parseInt($(this).attr("ParentID"), 10);
|
||||
pid = parseInt($(this).attr("PID"), 10);
|
||||
ppid = parseInt($(this).attr("PPID"), 10);
|
||||
percent = parseInt($(this).attr("MemoryUsage"), 10);
|
||||
cpu = parseInt($(this).attr("CPUUsage"), 10);
|
||||
expanded = parseInt($(this).attr("Expanded"), 10);
|
||||
|
||||
html += " <tr><td>" + name + "</td><td>" + pid + "</td><td>" + ppid + "</td><td>" + createBar(percent) + "</td></tr>\n";
|
||||
html += " <tr><td><div class=\"treediv\"><span class=\"treespan\">" + name + "</div></span></td><td>" + pid + "</td><td>" + ppid + "</td><td>" + createBar(percent) + "</td><td>" + createBar(cpu) + "</td></tr>\n";
|
||||
close = tree.push(parentId);
|
||||
if (!isNaN(expanded) && (expanded === 0)) {
|
||||
closed.push(close);
|
||||
}
|
||||
if (!memwas && !isNaN(percent)) {
|
||||
memwas = true;
|
||||
}
|
||||
if (!cpuwas && !isNaN(cpu)) {
|
||||
cpuwas = true;
|
||||
}
|
||||
ps_show = true;
|
||||
});
|
||||
|
||||
html += " </tbody>\n";
|
||||
html += " </table>\n";
|
||||
html += " </tbody>\n";
|
||||
html += " </table>\n";
|
||||
html += " </div>\n";
|
||||
|
||||
$("#Plugin_PS").append(html);
|
||||
|
||||
if (memwas) {
|
||||
$('#Plugin_PSTable td:nth-child(4),#Plugin_PSTable th:nth-child(4)').show();
|
||||
} else {
|
||||
$('#Plugin_PSTable td:nth-child(4),#Plugin_PSTable th:nth-child(4)').hide();
|
||||
}
|
||||
if (cpuwas) {
|
||||
$('#Plugin_PSTable td:nth-child(5),#Plugin_PSTable th:nth-child(5)').show();
|
||||
} else {
|
||||
$('#Plugin_PSTable td:nth-child(5),#Plugin_PSTable th:nth-child(5)').hide();
|
||||
}
|
||||
|
||||
$("#Plugin_PSTable").jqTreeTable(tree, {
|
||||
openImg: "./gfx/treeTable/tv-collapsable.gif",
|
||||
shutImg: "./gfx/treeTable/tv-expandable.gif",
|
||||
@@ -90,6 +116,7 @@ function ps_buildTable(xml) {
|
||||
* load the xml via ajax
|
||||
*/
|
||||
function ps_request() {
|
||||
$("#Reload_PSTable").attr("title", "reload");
|
||||
$.ajax({
|
||||
url: "xml.php?plugin=PS",
|
||||
dataType: "xml",
|
||||
@@ -109,12 +136,12 @@ function ps_request() {
|
||||
|
||||
$(document).ready(function ps_buildpage() {
|
||||
$("#footer").before(buildBlock("PS", 1, true));
|
||||
$("#Plugin_PS").css("width", "915px");
|
||||
$("#Plugin_PS").addClass("fullsize");
|
||||
|
||||
ps_request();
|
||||
|
||||
$("#Reload_PSTable").click(function ps_reload(id) {
|
||||
ps_request();
|
||||
$("#Reload_PSTable").attr("title",datetime());
|
||||
$(this).attr("title", datetime());
|
||||
});
|
||||
});
|
||||
|
@@ -3,30 +3,77 @@ function renderPlugin_ps(data) {
|
||||
var directives = {
|
||||
MemoryUsage: {
|
||||
html: function () {
|
||||
return '<div class="progress"><div class="progress-bar progress-bar-info" style="width: ' + this["MemoryUsage"] + '%;"></div>' +
|
||||
'</div><div class="percent">' + this["MemoryUsage"] + '%</div>';
|
||||
return '<div class="progress"><div class="progress-bar progress-bar-info" style="width:' + this.MemoryUsage + '%;"></div>' +
|
||||
'</div><div class="percent">' + this.MemoryUsage + '%</div>';
|
||||
}
|
||||
},
|
||||
CPUUsage: {
|
||||
html: function () {
|
||||
return '<div class="progress"><div class="progress-bar progress-bar-info" style="width:' + this.CPUUsage + '%;"></div>' +
|
||||
'</div><div class="percent">' + this.CPUUsage + '%</div>';
|
||||
}
|
||||
},
|
||||
Name: {
|
||||
html: function () {
|
||||
return this["Name"];
|
||||
return this.Name.replace(/AAAAAAAA/g, "A<wbr>A<wbr>A<wbr>A<wbr>A<wbr>A<wbr>A<wbr>A<wbr>").replace(/,/g, ",<wbr>").replace(/\s/g, " <wbr>").replace(/\./g, ".<wbr>").replace(/-/g, "<wbr>-").replace(/\//g, "<wbr>/"); /* split long name */
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
if (data['Plugins']['Plugin_PS'] !== undefined) {
|
||||
var psitems = items(data['Plugins']['Plugin_PS']['Process']);
|
||||
if (data.Plugins.Plugin_PS !== undefined) {
|
||||
var psitems = items(data.Plugins.Plugin_PS.Process);
|
||||
if (psitems.length > 0) {
|
||||
var ps_memory = [];
|
||||
var ps_item = [];
|
||||
for (i = 0; i < psitems.length ; i++) {
|
||||
|
||||
var html = "", ps_item = [], expanded = 0, memwas = false, cpuwas = false;
|
||||
for (var i = 0; i < psitems.length ; i++) {
|
||||
ps_item = psitems[i]["@attributes"];
|
||||
ps_item["number"] = i + 1;
|
||||
ps_memory.push(ps_item);
|
||||
|
||||
if (ps_item.ParentID === "0") {
|
||||
html+="<tr id=\"ps-" + (i+1) + "\" class=\"treegrid-ps-" + (i+1) + "\" style=\"display:none;\" >";
|
||||
} else {
|
||||
html+="<tr id=\"ps-" + (i+1) + "\" class=\"treegrid-ps-" + (i+1) + " treegrid-parent-ps-" + ps_item.ParentID + "\" style=\"display:none;\" >";
|
||||
}
|
||||
html+="<td><span class=\"treegrid-span\" data-bind=\"Name\"></span></td>";
|
||||
html+="<td><span data-bind=\"PID\"></span></td>";
|
||||
html+="<td><span data-bind=\"PPID\"></span></td>";
|
||||
html+="<td style=\"width:10%;\"><span data-bind=\"MemoryUsage\"></span></td>";
|
||||
html+="<td style=\"width:10%;\"><span data-bind=\"CPUUsage\"></span></td>";
|
||||
html+="</tr>";
|
||||
}
|
||||
|
||||
$("#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();
|
||||
}
|
||||
$('#ps-data').render(ps_memory, directives);
|
||||
$('#ps_number').removeClass("sorttable_sorted"); // reset sort order
|
||||
sorttable.innerSortFunction.apply($('#ps_number')[0], []);
|
||||
|
||||
$('#block_ps').show();
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user