function renderPlugin_dmraid(data) {
function raid_diskicon(data) {
var html = "";
var img = "", alt = "";
html += "
";
switch (data["Status"]) {
case " ":
case "":
img = "harddriveok.png";
alt = "ok";
break;
case "F":
img = "harddrivefail.png";
alt = "fail";
break;
case "S":
img = "harddrivespare.png";
alt = "spare";
break;
case "W":
img = "harddrivewarn.png";
alt = "warning";
break;
default:
alert("--" + data["Status"] + "--");
img = "error.png";
alt = "error";
break;
}
html += "
";
html += "
" + data["Name"] + "";
html += "
";
return html;
}
if (data['Plugins']['Plugin_DMRaid'] !== undefined) {
var dmitems = items(data['Plugins']['Plugin_DMRaid']['Raid']);
if (dmitems.length > 0) {
var html = '';
for (i = 0; i < dmitems.length ; i++) {
if (i) {
html += " | ";
} else {
html += " |
RAID-Devices | ";
}
if (dmitems[i]['Disks'] !== undefined) {
html += "";
html += "";
var diskitems = items(dmitems[i]['Disks']['Disk']);
for (j = 0; j < diskitems.length ; j++) {
html += raid_diskicon(diskitems[j]["@attributes"]);
}
html += " | ";
html += "";
html += "" + dmitems[i]["@attributes"]["Device_Name"] + " | | ";
html += "Name | " + dmitems[i]["@attributes"]["Name"] + " | ";
html += "Status | " + dmitems[i]["@attributes"]["Disk_Status"] + " | ";
html += "RAID-Type | " + dmitems[i]["@attributes"]["Type"] + " | ";
html += "Size | " + parseInt(dmitems[i]["@attributes"]["Size"]) + " | ";
html += "Stride | " + parseInt(dmitems[i]["@attributes"]["Stride"]) + " | ";
html += "Subsets | " + parseInt(dmitems[i]["@attributes"]["Subsets"]) + " | ";
html += "Devices | " + parseInt(dmitems[i]["@attributes"]["Devs"]) + " | ";
html += "Spares | " + parseInt(dmitems[i]["@attributes"]["Spares"]) + " | ";
html += " ";
html += " | ";
html += " ";
}
html +=" |
";
}
$('#dmraid').empty().append(html);
for (i = 0; i < dmitems.length ; i++) {
if (dmitems[i]['Disks'] !== undefined) {
$('#dmraid-'+i).treegrid({
initialState: 'collapsed',
expanderExpandedClass: 'normalicon normalicon-down',
expanderCollapsedClass: 'normalicon normalicon-right'
});
}
}
$('#block_dmraid').show();
} else {
$('#block_dmraid').hide();
}
} else {
$('#block_dmraid').hide();
}
}