4.4 KiB · text History d69022d
{% extends "base.html" %}
{% block title %}devendra · {{ id }}{% endblock %}
{% block content %}
  <p class="muted"><a href="/">← hosts</a></p>
  <h1>{{ id }}{% if metrics %}<span class="badge" title="reported {{ metrics.age }}"><i class="fas fa-clock fa-fw"></i>{{ metrics.uptime }}<span class="badge-sep">·</span><i class="fas fa-microchip fa-fw"></i>{{ metrics.load }}</span>{% endif %}</h1>

  {% if has_adoption %}
  <div class="card" style="border-color:var(--accent)">
    <strong>Adoption proposal pending</strong> —
    an agent has proposed files to adopt.
    <a class="btn" href="/hosts/{{ id }}/adopt">Review &amp; accept</a>
  </div>
  {% endif %}

  {% if status %}
  <div class="card">
    <strong>Agent report</strong>
    <span class="pill {{ status.result }}">{{ status.result }}</span>
    <span class="muted">generation {{ status.generation }} · {{ status.age }}</span>
    <p class="muted">{{ status.message }} — {{ status.changed }} changed{% if status.failed %}, {{ status.failed }} failed{% endif %}</p>
  </div>
  {% else %}
  <div class="card muted">No agent has reported for this host yet.</div>
  {% endif %}

  {% if compile_error %}
  <div class="card"><strong style="color:var(--err)">Config error</strong><pre class="code">{{ compile_error }}</pre></div>
  {% else %}
    {% if packages %}
    <h2>Packages</h2>
    <table>
      <thead><tr><th>Package</th><th>State</th></tr></thead>
      <tbody>
      {% for p in packages %}
        <tr><td><code>{{ p.name }}</code></td><td>{{ p.state }}</td></tr>
      {% endfor %}
      </tbody>
    </table>
    {% endif %}

    {% if directories %}
    <h2>Directories</h2>
    <table>
      <thead><tr><th>Path</th><th>State</th><th>Mode</th><th>Owner</th></tr></thead>
      <tbody>
      {% for d in directories %}
        <tr><td class="break"><code>{{ d.path }}</code></td><td>{{ d.state }}</td><td>{{ d.mode }}</td><td>{{ d.owner }}</td></tr>
      {% endfor %}
      </tbody>
    </table>
    {% endif %}

    <h2>Files</h2>
    {% if files %}
    <table>
      <thead><tr><th>Path</th><th>State</th><th>Mode</th><th>Owner</th></tr></thead>
      <tbody>
      {% for f in files %}
        <tr>
          <td class="break"><code>{{ f.path }}</code></td>
          <td>{{ f.state }}</td>
          <td>{{ f.mode }}</td>
          <td>{{ f.owner }}</td>
        </tr>
      {% endfor %}
      </tbody>
    </table>
    {% else %}<p class="muted">No files.</p>{% endif %}

    <h2>Services</h2>
    {% if services %}
    <table>
      <thead><tr><th>Unit</th><th>Enabled</th><th>State</th></tr></thead>
      <tbody>
      {% for s in services %}
        <tr>
          <td><code>{{ s.name }}</code></td>
          <td>{{ s.enabled }}</td>
          <td>
            {{ s.state }}
            {% if s.health %}<span class="dot {{ s.health }}" title="{{ s.health_detail }}"></span>{% endif %}
          </td>
        </tr>
      {% endfor %}
      </tbody>
    </table>
    {% else %}<p class="muted">No services.</p>{% endif %}
  {% endif %}

  <h2>Includes</h2>
  <div class="card">
    {% if includes %}
      <ul style="margin:.5rem 0">
        {% for inc in includes %}
          <li style="display:flex; align-items:center; gap:.5rem">
            {% if inc.fragment %}<a href="/fragments/{{ inc.fragment }}"><code>{{ inc.fragment }}</code></a>{% else %}<code>{{ inc.reference }}</code>{% endif %}
            <form method="post" action="/hosts/{{ id }}/includes" style="margin:0">
              <input type="hidden" name="remove" value="{{ inc.reference }}">
              <button type="submit" class="btn secondary" style="padding:.1rem .5rem">remove</button>
            </form>
          </li>
        {% endfor %}
      </ul>
    {% else %}
      <p class="muted" style="margin:.5rem 0">No fragments included.</p>
    {% endif %}
    {% if addable %}
      <form method="post" action="/hosts/{{ id }}/includes" style="display:flex; gap:.5rem; align-items:center">
        <select name="add" required>
          <option value="" disabled selected>Add a fragment…</option>
          {% for f in addable %}<option value="{{ f }}">{{ f }}</option>{% endfor %}
        </select>
        <button type="submit">Add include</button>
      </form>
    {% else %}
      <p class="muted" style="margin:.5rem 0">All fragments are already included.</p>
    {% endif %}
  </div>

  <h2>Config source <a class="btn secondary" href="/hosts/{{ id }}/edit">Edit</a></h2>
  <pre class="code">{{ raw }}</pre>
{% endblock %}