class Labels
getLabels: (keyword) ->
labels =
m_os: 'Operating System'
os_bit: 'System Bit'
return labels[keyword]
class Dashboard extends Labels
constructor: () ->
getGeneralInformation: () ->
html = ""
that = this
$.get "/os", (data) ->
$.each data, (key, value) ->
html += "
"+that.getLabels(key)+": "+(if value isnt "" then value else " No Result ")+""
return
$('#general-information').html html
getCpuInformation: () ->
html = ""
that = this
$.get "/cpu", (data) ->
$.each data, (key,result) ->
html += ""
html += "#{result.number_of_core} | "
html += "#{result.model_name} | "
html += "#{result.vendor_id} | "
html += "#{result.cpu_count} | "
html += "#{result.kernel_version} | "
html += "
"
return
$('#cpu_info').html html
getUsers: () ->
html = ""
that = this
$.get "/users", (data) ->
$.each data, (key ,result) ->
html += ""
html += "#{result.platform} | "
html += "#{result.user} | "
html += "#{result.directory} | "
html += "
"
return
$('#users').html html
getPs: () ->
html = ""
that = this
$.get "/disk", (data) ->
$('#disk').html "Loading... |
"
$.each data, (key,result) ->
html += ""
html += "#{result.Filesystem} | "
html += "#{result.Size} | "
html += "#{result.Used} | "
html += "#{result.Avail} | "
html += "#{result.Capacity} | "
html += "
"
return
$('#disk').html html
getCpuProc: () ->
$.get "/top_cpu", (data) ->
total = data.length
return_data = ''
i = 0
while i <= total
return_data += "" + data[i] + "" unless typeof data[i] is "undefined"
i++
$('#cpu_list').html return_data
return
dashboard = new Dashboard
dashboard.getGeneralInformation()
dashboard.getPs()
dashboard.getUsers()