From fb0b0adc93b578fd7411afca5beb2e49e7243a70 Mon Sep 17 00:00:00 2001 From: Jackie Goldstein Date: Mon, 26 Jun 2023 13:38:44 -0400 Subject: [PATCH] [batch] Separate closed and open projects on billing limits page --- batch/batch/front_end/front_end.py | 9 +++- .../front_end/templates/billing_limits.html | 42 ++++++++++++++++++- 2 files changed, 48 insertions(+), 3 deletions(-) diff --git a/batch/batch/front_end/front_end.py b/batch/batch/front_end/front_end.py index e0726c1f60d..f5998c4ff27 100644 --- a/batch/batch/front_end/front_end.py +++ b/batch/batch/front_end/front_end.py @@ -2212,7 +2212,14 @@ async def ui_get_billing_limits(request, userdata): billing_projects = await query_billing_projects(db, user=user) - page_context = {'billing_projects': billing_projects, 'is_developer': userdata['is_developer']} + open_billing_projects = [bp for bp in billing_projects if bp['status'] == 'open'] + closed_billing_projects = [bp for bp in billing_projects if bp['status'] == 'closed'] + + page_context = { + 'open_billing_projects': open_billing_projects, + 'closed_billing_projects': closed_billing_projects, + 'is_developer': userdata['is_developer'], + } return await render_template('batch', request, userdata, 'billing_limits.html', page_context) diff --git a/batch/batch/front_end/templates/billing_limits.html b/batch/batch/front_end/templates/billing_limits.html index 33a1b5ea88c..2f5e1ad21ec 100644 --- a/batch/batch/front_end/templates/billing_limits.html +++ b/batch/batch/front_end/templates/billing_limits.html @@ -2,8 +2,10 @@ {% block title %}Billing Limits{% endblock %} {% block content %}

Billing Project Limits

+{% if open_billing_projects %}
- +

Open Projects

+
@@ -12,7 +14,7 @@

Billing Project Limits

- {% for row in billing_projects %} + {% for row in open_billing_projects %} @@ -34,4 +36,40 @@

Billing Project Limits

Billing Project
{{ row['billing_project'] }} {{ row['accrued_cost'] }}
+{% endif %} +{% if closed_billing_projects %} +
+

Closed Projects

+ + + + + + + + + + {% for row in closed_billing_projects %} + + + + {% if is_developer %} + + {% else %} + + {% endif %} + + {% endfor %} + +
Billing ProjectAccrued CostLimit
{{ row['billing_project'] }}{{ row['accrued_cost'] }} +
+ + + +
+
{{ row['limit'] }}
+
+{% endif %} {% endblock %} \ No newline at end of file