+
+ {{ row.compute_plan }}
+ {% if not row.is_active %}
+ Inactive plan
+ {% endif %}
+ |
{{ row.cloud_provider }} |
{{ row.vcpus }} |
{{ row.ram }} |
diff --git a/hub/services/views/pricelist.py b/hub/services/views/pricelist.py
index b39c975..6e89f97 100644
--- a/hub/services/views/pricelist.py
+++ b/hub/services/views/pricelist.py
@@ -2,12 +2,7 @@ import re
from django.shortcuts import render
from collections import defaultdict
-from hub.services.models import (
- ComputePlan,
- VSHNAppCatPrice,
- ExternalPricePlans,
- StoragePlan,
-)
+from hub.services.models.pricing import ComputePlan, StoragePlan, ExternalPricePlans, VSHNAppCatPrice
from django.contrib.admin.views.decorators import staff_member_required
from django.db import models
@@ -134,8 +129,8 @@ def pricelist(request):
filter_compute_plan_group = request.GET.get("compute_plan_group", "")
filter_service_level = request.GET.get("service_level", "")
- # Fetch all active compute plans with related data (move as much sorting/filtering to DB as possible)
- compute_plans_qs = ComputePlan.objects.filter(active=True)
+ # Fetch all compute plans (active and inactive) with related data
+ compute_plans_qs = ComputePlan.objects.all()
if filter_cloud_provider:
compute_plans_qs = compute_plans_qs.filter(cloud_provider__name=filter_cloud_provider)
if filter_compute_plan_group:
@@ -352,6 +347,7 @@ def pricelist(request):
"internal_comparisons": internal_comparisons,
"mandatory_addons": mandatory_addons,
"optional_addons": optional_addons,
+ "is_active": plan.active,
})
# Order groups correctly, placing "No Group" last
ordered_groups_intermediate = {}
@@ -368,9 +364,9 @@ def pricelist(request):
sl_key: list(plans_list)
for sl_key, plans_list in service_levels_dict.items()
}
- # Get filter options for dropdowns
+ # Get filter options for dropdowns (include all providers/groups from all plans, not just active)
all_cloud_providers = (
- ComputePlan.objects.filter(active=True)
+ ComputePlan.objects.all()
.values_list("cloud_provider__name", flat=True)
.distinct()
.order_by("cloud_provider__name")
@@ -381,7 +377,7 @@ def pricelist(request):
.order_by("service__name")
)
all_compute_plan_groups = list(
- ComputePlan.objects.filter(active=True, group__isnull=False)
+ ComputePlan.objects.filter(group__isnull=False)
.values_list("group__name", flat=True)
.distinct()
.order_by("group__name")