X-Git-Url: https://git.wpitchoune.net/gitweb/?a=blobdiff_plain;f=www%2Fpsensor.js;h=3e902853faa99053eb469f835de90d936cdcdd7c;hb=e6444eb3fa27922e70f4ae2bbcd32a3d6f295ab8;hp=d3372d092e8055f9e8c6140780d1f5670c53fd86;hpb=f1d241236d3f26fff7c041da2967fbf9ae73fcea;p=psensor.git diff --git a/www/psensor.js b/www/psensor.js index d3372d0..3e90285 100644 --- a/www/psensor.js +++ b/www/psensor.js @@ -46,21 +46,28 @@ function format_mem_size(s) { function type_to_str(stype) { var stype_str; - stype_str = "N/A"; - - if (stype & 0x0100) - stype_str = "Sensor"; - else if (stype & 0x0200) - stype_str = "NVidia"; - else if (stype & 0x0400) - stype_str = "HDD"; - else if (stype & 0x1000) - stype_str = "AMD"; + if (stype & 0x0200) + stype_str = "NVidia "; + else if (stype & 0x0800) + stype_str = "ATI/AMD "; + else + stype_str = ""; - if (stype & 0x0001) - stype_str += " Temperature"; + if (stype & 0x04000) + stype_str += "HDD "; + else if (stype & 0x08000) + stype_str += "CPU "; + else if (stype & 0x10000) + stype_str += "GPU "; + else if (stype & 0x20000) + stype_str += "Fan "; + + if (stype & 0x0001) + stype_str += "Temperature"; else if (stype & 0x0002) - stype_str += " Fan"; + stype_str += "RPM"; + else if (stype & 0x0004) + stype_str += "Load"; return stype_str; } @@ -98,11 +105,19 @@ function update_chart(chart_id, title, data) { var measures, data_chart, date, entry; var style; + $("#"+chart_id).html(""); + measures = data["measures"]; data_chart = []; + $("h1").html(""); $("h1").append(data["name"]); - $("title").append(data["name"]); + + try { + $("title").html(data["name"]); + } catch(ignore) { + // IE8 doesn't allow to modify the page title + } $.each(measures, function(i, item) { value = item["value"]; @@ -144,25 +159,37 @@ function update_chart(chart_id, title, data) { } ] }; + $.jqplot (chart_id, [data_chart], style); } function update_menu() { var name, link, url, str; - $.getJSON("/api/1.0/sensors", function(data) { - str = "
  • Sensors\n"; + $("#menu-list").append(str); + }); } @@ -170,7 +197,7 @@ function update_menu() { function update_summary_sensors() { var name, value_str, min_str, max_str, type, type_str, url; - $.getJSON("/api/1.0/sensors", function(data) { + $.getJSON("/api/1.1/sensors", function(data) { $("#sensors tbody").html(""); $.each(data, function(i, item) { @@ -180,7 +207,7 @@ function update_summary_sensors() { min_str = value_to_str(item["min"], type); max_str = value_to_str(item["max"], type); type_str = type_to_str(type); - url = "details.html?id="+escape("/api/1.0/sensors/"+item["id"]); + url = "details.html?id="+escape("/api/1.1/sensors/"+item["id"]); $("#sensors tbody").append("" +""+name+"" @@ -194,7 +221,7 @@ function update_summary_sensors() { } function update_summary_sysinfo() { - $.getJSON("/api/1.0/sysinfo", function(data) { + $.getJSON("/api/1.1/sysinfo", function(data) { $("#uptime").html(""); $("#cpu tbody").html(""); $("#memory").html(""); @@ -211,7 +238,7 @@ function update_summary_sysinfo() { var uptime_h = Math.floor((uptime / (60*60)) % 24); var uptime_d = Math.floor(uptime / (60*60*24)); - $("#cpu").append(""+load+"%" + $("#cpu").append(""+load+"%" +load_1+"" +load_5+"" +load_15+"");