Subversion Repositories ALCASAR

Rev

Go to most recent revision | Details | Last modification | View Log

Rev Author Line No. Line
2781 rexy 1
function renderPlugin_smart(data) {
2
 
3
    if ((data.Plugins.Plugin_SMART !== undefined) && (data.Plugins.Plugin_SMART.columns !== undefined) && (items(data.Plugins.Plugin_SMART.columns.column).length > 0) && (data.Plugins.Plugin_SMART.disks !== undefined) && (items(data.Plugins.Plugin_SMART.disks.disk).length > 0)) {
4
        var smartitems = items(data.Plugins.Plugin_SMART.columns.column);
5
        var smartnames = {
6
            1:"plugin_smart_101",	// "Raw Read Error Rate",		
7
            2:"plugin_smart_102",	// "Throughput Performance",
8
            3:"plugin_smart_103",	// "Spin Up Time",
9
            4:"plugin_smart_104",	// "Start Stop Count",
10
            5:"plugin_smart_105",	// "Reallocated Sector Ct",
11
            7:"plugin_smart_106",	// "Seek Error Rate",
12
            8:"plugin_smart_108",	// "Seek Time Performance",
13
            9:"plugin_smart_109",	// "Power On Hours",
14
            10:"plugin_smart_110",	// "Spin Retry Count",
15
            11:"plugin_smart_111",	// "Calibration Retry Count",
16
            12:"plugin_smart_112",	// "Power Cycle Count",
17
            190:"plugin_smart_290",	// "Airflow Temperature",
18
            191:"plugin_smart_291",	// "G-sense Error Rate",
19
            192:"plugin_smart_292",	// "Power-Off Retract Count",
20
            193:"plugin_smart_293",	// "Load Cycle Count",
21
            194:"plugin_smart_294",	// "Temperature",
22
            195:"plugin_smart_295",	// "Hardware ECC Recovered",
23
            196:"plugin_smart_296",  // "Reallocated Event Count",
24
            197:"plugin_smart_297",  // "Current Pending Sector",
25
            198:"plugin_smart_298",  // "Offline Uncorr.",
26
            199:"plugin_smart_299",  // "UDMA CRC Error Count",
27
            200:"plugin_smart_300",  // "Multi Zone Error Rate",
28
            201:"plugin_smart_301",  // "Soft Read Error Rate",
29
            202:"plugin_smart_302",  // "Data Address Mark Errors",
30
            223:"plugin_smart_323",  // "Load Retry Count",
31
            225:"plugin_smart_325",  };	// "Load Cycle Count"
32
 
33
        var html = '';
34
        var i,j;
35
        var smartid;
36
 
37
        html+="<thead>";
38
        html+="<tr>";
39
        html+="<th id=\"smart_name\" class=\"rightCell\">"+genlang(2, 'smart')+"</th>";	// Name
40
        for (i = 0; i < smartitems.length ; i++) {
41
            smartid = smartitems[i]["@attributes"].id;
42
            if (smartnames[smartid] !== undefined) {
43
                html+="<th class=\"sorttable_numeric rightCell\">"+ genlang(100+parseInt(smartid), 'smart') + "</th>";
44
            } else {
45
                html+="<th class=\"sorttable_numeric rightCell\">"+ smartid + "</th>";
46
            }
47
        }
48
        html+="</tr>";
49
        html+="</thead>";
50
 
51
        var diskitems = items(data.Plugins.Plugin_SMART.disks.disk);
52
        html += '<tbody>';
53
        for (i = 0; i < diskitems.length; i++) {
54
            html += '<tr>';
55
            html += '<th class="rightCell">'+ diskitems[i]["@attributes"].name + '</th>';
56
            attribitems = items(diskitems[i].attribute);
57
            var valarray = [];
58
            for (j = 0;j < attribitems.length; j++) {
59
                valarray[attribitems[j]["@attributes"].id] = attribitems[j]["@attributes"].raw_value;
60
            }
61
            for (j = 0; j < smartitems.length; j++) {
62
                smartid = smartitems[j]["@attributes"].id;
63
                var itemvalue = valarray[smartid];
64
                if ((itemvalue !== undefined) && (itemvalue !== '' )) {
65
                    if (smartid === "194") {
66
                        html += '<td class="rightCell">' + formatTemp(itemvalue, data.Options["@attributes"].tempFormat) + '</td>';
67
                    } else {
68
                        html += '<td class="rightCell">' + itemvalue + '</td>';
69
                    }
70
                } else {
71
                    html += '<td></td>';
72
                }
73
            }
74
            html += '</tr>'; 
75
        }
76
        html += '</tbody>';
77
        $('#smart').empty().append(html);
78
        $('#smart').addClass("sortable");
79
        sorttable.makeSortable($('#smart')[0]);
80
        sorttable.innerSortFunction.apply($('#smart_name')[0], []);
81
        $('#block_smart').show();
82
    } else {
83
        $('#block_smart').hide();
84
    }
85
}