musician dashboard bar % in individual resources
This commit is contained in:
parent
bee347c9f5
commit
4879eec69e
|
@ -87,6 +87,11 @@
|
||||||
{% for obj_data in usage.objects %}
|
{% for obj_data in usage.objects %}
|
||||||
<li class="list-group-item d-flex justify-content-between align-items-center">
|
<li class="list-group-item d-flex justify-content-between align-items-center">
|
||||||
{{ obj_data }}
|
{{ obj_data }}
|
||||||
|
{% if obj_data.rs_percent %}
|
||||||
|
<div class="progress" style="width:80%;margin:1em;">
|
||||||
|
<div class="progress-bar" role="progressbar" style="width: {{ obj_data.rs_percent }}%;"></div>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
<span class="badge badge-primary badge-pill">{{ obj_data.used }} {{ obj_data.resource.unit }}</span>
|
<span class="badge badge-primary badge-pill">{{ obj_data.used }} {{ obj_data.resource.unit }}</span>
|
||||||
</li>
|
</li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
|
@ -200,6 +200,14 @@ class DashboardView(CustomContextMixin, UserTokenRequiredMixin, TemplateView):
|
||||||
alert = format_html("<span class='text-warning'>{} {} {}</span>".format(rs_left, name_resource, _('available')))
|
alert = format_html("<span class='text-warning'>{} {} {}</span>".format(rs_left, name_resource, _('available')))
|
||||||
elif rs_left > 1:
|
elif rs_left > 1:
|
||||||
alert = format_html("<span class='text-secondary'>{} {} {}</span>".format(rs_left, name_resource, _('available')))
|
alert = format_html("<span class='text-secondary'>{} {} {}</span>".format(rs_left, name_resource, _('available')))
|
||||||
|
|
||||||
|
# porcentage de uso en los recursos
|
||||||
|
for x in resource_data:
|
||||||
|
if getattr(x, 'used', False) and getattr(x, 'allocated', False):
|
||||||
|
rs_percent = getattr(x, 'used') / getattr(x, 'allocated') * 100
|
||||||
|
x.rs_percent = int(rs_percent)
|
||||||
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'verbose_name': _(name_resource.capitalize()),
|
'verbose_name': _(name_resource.capitalize()),
|
||||||
'data': {
|
'data': {
|
||||||
|
|
Loading…
Reference in New Issue