Extract user info into separate field
All checks were successful
Tests / test (push) Successful in 25s

This commit is contained in:
Tobias Kunze 2025-09-05 15:50:53 +02:00 committed by Tobias Brunner
parent 09baaa5786
commit 7acadea447
Signed by: tobru
SSH key fingerprint: SHA256:kOXg1R6c11XW3/Pt9dbLdQvOJGFAy+B2K6v6PtRWBGQ
6 changed files with 73 additions and 65 deletions

View file

@ -7,7 +7,7 @@ from servala.core.models import ControlPlane, ServiceDefinition
CONTROL_PLANE_USER_INFO_SCHEMA = {
"type": "object",
"properties": {
"cname": {
"CNAME Record": {
"title": "CNAME Record",
"type": "string",
},

View file

@ -1,23 +0,0 @@
# Generated by Django 5.2.4 on 2025-09-04 11:29
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("core", "0005_organization_sale_order_fields"),
]
operations = [
migrations.AddField(
model_name="controlplane",
name="user_info",
field=models.JSONField(
blank=True,
help_text="Key-value information displayed to users when selecting this control plane",
null=True,
verbose_name="User Information",
),
),
]

View file

@ -0,0 +1,43 @@
# Generated by Django 5.2.6 on 2025-09-08 07:14
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("core", "0006_remove_service_instance_soft_delete"),
]
operations = [
migrations.AddField(
model_name="controlplane",
name="user_info",
field=models.JSONField(
blank=True,
help_text="Key-value information displayed to users when selecting this control plane",
null=True,
verbose_name="User Information",
),
),
migrations.AlterField(
model_name="cloudprovider",
name="external_links",
field=models.JSONField(
blank=True,
help_text='JSON array of link objects: {"url": "", "title": ""}. ',
null=True,
verbose_name="External links",
),
),
migrations.AlterField(
model_name="service",
name="external_links",
field=models.JSONField(
blank=True,
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.',
null=True,
verbose_name="External links",
),
),
]

View file

@ -102,27 +102,7 @@
</div>
</div>
{% endif %}
{% if instance.context.control_plane.user_info %}
<div class="card">
<div class="card-header">
<h4 class="card-title">{% translate "Service Provider Information" %}</h4>
</div>
<div class="card-content">
<div class="table-responsive">
<table class="table mb-0 table-lg">
<tbody>
{% for key, value in instance.context.control_plane.user_info.items %}
<tr>
<th>{{ key }}</th>
<td>{{ value }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
{% endif %}
{% include "includes/control_plane_user_info.html" with control_plane=instance.context.control_plane %}
</div>
{% if instance.spec and spec_fieldsets %}
<div class="col-12">

View file

@ -8,26 +8,8 @@
{% endblock page_title %}
{% endblock html_title %}
{% partialdef control-plane-info %}
{% if selected_plane and selected_plane.user_info %}
<div class="card">
<div class="card-header">
<h4 class="card-title">{% translate "Service Provider Information" %}</h4>
</div>
<div class="card-content">
<div class="table-responsive">
<table class="table mb-0 table-lg">
<tbody>
{% for key, value in selected_plane.user_info.items %}
<tr>
<th>{{ key }}</th>
<td>{{ value }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
{% if selected_plane %}
{% include "includes/control_plane_user_info.html" with control_plane=selected_plane %}
{% endif %}
{% endpartialdef %}
{% partialdef service-form %}

View file

@ -0,0 +1,26 @@
{% load i18n %}
{% comment %}
Reusable snippet for displaying ControlPlane user_info
Usage: {% include "includes/control_plane_user_info.html" with control_plane=control_plane_object %}
{% endcomment %}
{% if control_plane.user_info %}
<div class="card">
<div class="card-header">
<h4 class="card-title">{% translate "Service Provider Zone Information" %}</h4>
</div>
<div class="card-content">
<div class="table-responsive">
<table class="table mb-0 table-lg">
<tbody>
{% for key, value in control_plane.user_info.items %}
<tr>
<th>{{ key }}</th>
<td>{{ value }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
{% endif %}