<h2 class="mt-3">
    System Information
    <button class="text-primary bg-transparent box-shadow-none border-0" onclick='copyElementContent("{{ id }}-anchor")'>
        <i class="fa fa-anchor" aria-hidden="true"></i>
    </button>
    <div id="{{ id }}-anchor" class="hidden d-none">
        {{ full_url ~ '#' ~ id }}
    </div>
</h2>
{% if data.platform_info %}
    <div class="mb-4">
        <table class="table mb-3">
            <thead>
                <tr>
                    <th scope="col">System Platform</th>
                    <th scope="col">Distribution</th>
                    <th scope="col">Python Version</th>
                </tr>
            </thead>
            <tbody>
                <tr>
                    <td>{{ data.platform_info.platform }}</td>
                    <td>{{ data.platform_info.distro }}</td>
                    <td>{{ data.platform_info.python_version }}</td>
                </tr>
            </tbody>
        </table>
    </div>
{% endif %}
{% if data.ram_usage %}
    <h2 class="mt-3">
        RAM
    </h2>
    <nav>
        <div class="nav nav-tabs" id="nav-tab" role="tablist">
            <button class="nav-link active" id="nav-ram-tab-general-tab" data-bs-toggle="tab" data-bs-target="#nav-ram-tab-general" role="tab" aria-controls="nav-ram-tab-general" aria-selected="true">General</button>
            {% if profile == 'default' %}
                <button class="nav-link" id="nav-ram-tab-monitor-tab" data-bs-toggle="tab" data-bs-target="#nav-ram-tab-monitor" role="tab" aria-controls="nav-ram-tab-monitor" aria-selected="false">Monitor</button>
            {% endif %}
        </div>
    </nav>
    <div class="tab-content d-block">
        <div class="tab-pane fade show active" id="nav-ram-tab-general" role="tabpanel" aria-labelledby="nav-ram-tab-general-tab">
            <div class="mb-4">
                <table class="table mb3">
                    <tr>
                        <th class="col">{{ _('RAM Usage in') }} %</th>
                        <th class="col">{{ _('RAM Usage') }}</th>
                        <th class="col">{{ _('RAM Total') }}</th>
                    </tr>
                    <tbody>
                        <tr>
                            <td>{{ data.ram_usage.precent_usage }}%</td>
                            <td>{{ data.ram_usage.used_ram }}</td>
                            <td>{{ data.ram_usage.total_ram }}</td>
                        </tr>
                    </tbody>
                </table>
            </div>
        </div>
        {% if profile == 'default' %}
            <div class="tab-pane fade" id="nav-ram-tab-monitor" role="tabpanel" aria-labelledby="nav-ram-tab-monitor-tab">
                <button class="btn btn-primary my-3" id="ram-monitor">Start monitoring</button>
                <div class="mb-4">
                    <table class="table mb3">
                        <tr>
                            <th class="col">{{ _('RAM Usage in') }} %</th>
                            <th class="col">{{ _('RAM Usage') }}</th>
                            <th class="col">{{ _('RAM Total') }}</th>
                            <th class="col">{{ _('Processes') }}</th>
                        </tr>
                        <tbody hx-get="/selfinfo/get-ram" hx-trigger="every 5s [getRam()]" hx-swap="beforeend">
                            <tr>
                                <td>{{ data.ram_usage.precent_usage }}%</td>
                                <td>{{ data.ram_usage.used_ram }}</td>
                                <td>{{ data.ram_usage.total_ram }}</td>
                                <td>
                                    <div class="row">
                                        <div class="col-lg-6">
                                            <ol start="1">
                                                {% for process in data.ram_usage.processes[:5] %}
                                                    <li>
                                                        <span title="memory">{{ process[2] }}</span>, 
                                                        <span title="name">{{ process[1] }}</span>, 
                                                        <span title="PID">{{ process[0] }}</span>
                                                    </li>
                                                {% endfor %}
                                            </ol>
                                        </div>
                                        <div class="col-lg-6">
                                            <ol start="6">
                                                {% for process in data.ram_usage.processes[5:] %}
                                                    <li>
                                                        <span title="memory">{{ process[2] }}</span>, 
                                                        <span title="name">{{ process[1] }}</span>, 
                                                        <span title="PID">{{ process[0] }}</span>
                                                    </li>
                                                {% endfor %}
                                            </ol>
                                        </div>
                                    </div>
                                </td>
                            </tr>
                        </tbody>
                    </table>
                </div>
            </div>
        {% endif %}
    </div>
{% endif %}
{% if data.disk_usage %}
    <h2 class="mt-3">
        Disk Space
    </h2>
    <div class="mb-4">
        <table class="table mb3">
            <tr>
                <th class="col">{{ _('Path') }}</th>
                <th class="col">{{ _('Disk Usage in') }} %</th>
                <th class="col">{{ _('Disk Total') }}</th>
                <th class="col">{{ _('Disk Free') }}</th>
            </tr>
            <tbody>
                {% for disk in data.disk_usage %}
                    <tr>
                        <td>{{ disk.path }}</td>
                        <td>{{ disk.precent_usage }}%</td>
                        <td>{{ disk.total_disk }}</td>
                        <td>{{ disk.free_space }}</td>
                    </tr>
                {% endfor %}
            </tbody>
        </table>
    </div>
{% endif %}
