Skip to content

Commit

Permalink
fix order column in quota details page
Browse files Browse the repository at this point in the history
  • Loading branch information
Sispheor committed Sep 5, 2023
1 parent 5385dac commit 3ceefde
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 17 deletions.
3 changes: 2 additions & 1 deletion profiles/tables/quota_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ class QuotaTable(SquestTable):
actions = TemplateColumn(template_name='generics/custom_columns/generic_delete.html',
orderable=False,
exclude_from_export=True)
available = LinkColumn()
available = LinkColumn(orderable=False)
consumed = LinkColumn(orderable=False)
limit = LinkColumn()

class Meta:
Expand Down
2 changes: 0 additions & 2 deletions profiles/tables/team_quota_limit_table.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from django.urls import reverse
from django.utils.html import format_html
from django_tables2 import LinkColumn, Table

from profiles.models import Quota
Expand Down
11 changes: 9 additions & 2 deletions profiles/views/quota.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from django.db.models import Sum
from django.shortcuts import get_object_or_404
from django_tables2 import RequestConfig

from Squest.utils.squest_views import *
from profiles.filters.quota import QuotaFilter
Expand Down Expand Up @@ -70,16 +71,22 @@ def get_context_data(self, **kwargs):
{'text': f"Quota", 'url': ''},
{'text': f"{self.object.name}", 'url': ''},
]
config = RequestConfig(self.request)
if class_name == "Organization":
quotas_teams = Quota.objects.filter(scope__in=scope.teams.all(),
attribute_definition=self.object.attribute_definition)
quotas_teams_consumption = quotas_teams.aggregate(consumed=Sum('limit')).get("consumed", 0)
context['quotas_teams_consumption'] = quotas_teams_consumption
context['team_limit_table'] = TeamQuotaLimitTable(quotas_teams.all())
table_team = TeamQuotaLimitTable(quotas_teams.all(), prefix="team-")
context['team_limit_table'] = table_team

config.configure(table_team)

resources = ResourceAttribute.objects.filter(attribute_definition=self.object.attribute_definition,
resource__service_catalog_instance__quota_scope=self.object.scope)
context['instance_consumption_table'] = InstanceConsumptionTable(resources.all())
table_instance = InstanceConsumptionTable(resources.all(), prefix="instance-")
context['instance_consumption_table'] = table_instance
config.configure(table_instance)
instances_consumption = resources.all().aggregate(consumed=Sum("value")).get("consumed", 0)
context['instances_consumption'] = instances_consumption
return context
Expand Down
2 changes: 1 addition & 1 deletion templates/generics/list.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
{% load export_url from django_tables2 %}
{% if export_csv %}
<a class="btn btn-default" href="{% export_url "csv" %}">
<i class="fas fa-file-csv"></i>
<i class="fas fa-file-csv"></i> Export to CSV
</a>
{% endif %}
{% if html_button_path %}
Expand Down
28 changes: 17 additions & 11 deletions templates/service_catalog/approvalworkflow_detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,26 +29,28 @@ <h3 class="card-title">{{ object.name }}</h3>
<b>Operation</b>
<span class="float-right">{{ object.operation.name }}</span>
</li>
<li class="list-group-item">
<b>Scopes</b>
<span class="float-right">
{% if object.scopes.all %}
<li class="list-group-item">
<b>Restricted scopes</b>
<span class="float-right">
{% for scope in object.scopes.distinct %}
<span class="badge bg-primary">{{ scope.name }}</span>
{% endfor %}
</span>
</li>
{% if object.get_unused_fields %}
<li class="list-group-item">
<span title="Fields that are not used in any steps.">
<b>Unused fields</b>
</li>
{% endif %}
{% if object.get_unused_fields %}
<li class="list-group-item">
<span title="Fields that are not used yet in any steps but marked as required by the job template">
<b>Unused required fields</b>
</span>
<span class="float-right">
<span class="float-right">
{% for field in object.get_unused_fields %}
<span class="badge bg-warning">{{ field }}</span>
{% endfor %}
</span>
</li>
{% endif %}
</li>
{% endif %}
</ul>
</div>
</div>
Expand Down Expand Up @@ -107,6 +109,10 @@ <h3 class="card-title"><strong>{{ approval_step.name }}</strong></h3>
<span class="badge bg-primary">{{ field.name }}</span>
{% endfor %}
</dd>
{% if approval_step.auto_accept_condition %}
<dt class="col-sm-4">Auto accept condition</dt>
<dd class="col-sm-8">{{ approval_step.auto_accept_condition }}</dd>
{% endif %}
</dl>
</div>
</div>
Expand Down

0 comments on commit 3ceefde

Please sign in to comment.