Extract user info into separate field
All checks were successful
Tests / test (push) Successful in 25s
All checks were successful
Tests / test (push) Successful in 25s
This commit is contained in:
parent
09baaa5786
commit
7acadea447
6 changed files with 73 additions and 65 deletions
|
|
@ -7,7 +7,7 @@ from servala.core.models import ControlPlane, ServiceDefinition
|
||||||
CONTROL_PLANE_USER_INFO_SCHEMA = {
|
CONTROL_PLANE_USER_INFO_SCHEMA = {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
"cname": {
|
"CNAME Record": {
|
||||||
"title": "CNAME Record",
|
"title": "CNAME Record",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -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",
|
|
||||||
),
|
|
||||||
),
|
|
||||||
]
|
|
||||||
|
|
@ -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",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
]
|
||||||
|
|
@ -102,27 +102,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if instance.context.control_plane.user_info %}
|
{% include "includes/control_plane_user_info.html" with control_plane=instance.context.control_plane %}
|
||||||
<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 %}
|
|
||||||
</div>
|
</div>
|
||||||
{% if instance.spec and spec_fieldsets %}
|
{% if instance.spec and spec_fieldsets %}
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
|
|
|
||||||
|
|
@ -8,26 +8,8 @@
|
||||||
{% endblock page_title %}
|
{% endblock page_title %}
|
||||||
{% endblock html_title %}
|
{% endblock html_title %}
|
||||||
{% partialdef control-plane-info %}
|
{% partialdef control-plane-info %}
|
||||||
{% if selected_plane and selected_plane.user_info %}
|
{% if selected_plane %}
|
||||||
<div class="card">
|
{% include "includes/control_plane_user_info.html" with control_plane=selected_plane %}
|
||||||
<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>
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endpartialdef %}
|
{% endpartialdef %}
|
||||||
{% partialdef service-form %}
|
{% partialdef service-form %}
|
||||||
|
|
|
||||||
|
|
@ -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 %}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue