Compare commits

..

2 commits

Author SHA1 Message Date
ad3f06d6ff
deploy to night maint nodes
All checks were successful
Build and Deploy / build (push) Successful in 34s
Build and Deploy / deploy (push) Successful in 4s
2025-03-17 09:24:07 +01:00
5bad139d03
correct ordering of services in provider 2025-03-17 09:18:54 +01:00
4 changed files with 30 additions and 3 deletions

View file

@ -16,6 +16,8 @@ spec:
labels: labels:
app: servala app: servala
spec: spec:
nodeSelector:
appuio.io/node-class: nokto
imagePullSecrets: imagePullSecrets:
- name: gitlab-pull-secret - name: gitlab-pull-secret
containers: containers:

View file

@ -101,7 +101,14 @@ class ExternalLinkInline(admin.TabularInline):
@admin.register(Service) @admin.register(Service)
class ServiceAdmin(admin.ModelAdmin): class ServiceAdmin(admin.ModelAdmin):
list_display = ("name", "logo_preview", "category_list", "partner_list") list_display = (
"name",
"logo_preview",
"category_list",
"is_featured",
"is_coming_soon",
"disable_listing",
)
list_filter = ("categories",) list_filter = ("categories",)
search_fields = ("name", "description", "slug") search_fields = ("name", "description", "slug")
prepopulated_fields = {"slug": ("name",)} prepopulated_fields = {"slug": ("name",)}

View file

@ -145,7 +145,7 @@
<div class="pt-40"> <div class="pt-40">
<h3 class="fs-24 fw-semibold lh-1 mb-12" id="services" style="scroll-margin-top: 100px;">Available Services</h3> <h3 class="fs-24 fw-semibold lh-1 mb-12" id="services" style="scroll-margin-top: 100px;">Available Services</h3>
<div class="row"> <div class="row">
{% for offering in provider.offerings.all %} {% for offering in ordered_offerings %}
<div class="col-12 col-md-6 mb-30"> <div class="col-12 col-md-6 mb-30">
<div class="card h-100 d-flex flex-column"> <div class="card h-100 d-flex flex-column">
{% if offering.service.logo or offering.service.is_featured %} {% if offering.service.logo or offering.service.is_featured %}

View file

@ -2,6 +2,7 @@ from django.shortcuts import render, get_object_or_404
from django.db.models import Q from django.db.models import Q
from hub.services.models import ( from hub.services.models import (
Service, Service,
ServiceOffering,
CloudProvider, CloudProvider,
) )
@ -39,13 +40,30 @@ def provider_detail(request, slug):
# Get all services offered by this provider through offerings # Get all services offered by this provider through offerings
services = ( services = (
Service.objects.filter(offerings__cloud_provider=provider) Service.objects.filter(
offerings__cloud_provider=provider, disable_listing=False
)
.distinct() .distinct()
.prefetch_related("categories") .prefetch_related("categories")
) )
# Get the provider's offerings and sort them by service attributes
# Exclude offerings with disabled services
ordered_offerings = (
ServiceOffering.objects.filter(
cloud_provider=provider, service__disable_listing=False
)
.select_related("service")
.order_by(
"-service__is_featured", # Featured first (True before False)
"service__is_coming_soon", # Coming soon last (False before True)
"service__name", # Alphabetically within each group
)
)
context = { context = {
"provider": provider, "provider": provider,
"services": services, "services": services,
"ordered_offerings": ordered_offerings,
} }
return render(request, "services/provider_detail.html", context) return render(request, "services/provider_detail.html", context)