{% extends "base.html" %}
{% block title %}실시간 모니터링 - 리얼컴 NAS UI{% endblock %}
{% block content %}
<div class="container">
  <div class="panel" style="width: 100%;">
    <h2>네트워크 트래픽</h2>
    <pre style="background: #f0f0f0; padding: 10px;">{{ network_traffic }}</pre>

    <h2>서비스 상태</h2>
    <table>
      <thead>
        <tr>
          <th>서비스명</th>
          <th>상태</th>
          <th>동작</th>
        </tr>
      </thead>
      <tbody>
        {% for name, status in services.items() %}
        <tr>
          <td>{{ name }}</td>
          <td>
            {% if status == 'active' %}
              <span style="color:green; font-weight:bold;">활성</span>
            {% elif status == 'inactive' %}
              <span style="color:gray;">비활성</span>
            {% else %}
              <span style="color:red;">{{ status }}</span>
            {% endif %}
          </td>
          <td>
            <form method="post" action="{{ url_for('service_control') }}">
              <input type="hidden" name="service" value="{{ name }}">
              <button type="submit" name="action" value="restart" class="edit-btn">재시작</button>
              <button type="submit" name="action" value="stop" class="del-btn">중지</button>
              <button type="submit" name="action" value="start" class="edit-btn">시작</button>
            </form>
          </td>
        </tr>
        {% endfor %}
      </tbody>
    </table>
  </div>
</div>
{% endblock %}
