Add storage to the dashboard

This commit is contained in:
amcmanu3 2023-02-05 16:47:12 -05:00
parent 3eeb00e524
commit b224103778
2 changed files with 40 additions and 4 deletions

View File

@ -332,7 +332,12 @@ class PanelHandler(BaseHandler):
else None,
"superuser": superuser,
}
try:
page_data["hosts_data"]["disk_json"] = json.loads(
page_data["hosts_data"]["disk_json"].replace("'", '"')
)
except:
page_data["hosts_data"]["disk_json"] = {}
if page == "unauthorized":
template = "panel/denied.html"

View File

@ -50,7 +50,7 @@
<div class="card">
<div class="card-body">
<div class="row">
<div class="col-lg-4 col-md-6">
<div class="col-lg-3 col-md-6">
<div class="d-flex">
<div class="wrapper">
<h5 class="mb-1 font-weight-medium text-primary"> {{ translate('dashboard', 'host', data['lang']) }}
@ -72,7 +72,7 @@
</div>
</div>
</div>
<div class="col-lg-4 col-md-6 mt-md-0 mt-4">
<div class="col-lg-3 col-md-6 mt-md-0 mt-4">
<div class="d-flex">
<div class="wrapper">
<h5 class="mb-1 font-weight-medium text-primary">{{ translate('dashboard', 'servers', data['lang']) }}
@ -88,7 +88,7 @@
</div>
</div>
</div>
<div class="col-lg-4 col-md-6 mt-md-0 mt-4">
<div class="col-lg-2 col-md-6 mt-md-0 mt-4">
<div class="d-flex">
<div class="wrapper">
<h5 class="mb-1 font-weight-medium text-primary">{{ translate('dashboard', 'players', data['lang']) }}
@ -101,6 +101,37 @@
</div>
</div>
</div>
<div class="col-lg-4 col-md-6 mt-md-0 mt-4">
<div class="d-flex">
<div class="wrapper" style="width: 100%;">
<h5 class="mb-1 font-weight-medium text-primary">Storage
</h5>
<ul style="width: 100%; list-style: none;">
{% for item in data.get('hosts_data').get('disk_json') %}
<li id="{{item['device']}}">
<h6 style="display: inline-block;">{{item["mount"]}}</h6>
<div class="progress"
style="display: inline-block; height: 20%; width: 70%; background-color: rgb(139, 139, 139) !important;">
<div class="progress-bar
{% if item['percent_used'] <= 33 %}
bg-success
{% elif 34 <= item['percent_used'] <= 75 %}
bg-warning
{% else %}
bg-danger
{% end %}
" role="progressbar" style="color: black; height: 100%; width: {{item['percent_used']}}%;"
aria-valuenow="0" aria-valuemin="0" aria-valuemax="100">{{item["used"]}} / {{item["total"]}}
</div>
</div>
</li>
{% end %}
</li>
</ul>
</div>
</div>
</div>
</div>
</div>
</div>