{% extends "base.html" %}

{% block title %}Devices - MCP Network Diagnostics{% endblock %}

{% block content %}
<div class="card">
    <div class="card-title">Network Devices</div>
    <table>
        <thead>
            <tr>
                <th>Device ID</th>
                <th>Name</th>
                <th>Type</th>
                <th>Status</th>
                <th>Last Seen</th>
            </tr>
        </thead>
        <tbody>
            {% for device in devices %}
            <tr>
                <td><a href="/devices/{{ device.id }}">{{ device.id }}</a></td>
                <td>{{ device.name }}</td>
                <td>{{ device.type }}</td>
                <td>
                    <span class="badge {% if device.status == 'healthy' %}badge-success{% else %}badge-warning{% endif %}">
                        {{ device.status }}
                    </span>
                </td>
                <td class="time">
                    {% if device.last_seen %}
                        {{ device.last_seen.strftime('%Y-%m-%d %H:%M') }}
                    {% else %}
                        Never
                    {% endif %}
                </td>
            </tr>
            {% endfor %}
        </tbody>
    </table>
</div>
{% endblock %}
