1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
|
{% extends 'base.html' %}
{% block content %}
<div class="row">
<!-- connected clients -->
<div class="col-{{ colsize }}">
<div class="card text-center">
<div class="card-header">
Connected clients (ogClient)
</div>
<div class="card-body">
<p class="card-text">{{ clients['clients'] | length }}</p>
</div>
</div>
</div>
<!-- latest images -->
<div class="col-{{ colsize }}">
<div class="card text-center">
<div class="card-header">
Latest images
</div>
{% for image in images[:10] %}
<ul class="list-group list-group-horizontal">
<li class="list-group-item w-50">
{{ image['name'] }}
</li>
<li class="list-group-item w-50">
{{ image['modified'] }}
</li>
</ul>
{% endfor %}
</div>
</div>
<!-- disk stats -->
<div class="col-{{ colsize }}">
<div class="card text-center">
<div class="card-header">
Disk stats
</div>
<div class="card-body">
<canvas id="diskChart" class="mb-2"></canvas>
<ul class="list-group list-group-horizontal">
<li class="list-group-item w-50">
Disk size
</li>
<li class="list-group-item w-50">
used
</li>
<li class="list-group-item w-50">
available
</li>
<li class="list-group-item w-50">
use(%)
</li>
</ul>
<ul class="list-group list-group-horizontal">
<li class="list-group-item w-50">
{{ disk['total'] // 2**30 }} Gbytes
</li>
<li class="list-group-item w-50">
{{ (disk['total'] - disk['free']) // 2**30 }} Gbytes
</li>
<li class="list-group-item w-50">
{{ disk['free'] // 2**30 }} Gbytes
</li>
<li class="list-group-item w-50">
{{ (((disk['total'] - disk['free']) / disk['total']) * 100)|int }}%
</li>
</ul>
</div>
<div class="card-header">
Number of images
</div>
<div class="card-body">
<p class="card-text">{{ images | length }}</p>
</div>
</div>
</div>
<!-- ogLives -->
<div class="col-{{ colsize }}">
<div class="card text-center">
<div class="card-header">
ogLives
</div>
<ul class="list-group">
{% for oglive in oglive_list['oglive'] %}
<li class="list-group-item">
{{ oglive['directory'] }}
{% if loop.index0 == oglive_list['default'] %}
(default)
{% endif %}
</li>
{% endfor %}
</ul>
</div>
</div>
</div>
{% endblock %}
{% block extrabody %}
<script>
const diskChartConfig = {
type: 'doughnut',
data: {
labels: ['Used', 'Availabel'],
datasets: [
{
label: 'Disk usage',
data: [
{{ (disk['total'] - disk['free']) // 2**30 }},
{{ disk['free'] // 2**30 }},
],
backgroundColor: [
'rgb(255, 99, 132)',
'rgb(54, 162, 235)',
],
},
],
},
options: {
responsive: true,
plugins: {
legend: {
position: 'top',
},
title: {
display: true,
text: 'Chart.js Doughnut Chart'
},
},
},
};
var diskChart = new Chart(
document.getElementById('diskChart'),
diskChartConfig,
);
</script>
{% endblock %}
|