function renderPlugin_raid(data) { function raid_buildaction(data) { var html = "", name = "", percent = 0; if (data !== undefined) { name = data.Name; if ((name !== undefined) && (parseInt(name, 10) !== -1)) { percent = Math.round(parseFloat(data.Percent)); html += "
" + genlang(11,'raid') + ":" + String.fromCharCode(160) + name + "
"; html += '
' + '
' + '
' + percent + '%
 
'; if ((data.Time_To_Finish !== undefined) && (data.Time_Unit !== undefined)) { html += genlang(12,'raid') + ":" + String.fromCharCode(160) + data.Time_To_Finish + String.fromCharCode(160) + data.Time_Unit; } html += "
"; } } return html; } function raid_diskicon(data , id, itemid, byteFormat, tempFormat) { var info = data.Info; if (info === undefined) info = ""; var parentid = parseInt(data.ParentID, 10); var imgh = "", imgs = "", alt = "", bcolor = "", bus = "", cap = "", minfo = "", serial = ""; switch (data.Status) { case "ok": imgh = "harddriveok.png"; imgs = "soliddriveok.png"; alt = "ok"; bcolor = "green"; break; case "F": imgh = "harddrivefail.png"; imgs = "soliddrivefail.png"; alt = "fail"; bcolor = "red"; break; case "S": imgh = "harddrivespare.png"; imgs = "soliddrivespare.png"; alt = "spare"; bcolor = "gray"; break; case "U": imgh = "harddriveunc.png"; imgs = "soliddriveunc.png"; alt = "unconfigured"; bcolor = "purple"; break; case "W": imgh = "harddrivewarn.png"; imgs = "soliddrivewarn.png"; alt = "warning"; bcolor = "orange"; break; default: // alert("--" + diskstatus + "--"); imgh = "error.png"; imgs = "error.png"; alt = "error"; break; } if (!isNaN(parentid)) { if (data.Type !== undefined) { if (data.Model !== undefined) { minfo = "
" + data.Model; } if (data.Serial !== undefined) { minfo += "
" + data.Serial; } if (data.Bus === undefined) { bus = ""; } else { bus = data.Bus; } if (!isNaN(parseInt(data.Capacity, 10))) { cap = formatBytes(parseInt(data.Capacity, 10), byteFormat); } if ((bus !== "") || (cap !== "")) { minfo += "
" + $.trim(bus + " " + cap); } if (isFinite(parseFloat(data.Temperature))) { minfo += "
" + formatTemp(parseFloat(data.Temperature), tempFormat); } $("#raid_item" + id + "-" + parentid).append("
\""
" + data.Name + minfo + "
"); } else { if (parentid === 0) { $("#raid_list-" + id).append("
" + data.Name + "
"); } else { $("#raid_item" + id + "-" + parentid).append("
" + data.Name + "
"); } } } } if (data.Plugins.Plugin_Raid !== undefined) { var raiditems = items(data.Plugins.Plugin_Raid.Raid); if (raiditems.length > 0) { var html = ''; for (var i = 0; i < raiditems.length ; i++) { html += ""+raiditems[i]["@attributes"].Device_Name+""; if (raiditems[i].RaidItems !== undefined) { html += ""; html += ""; if (raiditems[i].Action !== undefined) { var buildedaction = raid_buildaction(raiditems[i].Action['@attributes']); if (buildedaction) { html += ""; } } html += ""; html += "
" + buildedaction + "
"; html += ""; html += ""; html += ""; // Program if (raiditems[i]["@attributes"].Name !== undefined) html += ""; // Name html += ""; // Status if (raiditems[i]["@attributes"].Level !== undefined) html += ""; // RAID-Level if (!isNaN(parseInt(raiditems[i]["@attributes"].Capacity, 10))) html += "";// Capacity if (!isNaN(parseInt(raiditems[i]["@attributes"].Stride, 10))) html += ""; // Stride if (!isNaN(parseInt(raiditems[i]["@attributes"].Subsets, 10))) html += ""; // Subsets if (raiditems[i]["@attributes"].Devs !== undefined) html += ""; // Devices if (!isNaN(parseInt(raiditems[i]["@attributes"].Spares, 10))) html += ""; // Spares if (!isNaN(parseInt(raiditems[i]["@attributes"].Chunk_Size, 10))) html += ""; if (!isNaN(parseInt(raiditems[i]["@attributes"].Stripe_Size, 10))) html += ""; if (raiditems[i]["@attributes"].Algorithm !== undefined) html += ""; if (!isNaN(parseInt(raiditems[i]["@attributes"].Persistend_Superblock, 10))) { if (parseInt(raiditems[i]["@attributes"].Persistend_Superblock, 10) == 1) { html += ""; } else { html += ""; } } if (!isNaN(parseInt(raiditems[i]["@attributes"].Disks_Registered, 10)) && !isNaN(parseInt(raiditems[i]["@attributes"].Disks_Active, 10))) { html += ""; } if (raiditems[i]["@attributes"].Controller !== undefined) html += ""; // Controller if (raiditems[i]["@attributes"].Firmware !== undefined) html += ""; // Firmware if (isFinite(parseFloat(raiditems[i]["@attributes"].Temperature))) html += ""; // Temperature if (raiditems[i]["@attributes"].Battery !== undefined) html += ""; // Battery Condition if (isFinite(parseFloat(raiditems[i]["@attributes"].Batt_Volt))) html += ""; // Battery Voltage if (isFinite(parseFloat(raiditems[i]["@attributes"].Batt_Temp))) html += ""; // Battery Temperature if (raiditems[i]["@attributes"].Supported !== undefined) html += ""; // Supported RAID-Types if (raiditems[i]["@attributes"].Cache_Size !== undefined) html += ""; // Cache_Size if (raiditems[i]["@attributes"].ReadPolicy !== undefined) html += ""; // Read Policy if (raiditems[i]["@attributes"].WritePolicy !== undefined) html += ""; // Write Policy if (raiditems[i]["@attributes"].Cachevault_Size !== undefined) html += ""; // Cachevault_Size if (raiditems[i]["@attributes"].DiskCache !== undefined) html += ""; // Disk Cache if (raiditems[i]["@attributes"].Bad_Blocks !== undefined) html += ""; // Bad_Blocks html += "
" + genlang(2, "raid") + "
"+genlang(22, 'raid')+"" + raiditems[i]["@attributes"].Program + "
"+genlang(3, 'raid')+"" + raiditems[i]["@attributes"].Name + "
"+genlang(4, 'raid')+"" + raiditems[i]["@attributes"].Status + "
"+genlang(5, 'raid')+"" + raiditems[i]["@attributes"].Level + "
"+genlang(6, 'raid')+"" + formatBytes(parseInt(raiditems[i]["@attributes"].Capacity, 10), data.Options["@attributes"].byteFormat) + "
"+genlang(7, 'raid')+"" + parseInt(raiditems[i]["@attributes"].Stride, 10) + "
"+genlang(8, 'raid')+"" + parseInt(raiditems[i]["@attributes"].Subsets, 10) + "
"+genlang(9, 'raid')+"" + parseInt(raiditems[i]["@attributes"].Devs, 10) + "
"+genlang(10, 'raid')+"" + parseInt(raiditems[i]["@attributes"].Spares, 10) + "
"+genlang(13, 'raid')+"" + formatBytes(1024*parseInt(raiditems[i]["@attributes"].Chunk_Size, 10), data.Options["@attributes"].byteFormat) + "
"+genlang(28, 'raid')+"" + formatBytes(parseInt(raiditems[i]["@attributes"].Stripe_Size, 10), data.Options["@attributes"].byteFormat) + "
"+genlang(14, 'raid')+"" + raiditems[i]["@attributes"].Algorithm + "
"+genlang(15, 'raid')+""+genlang(16, 'raid')+"
"+genlang(15, 'raid')+""+genlang(17, 'raid')+"
"+genlang(18, 'raid')+"" + parseInt(raiditems[i]["@attributes"].Disks_Registered, 10) + "/" + parseInt(raiditems[i]["@attributes"].Disks_Active, 10) + "
"+genlang(19, 'raid')+"" + raiditems[i]["@attributes"].Controller + "
"+genlang(29, 'raid')+"" + raiditems[i]["@attributes"].Firmware + "
"+genlang(30, 'raid')+"" + formatTemp(parseFloat(raiditems[i]["@attributes"].Temperature), data.Options["@attributes"].tempFormat) + "
"+genlang(20, 'raid')+"" + raiditems[i]["@attributes"].Battery + "
"+genlang(31, 'raid')+"" + round(parseFloat(raiditems[i]["@attributes"].Batt_Volt), 3) + " " + genlang(82) + "
"+genlang(32, 'raid')+"" + formatTemp(parseFloat(raiditems[i]["@attributes"].Batt_Temp), data.Options["@attributes"].tempFormat) + "
"+genlang(21, 'raid')+"" + raiditems[i]["@attributes"].Supported + "
"+genlang(25, 'raid')+"" + formatBytes(parseInt(raiditems[i]["@attributes"].Cache_Size, 10), data.Options["@attributes"].byteFormat) + "
"+genlang(23, 'raid')+"" + raiditems[i]["@attributes"].ReadPolicy + "
"+genlang(24, 'raid')+"" + raiditems[i]["@attributes"].WritePolicy + "
"+genlang(33, 'raid')+"" + formatBytes(parseInt(raiditems[i]["@attributes"].Cachevault_Size, 10), data.Options["@attributes"].byteFormat) + "
"+genlang(27, 'raid')+"" + raiditems[i]["@attributes"].DiskCache + "
"+genlang(26, 'raid')+"" + parseInt(raiditems[i]["@attributes"].Bad_Blocks, 10) + "
"; html += "
"; } /*if (i < raiditems.length-1) { // not last element html += "
"; }*/ html +=""; } $('#raid-data').empty().append(html); for (var k = 0; k < raiditems.length ; k++) { if (raiditems[k].RaidItems !== undefined) { var diskitems = items(raiditems[k].RaidItems.Item); for (var j = 0; j < diskitems.length ; j++) { raid_diskicon(diskitems[j]["@attributes"], k, j, data.Options["@attributes"].byteFormat, data.Options["@attributes"].tempFormat); } $('#raid-'+k).treegrid({ initialState: 'collapsed', expanderExpandedClass: 'normalicon normalicon-down', expanderCollapsedClass: 'normalicon normalicon-right' }); } } $('#block_raid').show(); } else { $('#block_raid').hide(); } } else { $('#block_raid').hide(); } }