This commit is contained in:
parent
59e7a75c51
commit
ca485978b9
6 changed files with 30 additions and 19 deletions
|
|
@ -192,7 +192,7 @@ class ServiceDefinitionAdminForm(forms.ModelForm):
|
||||||
schema = None
|
schema = None
|
||||||
try:
|
try:
|
||||||
schema = crd.resource_schema
|
schema = crd.resource_schema
|
||||||
except Exception as e:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
if not schema or not (spec_schema := schema.get("properties", {}).get("spec")):
|
if not schema or not (spec_schema := schema.get("properties", {}).get("spec")):
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,11 @@ class Migration(migrations.Migration):
|
||||||
name="form_config",
|
name="form_config",
|
||||||
field=models.JSONField(
|
field=models.JSONField(
|
||||||
blank=True,
|
blank=True,
|
||||||
help_text='Optional custom form configuration. When provided, this configuration will be used to render the service form instead of auto-generating it from the OpenAPI spec. Format: {"fieldsets": [{"title": "Section", "fields": [{...}]}]}',
|
help_text=(
|
||||||
|
"Optional custom form configuration. When provided, this configuration will "
|
||||||
|
"be used to render the service form instead of auto-generating it from the OpenAPI spec. "
|
||||||
|
'Format: {"fieldsets": [{"title": "Section", "fields": [{...}]}]}'
|
||||||
|
),
|
||||||
null=True,
|
null=True,
|
||||||
verbose_name="Form Configuration",
|
verbose_name="Form Configuration",
|
||||||
),
|
),
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,9 @@
|
||||||
</div>
|
</div>
|
||||||
{% for provider in socialaccount_providers %}
|
{% for provider in socialaccount_providers %}
|
||||||
{% provider_login_url provider process=process scope=scope auth_params=auth_params as href %}
|
{% provider_login_url provider process=process scope=scope auth_params=auth_params as href %}
|
||||||
<form method="post" action="{{ href }}" class="d-flex justify-content-center">
|
<form method="post"
|
||||||
|
action="{{ href }}"
|
||||||
|
class="d-flex justify-content-center">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
{{ redirect_field }}
|
{{ redirect_field }}
|
||||||
<button type="submit"
|
<button type="submit"
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,9 @@
|
||||||
<i class="bi bi-exclamation-triangle-fill me-2"></i>
|
<i class="bi bi-exclamation-triangle-fill me-2"></i>
|
||||||
<div>
|
<div>
|
||||||
<strong>{% translate "Service Unavailable" %}</strong>
|
<strong>{% translate "Service Unavailable" %}</strong>
|
||||||
<p class="mb-0">{% translate "We currently cannot offer this service. Please check back later or contact support for more information." %}</p>
|
<p class="mb-0">
|
||||||
|
{% translate "We currently cannot offer this service. Please check back later or contact support for more information." %}
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -4,9 +4,7 @@
|
||||||
{% for info in control_plane.user_info %}
|
{% for info in control_plane.user_info %}
|
||||||
<div class="info-item mb-3">
|
<div class="info-item mb-3">
|
||||||
<div class="d-flex align-items-center mb-1">
|
<div class="d-flex align-items-center mb-1">
|
||||||
<small class="text-muted fw-semibold">
|
<small class="text-muted fw-semibold">{{ info.title }}</small>
|
||||||
{{ info.title }}
|
|
||||||
</small>
|
|
||||||
{% if info.help_text %}
|
{% if info.help_text %}
|
||||||
<i class="bi bi-info-circle ms-1 text-muted"
|
<i class="bi bi-info-circle ms-1 text-muted"
|
||||||
data-bs-toggle="popover"
|
data-bs-toggle="popover"
|
||||||
|
|
@ -14,7 +12,7 @@
|
||||||
data-bs-placement="top"
|
data-bs-placement="top"
|
||||||
data-bs-content="{{ info.help_text }}"
|
data-bs-content="{{ info.help_text }}"
|
||||||
style="cursor: help;
|
style="cursor: help;
|
||||||
font-size: 0.875rem;"></i>
|
font-size: 0.875rem"></i>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
<div class="bg-light-subtle p-2 rounded">
|
<div class="bg-light-subtle p-2 rounded">
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,8 @@
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<div id="custom-form-container" class="{% if form %}custom-crd-form{% else %}expert-crd-form{% endif %}">
|
<div id="custom-form-container"
|
||||||
|
class="{% if form %}custom-crd-form{% else %}expert-crd-form{% endif %}">
|
||||||
{% if form and form.context %}{{ form.context }}{% endif %}
|
{% if form and form.context %}{{ form.context }}{% endif %}
|
||||||
{% if form and form.get_fieldsets|length == 1 %}
|
{% if form and form.get_fieldsets|length == 1 %}
|
||||||
{# Single fieldset - render without tabs #}
|
{# Single fieldset - render without tabs #}
|
||||||
|
|
@ -41,8 +42,7 @@
|
||||||
<ul class="nav nav-tabs" id="myTab" role="tablist">
|
<ul class="nav nav-tabs" id="myTab" role="tablist">
|
||||||
{% for fieldset in form.get_fieldsets %}
|
{% for fieldset in form.get_fieldsets %}
|
||||||
{% if not fieldset.hidden %}
|
{% if not fieldset.hidden %}
|
||||||
<li class="nav-item"
|
<li class="nav-item" role="presentation">
|
||||||
role="presentation">
|
|
||||||
<button class="nav-link {% if forloop.first %}active{% endif %}{% if fieldset.has_mandatory %} has-mandatory{% endif %}"
|
<button class="nav-link {% if forloop.first %}active{% endif %}{% if fieldset.has_mandatory %} has-mandatory{% endif %}"
|
||||||
id="{{ fieldset.title|slugify }}-tab"
|
id="{{ fieldset.title|slugify }}-tab"
|
||||||
data-bs-toggle="tab"
|
data-bs-toggle="tab"
|
||||||
|
|
@ -83,12 +83,13 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
{% if form and expert_form %}
|
{% if form and expert_form %}
|
||||||
<div id="expert-form-container" class="expert-crd-form" style="display:none;">
|
<div id="expert-form-container"
|
||||||
|
class="expert-crd-form"
|
||||||
|
style="display:none">
|
||||||
<ul class="nav nav-tabs" id="expertTab" role="tablist">
|
<ul class="nav nav-tabs" id="expertTab" role="tablist">
|
||||||
{% for fieldset in expert_form.get_fieldsets %}
|
{% for fieldset in expert_form.get_fieldsets %}
|
||||||
{% if not fieldset.hidden %}
|
{% if not fieldset.hidden %}
|
||||||
<li class="nav-item"
|
<li class="nav-item" role="presentation">
|
||||||
role="presentation">
|
|
||||||
<button class="nav-link {% if forloop.first %}active{% endif %}{% if fieldset.has_mandatory %} has-mandatory{% endif %}"
|
<button class="nav-link {% if forloop.first %}active{% endif %}{% if fieldset.has_mandatory %} has-mandatory{% endif %}"
|
||||||
id="expert-{{ fieldset.title|slugify }}-tab"
|
id="expert-{{ fieldset.title|slugify }}-tab"
|
||||||
data-bs-toggle="tab"
|
data-bs-toggle="tab"
|
||||||
|
|
@ -129,13 +130,17 @@
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if form %}
|
{% if form %}
|
||||||
<input type="hidden" name="active_form" id="active-form-input" value="custom">
|
<input type="hidden"
|
||||||
|
name="active_form"
|
||||||
|
id="active-form-input"
|
||||||
|
value="custom">
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<div class="col-sm-12 d-flex justify-content-end">
|
<div class="col-sm-12 d-flex justify-content-end">
|
||||||
<input class="btn btn-primary me-1 mb-1" type="submit"
|
{# browser form validation fails when there are fields missing/invalid that are hidden #}
|
||||||
{% if form and expert_form %}formnovalidate {% endif %} {# browser form validation fails when there are fields missing/invalid that are hidden #}
|
<input class="btn btn-primary me-1 mb-1"
|
||||||
value="{% if form_submit_label %}{{ form_submit_label }}{% else %}{% translate "Save" %}{% endif %}"
|
type="submit"
|
||||||
>
|
{% if form and expert_form %}formnovalidate{% endif %}
|
||||||
|
value="{% if form_submit_label %}{{ form_submit_label }}{% else %}{% translate "Save" %}{% endif %}" />
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
{% if form %}
|
{% if form %}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue