display storage plans
This commit is contained in:
parent
d987f62471
commit
7b93830df2
2 changed files with 47 additions and 1 deletions
|
@ -112,6 +112,41 @@
|
|||
{% if representative_plan.compute_plan_group_node_label %}
|
||||
<p class="text-muted mb-3"><strong>Node Label:</strong> <code>{{ representative_plan.compute_plan_group_node_label }}</code></p>
|
||||
{% endif %}
|
||||
|
||||
{# Display storage pricing for this cloud provider #}
|
||||
{% if representative_plan.storage_plans %}
|
||||
<div class="mb-3">
|
||||
<p class="text-muted mb-2"><strong>Storage Options:</strong></p>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-sm table-bordered">
|
||||
<thead class="table-secondary">
|
||||
<tr>
|
||||
<th>Storage Plan</th>
|
||||
<th>Term</th>
|
||||
<th>Unit</th>
|
||||
<th>Prices</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for storage_plan in representative_plan.storage_plans %}
|
||||
<tr>
|
||||
<td>{{ storage_plan.name }}</td>
|
||||
<td>{{ storage_plan.get_term_display }}</td>
|
||||
<td>{{ storage_plan.get_unit_display }}</td>
|
||||
<td>
|
||||
{% for price in storage_plan.prices.all %}
|
||||
<span class="badge bg-light text-dark me-1">{{ price.amount }} {{ price.currency }}</span>
|
||||
{% empty %}
|
||||
<span class="text-muted">No prices</span>
|
||||
{% endfor %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
|
|
@ -2,7 +2,12 @@ import re
|
|||
|
||||
from django.shortcuts import render
|
||||
from collections import defaultdict
|
||||
from hub.services.models import ComputePlan, VSHNAppCatPrice, ExternalPricePlans
|
||||
from hub.services.models import (
|
||||
ComputePlan,
|
||||
VSHNAppCatPrice,
|
||||
ExternalPricePlans,
|
||||
StoragePlan,
|
||||
)
|
||||
from django.contrib.admin.views.decorators import staff_member_required
|
||||
from django.db import models
|
||||
|
||||
|
@ -235,6 +240,11 @@ def pricelist(request):
|
|||
|
||||
group_name = plan.group.name if plan.group else "No Group"
|
||||
|
||||
# Get storage plans for this cloud provider
|
||||
storage_plans = StoragePlan.objects.filter(
|
||||
cloud_provider=plan.cloud_provider
|
||||
).prefetch_related("prices")
|
||||
|
||||
# Add pricing data to the grouped structure
|
||||
pricing_data_by_group_and_service_level[group_name][
|
||||
service_level_display
|
||||
|
@ -250,6 +260,7 @@ def pricelist(request):
|
|||
"compute_plan_group_node_label": (
|
||||
plan.group.node_label if plan.group else ""
|
||||
),
|
||||
"storage_plans": storage_plans,
|
||||
"vcpus": plan.vcpus,
|
||||
"ram": plan.ram,
|
||||
"cpu_mem_ratio": plan.cpu_mem_ratio,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue