#from kojiweb import util

#include "includes/header.chtml"

  <h4>Information for host <a href="hostinfo?hostID=$host.id">$host.name</a></h4>

  <table>
    <tr>
      <th>Name</th><td>$host.name</td>
    </tr>
    <tr>
      <th>ID</th><td>$host.id</td>
    </tr>
    <tr>
      <th>Arches</th><td>$host.arches</td>
    </tr>
    <tr>
      <th>Capacity</th><td>$host.capacity</td>
    </tr>
    <tr>
      <th>Task Load</th><td><a href="tasks?hostID=$host.id">#echo '%.2f' % $host.task_load#</a></td>
    </tr>
    <tr>
      <th>Description</th><td class="usertext">$util.escapeHTML($host.description)</td>
    </tr>
    <tr>
      <th>Comment</th><td class="usertext">$util.escapeHTML($host.comment)</td>
    </tr>
    <tr>
      #set $enabled = $host.enabled and 'yes' or 'no'
      <th>Enabled?</th>
      <td class="$enabled">
        $util.imageTag($enabled)
        #if 'admin' in $perms
        #if $host.enabled
        <span class="adminLink">(<a href="disablehost?hostID=$host.id$util.authToken($self)">disable</a>)</span>
        #else
        <span class="adminLink">(<a href="enablehost?hostID=$host.id$util.authToken($self)">enable</a>)</span>
        #end if
        #end if
      </td>
    </tr>
    <tr>
      #set $ready = $host.ready and 'yes' or 'no'
      <th>Ready?</th><td class="$ready">$util.imageTag($ready)</td>
    </tr>
    <tr>
      <th>Last Update</th><td>$util.formatTime($lastUpdate)</td>
    </tr>
    <tr>
      <th>Channels</th>
      <td>
        #for $channel in $channels
        <a href="channelinfo?channelID=$channel.id">$channel.name</a><br/>
        #end for
        #if not $channels
        No channels
        #end if
      </td>
    </tr>
    <tr>
      <th>Active Buildroots</th>
      #if $buildroots
      <td class="container">
        <table class="nested data-list">
          <tr class="list-header">
            <th>Buildroot</th><th>Created</th><th>State</th>
          </tr>
          #for $buildroot in $buildroots
          <tr class="$util.rowToggle($self)">
            <td><a href="buildrootinfo?buildrootID=$buildroot.id">$buildroot.tag_name-$buildroot.id-$buildroot.repo_id</a></td>
            <td>$util.formatTime($buildroot.create_event_time)</td>
            <td>$util.imageTag($util.brStateName($buildroot.state))</td>
          </tr>
          #end for
        </table>
      </td>
      #else
      <td>
        No buildroots
      </td>
      #end if
    </tr>
    #if 'admin' in $perms
    <tr>
      <td colspan="2"><a href="hostedit?hostID=$host.id$util.authToken($self)">Edit host</a></td>
    </tr>
    #end if
  </table>

#include "includes/footer.chtml"
