rDrama/files/templates/admin/performance/memory.html
2023-07-28 05:05:47 -05:00

60 lines
2 KiB
HTML

{%- extends 'default.html' -%}
{% block content %}
{%- macro post_toast_button(text, url, css_class) -%}
<button class="btn{% if css_class %} {{css_class}}{% endif %}" onclick="postToastSimple(this, '{{url}}')">{{text}}</button>
{%- endmacro -%}
<h5 class="mt-3">System Info</h5>
<section class="system-resource-usage">
<div class="overflow-x-auto">
<table class="table table-striped mb-5">
<tbody>
<tr>
<td>Total Physical RAM</td>
<td>{{system_vm.total | computer_size}}</td>
</tr>
<tr>
<td>Available</td>
<td>{{system_vm.available | computer_size}}</td>
</tr>
</tbody>
</table>
</div>
</section>
<h5 class="mt-3">Worker Info</h5>
<section class="worker-resource-usage">
<div class="overflow-x-auto">
<table class="table table-striped mb-5">
<thead class="bg-primary text-white">
<tr>
<th>PID</th>
<th>Type</th>
<th>Started</th>
<th>Memory Usage (Virtual)</th>
<th>Memory Usage (Physical)</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
{% for pid, process in processes.items() %}
<tr{% if process.is_current %} class='self'{% endif %}>
<td>{{process.pid}}</td>
<td>{{'Master' if process.is_master else 'Worker'}}</td>
<td>{{process.started_at_utc_str}}</td>
<td>{{process.memory_vms | computer_size}}</td>
<td class="{{process.memory_rss_css_class}}">{{process.memory_rss | computer_size}}</td>
<td>{%- if process.is_master -%}
{{post_toast_button('Scale Up', '/performance/workers/+1', 'btn-secondary')}}
{{post_toast_button('Scale Down', '/performance/workers/-1', 'btn-secondary')}}
{{post_toast_button('Reload', '/performance/workers/reload', 'btn-danger')}}
{%- else -%}
{{post_toast_button('Shutdown', '/performance/workers/' ~ process.pid ~ '/terminate', 'btn-danger')}}
{{post_toast_button('Kill', '/performance/workers/' ~ process.pid ~ '/kill', 'btn-danger')}}
{%- endif -%}
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</section>
{% endblock %}