From 8d53a81a5859356e2970ea8216c97ab309ab0075 Mon Sep 17 00:00:00 2001 From: Nicolas Marcq Date: Tue, 5 Sep 2023 14:16:06 +0200 Subject: [PATCH] fix order column in quota details page --- profiles/tables/quota_table.py | 3 +- profiles/tables/team_quota_limit_table.py | 2 -- profiles/views/quota.py | 11 ++++++-- templates/generics/list.html | 2 +- .../approvalworkflow_detail.html | 28 +++++++++++-------- 5 files changed, 29 insertions(+), 17 deletions(-) diff --git a/profiles/tables/quota_table.py b/profiles/tables/quota_table.py index be9e3c122..95e390f3f 100644 --- a/profiles/tables/quota_table.py +++ b/profiles/tables/quota_table.py @@ -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: diff --git a/profiles/tables/team_quota_limit_table.py b/profiles/tables/team_quota_limit_table.py index 086bb7709..65a2d5a7c 100644 --- a/profiles/tables/team_quota_limit_table.py +++ b/profiles/tables/team_quota_limit_table.py @@ -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 diff --git a/profiles/views/quota.py b/profiles/views/quota.py index 236a10ebb..37dcf00c2 100644 --- a/profiles/views/quota.py +++ b/profiles/views/quota.py @@ -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 @@ -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 diff --git a/templates/generics/list.html b/templates/generics/list.html index fbcf934ea..547800ffa 100644 --- a/templates/generics/list.html +++ b/templates/generics/list.html @@ -9,7 +9,7 @@ {% load export_url from django_tables2 %} {% if export_csv %} - + Export to CSV {% endif %} {% if html_button_path %} diff --git a/templates/service_catalog/approvalworkflow_detail.html b/templates/service_catalog/approvalworkflow_detail.html index 8031d80f5..b53e2e883 100644 --- a/templates/service_catalog/approvalworkflow_detail.html +++ b/templates/service_catalog/approvalworkflow_detail.html @@ -29,26 +29,28 @@

{{ object.name }}

Operation {{ object.operation.name }} -
  • - Scopes - + {% if object.scopes.all %} +
  • + Restricted scopes + {% for scope in object.scopes.distinct %} {{ scope.name }} {% endfor %} -
  • - {% if object.get_unused_fields %} -
  • - - Unused fields +
  • + {% endif %} + {% if object.get_unused_fields %} +
  • + + Unused required fields - + {% for field in object.get_unused_fields %} {{ field }} {% endfor %} -
  • - {% endif %} + + {% endif %} @@ -107,6 +109,10 @@

    {{ approval_step.name }}

    {{ field.name }} {% endfor %} + {% if approval_step.auto_accept_condition %} +
    Auto accept condition
    +
    {{ approval_step.auto_accept_condition }}
    + {% endif %}