{{ if isset(., "error") }}
  <div class="alert alert-danger">{{ .error }}</div>
{{ end }}

<table class="table table-striped" id="processes-stats">
  <thead>
    <tr>
      <th scope="col">PID</th>
      <th scope="col">Name</th>
      <th scope="col">Status</th>
      <th scope="col">CPU (%)</th>
      <th scope="col">Memory (MB)</th>
      <th scope="col">Created</th>
    </tr>
  </thead>
  <tbody>
    {{ if isset(., "processes") }}
      {{ if .processes }}
        {{ range .processes }}
          <tr class="{{ if .is_current }}table-primary{{ end }}">
            <td>{{.pid}}</td>
            <td>{{.name}}</td>
            <td>{{.status}}</td>
            <td>{{ printf("%.1f%%", .cpu_percent) }}</td>
            <td>{{ printf("%.1f MB", .memory_mb) }}</td>
            <td>{{.create_time_str}}</td>
          </tr>
        {{ end }}
      {{ else }}
        <tr>
          <td colspan="6">No process data available.</td>
        </tr>
      {{ end }}
    {{ else }}
      <tr>
        <td colspan="6">Loading process data...</td>
      </tr>
    {{ end }}
  </tbody>
</table>