extend layout
block content
  - if (hasProcess) 
    h1 Processes
    table.table.table-bordered.table-condensed
      thead
        tr 
          th Command
          th Runnning
          th(colspan="2") Memory
          th Virtual
          th PID

      each process in processes
        tr
          td: a(href="/processes/#{process.name}")= process.name
          td= process.child.running ? 'Yes' : 'No'
          td= process.mem + 'Kb'
          td.sparkline= process.plotMemory().join(',')
          td= process.vmem + 'Kb'
          td= process.pid

  - if (hasService)
    h1 Services
    table.table.table-bordered.table-condensed
      thead
        tr
          th Service
          th
      each service in services
        tr
          td: a(href="/services/#{service.name}")= service.name
          td(style="padding: 0")
            table(width="100%")
              thead
                th Desc
                th Uptime
                th Downtime
                th Status

              each action, i in service.actions
                tr
                  td(width="50%"): a(href="/services/#{service.name}/actions/#{action.name}")= action.desc
                  td
                    = humanTime(action.meta.uptime()) + ' Up'
                    = ' (' + percentage(action.meta.uptime(), action.meta.downtime() + action.meta.uptime()) + ')'
                  td
                    = humanTime(action.meta.downtime()) + ' Down'
                  td.sparkline= action.meta.plotResponseTimes().join(',')
                  td= action.meta.up ? 'Up' : 'Down'
  script.
    $(function () { $('.sparkline').sparkline() });
