<div id="server-actions"
     {% if latest_job_is_running %}hx-get="/servers/{{ server.id }}/actions"
     hx-trigger="every 2s" hx-swap="outerHTML"{% endif %}>
  <div class="server-actions">
    <span class="state-badge {{ state_class }}">{{ display_state }}</span>
    {% if 'start' in visible_buttons %}
    <form method="post" action="/servers/{{ server.id }}/start" class="inline-form">
      <input type="hidden" name="csrf_token" value="{{ session.get('csrf_token', '') }}">
      <button type="submit">start</button>
    </form>
    {% endif %}
    {% if 'stop' in visible_buttons %}
    <form method="post" action="/servers/{{ server.id }}/stop" class="inline-form">
      <input type="hidden" name="csrf_token" value="{{ session.get('csrf_token', '') }}">
      <button type="submit">stop</button>
    </form>
    {% endif %}
    {% if 'reset' in visible_buttons %}
    <button type="button" class="danger" data-inline-modal-open="reset-server-modal">reset</button>
    {% endif %}
  </div>
  {% if drift %}
  <p class="state-drift"><strong>Warning:</strong> server is {{ server.actual_state }} but requested state is {{ server.desired_state }}.</p>
  {% endif %}
  {% if latest_job %}
  <p class="last-job">
    <button type="button" class="link-button" data-inline-modal-open="job-log-modal">{{ latest_job_phrase }}</button>
    {% if latest_job_is_running %}since{% endif %}
    {{ latest_job_at | timeago }}
    (<a href="/servers/{{ server.id }}/jobs">show all</a>)
  </p>
  {% endif %}

</div>
