From f4e8d7dcb7b1924ccbf8c54c90de0e9692993415 Mon Sep 17 00:00:00 2001 From: Tobias Kunze Date: Fri, 11 Jul 2025 13:00:23 +0200 Subject: [PATCH 1/8] Make sure service cards have consistent height --- .../frontend/organizations/services.html | 6 +++--- src/servala/static/css/servala.css | 18 ++++++++++++++++++ 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/src/servala/frontend/templates/frontend/organizations/services.html b/src/servala/frontend/templates/frontend/organizations/services.html index 022b6e5..cc1ecc4 100644 --- a/src/servala/frontend/templates/frontend/organizations/services.html +++ b/src/servala/frontend/templates/frontend/organizations/services.html @@ -16,10 +16,10 @@ -
+
{% for service in services %}
-
+
{% if service.logo %} {{ service.category }}
-
+
{% if service.description %}

{{ service.description|urlize }}

{% endif %}
-- 2.47.3 From 5b876de18ab03090141ed4335972609902bd4fa8 Mon Sep 17 00:00:00 2001 From: Tobias Kunze Date: Fri, 11 Jul 2025 13:20:25 +0200 Subject: [PATCH 5/8] Code style --- src/servala/core/models/organization.py | 2 +- .../frontend/templates/account/login.html | 29 +++++++------ .../frontend/templates/frontend/base.html | 9 +++- .../frontend/templates/frontend/profile.html | 3 +- .../templates/includes/k8s_error.html | 22 +++++----- .../frontend/templates/includes/message.html | 43 ++++++++++--------- .../frontend/templatetags/error_filters.py | 1 + src/servala/frontend/views/support.py | 2 +- 8 files changed, 59 insertions(+), 52 deletions(-) diff --git a/src/servala/core/models/organization.py b/src/servala/core/models/organization.py index 57cd660..855e4f0 100644 --- a/src/servala/core/models/organization.py +++ b/src/servala/core/models/organization.py @@ -3,8 +3,8 @@ import urlman from django.conf import settings from django.db import models, transaction from django.utils.functional import cached_property -from django.utils.text import slugify from django.utils.safestring import mark_safe +from django.utils.text import slugify from django.utils.translation import gettext_lazy as _ from django_scopes import ScopedManager, scopes_disabled diff --git a/src/servala/frontend/templates/account/login.html b/src/servala/frontend/templates/account/login.html index 233118b..58cd49b 100644 --- a/src/servala/frontend/templates/account/login.html +++ b/src/servala/frontend/templates/account/login.html @@ -1,21 +1,22 @@ {% extends "frontend/base.html" %} {% load static i18n %} {% load allauth account socialaccount %} - {% block html_title %} {% translate "Sign in" %} {% endblock html_title %} - {% block page_title %} {% translate "Welcome to Servala" %} {% endblock page_title %} - {% block card_header %} -
- Servala +
+ Servala
{% endblock card_header %} - {% block card_content %} {% if SOCIALACCOUNT_ENABLED %} @@ -24,9 +25,10 @@
{% translate "Ready to get started?" %}
-

{% translate "Sign in to access your managed service instances and the Servala service catalog" %}

+

+ {% translate "Sign in to access your managed service instances and the Servala service catalog" %} +

- {% for provider in socialaccount_providers %} {% provider_login_url provider process=process scope=scope auth_params=auth_params as href %}
@@ -35,7 +37,9 @@
@@ -43,7 +47,6 @@
{% endif %} {% endif %} -
- -
diff --git a/src/servala/frontend/templates/frontend/base.html b/src/servala/frontend/templates/frontend/base.html index c2d9285..990dc17 100644 --- a/src/servala/frontend/templates/frontend/base.html +++ b/src/servala/frontend/templates/frontend/base.html @@ -5,13 +5,18 @@ - + - {% block html_title %}Dashboard{% endblock html_title %} – Servala + + {% block html_title %} + Dashboard + {% endblock html_title %} + – Servala diff --git a/src/servala/frontend/templates/frontend/profile.html b/src/servala/frontend/templates/frontend/profile.html index dc12100..b9c1799 100644 --- a/src/servala/frontend/templates/frontend/profile.html +++ b/src/servala/frontend/templates/frontend/profile.html @@ -116,7 +116,8 @@ {% endblocktranslate %}

- {% translate "VSHN Account Console" %} diff --git a/src/servala/frontend/templates/includes/k8s_error.html b/src/servala/frontend/templates/includes/k8s_error.html index f97474d..5707dcc 100644 --- a/src/servala/frontend/templates/includes/k8s_error.html +++ b/src/servala/frontend/templates/includes/k8s_error.html @@ -1,14 +1,12 @@ {% if show_error %} -
- {% if has_list %} - {% if message %}{{ message }}{% endif %} -
    - {% for error in errors %} -
  • {{ error }}
  • - {% endfor %} -
- {% else %} - {{ message }} - {% endif %} -
+
+ {% if has_list %} + {% if message %}{{ message }}{% endif %} +
    + {% for error in errors %}
  • {{ error }}
  • {% endfor %} +
+ {% else %} + {{ message }} + {% endif %} +
{% endif %} diff --git a/src/servala/frontend/templates/includes/message.html b/src/servala/frontend/templates/includes/message.html index d5debc9..278c009 100644 --- a/src/servala/frontend/templates/includes/message.html +++ b/src/servala/frontend/templates/includes/message.html @@ -1,28 +1,29 @@ -
+
{{ message }}
- \ No newline at end of file + document.addEventListener('DOMContentLoaded', function() { + const alert = document.getElementById('auto-dismiss-alert-{{ forloop.counter0|default:' + 0 ' }}'); + if (alert && !alert.classList.contains('alert-danger')) { + setTimeout(function() { + let opacity = 1; + const fadeOutInterval = setInterval(function() { + if (opacity > 0.05) { + opacity -= 0.05; + alert.style.opacity = opacity; + } else { + clearInterval(fadeOutInterval); + const bsAlert = new bootstrap.Alert(alert); + bsAlert.close(); + } + }, 25); + }, 5000); + } + }); + diff --git a/src/servala/frontend/templatetags/error_filters.py b/src/servala/frontend/templatetags/error_filters.py index 18c4c4d..410d49a 100644 --- a/src/servala/frontend/templatetags/error_filters.py +++ b/src/servala/frontend/templatetags/error_filters.py @@ -3,6 +3,7 @@ Template filters for safe error formatting. """ import html + from django import template from django.utils.safestring import mark_safe diff --git a/src/servala/frontend/views/support.py b/src/servala/frontend/views/support.py index 9181c1e..6f4c4aa 100644 --- a/src/servala/frontend/views/support.py +++ b/src/servala/frontend/views/support.py @@ -52,7 +52,7 @@ class SupportView(OrganizationViewMixin, FormView): mark_safe( _( "There was an error submitting your support request. " - "Please try again or contact us directly at servala-support@vshn.ch." + 'Please try again or contact us directly at servala-support@vshn.ch.' ) ), ) -- 2.47.3 From 72920b21ad7fed3530a5bcefb4fb948a90965bc8 Mon Sep 17 00:00:00 2001 From: Tobias Kunze Date: Fri, 1 Aug 2025 13:17:57 +0200 Subject: [PATCH 6/8] Show external links on offering detail page --- .../organizations/service_offering_detail.html | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/servala/frontend/templates/frontend/organizations/service_offering_detail.html b/src/servala/frontend/templates/frontend/organizations/service_offering_detail.html index 184ff49..99115bc 100644 --- a/src/servala/frontend/templates/frontend/organizations/service_offering_detail.html +++ b/src/servala/frontend/templates/frontend/organizations/service_offering_detail.html @@ -49,6 +49,24 @@ {{ select_form }} {% endif %} + {% if service.external_links %} +
+
+
{% translate "External Links" %}
+
+ {% for link in service.external_links %} + + {{ link.title }} + + + {% endfor %} +
+
+
+ {% endif %}
{% partial service-form %}
-- 2.47.3 From e0d05302b51e9364faba9f241782e0b159ded0bd Mon Sep 17 00:00:00 2001 From: Tobias Kunze Date: Fri, 1 Aug 2025 13:19:03 +0200 Subject: [PATCH 7/8] Display service offering description (if any) --- .../frontend/organizations/service_offering_detail.html | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/servala/frontend/templates/frontend/organizations/service_offering_detail.html b/src/servala/frontend/templates/frontend/organizations/service_offering_detail.html index 99115bc..56dc7e2 100644 --- a/src/servala/frontend/templates/frontend/organizations/service_offering_detail.html +++ b/src/servala/frontend/templates/frontend/organizations/service_offering_detail.html @@ -40,6 +40,13 @@
+ {% if offering.description %} +
+
+

{{ offering.description|urlize }}

+
+
+ {% endif %} {% if not has_control_planes %}

{% translate "We currently cannot offer this service, sorry!" %}

{% else %} -- 2.47.3 From 3c14c312d7fb2d304a367594b47877829a5470c3 Mon Sep 17 00:00:00 2001 From: Tobias Kunze Date: Fri, 1 Aug 2025 13:23:25 +0200 Subject: [PATCH 8/8] Document external_links schema --- src/servala/core/models/service.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/servala/core/models/service.py b/src/servala/core/models/service.py index a1f4523..a06db4e 100644 --- a/src/servala/core/models/service.py +++ b/src/servala/core/models/service.py @@ -71,9 +71,14 @@ class Service(ServalaModelMixin, models.Model): logo = models.ImageField( upload_to="public/services", blank=True, null=True, verbose_name=_("Logo") ) - # TODO schema external_links = models.JSONField( - null=True, blank=True, verbose_name=_("External links") + null=True, + blank=True, + verbose_name=_("External links"), + help_text=( + 'JSON array of link objects: {"url": "…", "title": "…", "featured": false}. ' + "Featured links will be shown on the service list page, all other links will only show on the service and offering detail pages." + ), ) class Meta: @@ -270,7 +275,10 @@ class CloudProvider(ServalaModelMixin, models.Model): verbose_name=_("Logo"), ) external_links = models.JSONField( - null=True, blank=True, verbose_name=_("External links") + null=True, + blank=True, + verbose_name=_("External links"), + help_text=('JSON array of link objects: {"url": "…", "title": "…"}. '), ) class Meta: -- 2.47.3