Fix shenanigans with cloned services using the autoconf method

This commit is contained in:
Théophile Diot 2024-11-22 12:34:54 +01:00
parent cd5c5821b8
commit af3d7b0fa4
No known key found for this signature in database
GPG key ID: FA995104A0BA376A
2 changed files with 18 additions and 16 deletions

View file

@ -186,24 +186,25 @@
{% set setting_method = setting_config.get("method", "default") %}
{% set setting_template = setting_config.get("template", "") %}
{% set disabled = setting_method not in ('ui', 'default') and (current_endpoint == "global-config" or not setting_config.get("global")) %}
{% if current_endpoint == "new" %}
{% if service_method == "autoconf" %}
{% set setting_method = "autoconf" %}
{% set disabled = true %}
{% endif %}
{% if current_endpoint == "new" or clone %}
{% set setting_method = "default" %}
{% set disabled = false %}
{% if setting == "SERVER_NAME" %}
{% set setting_value = "" %}
{% endif %}
{% endif %}
{% if service_method == "autoconf" %}
{% set setting_method = "autoconf" %}
{% if is_readonly %}
{% set disabled = true %}
{% set setting_method = "readonly" %}
{% endif %}
{% if plugin_data["type"] == "pro" and not is_pro_version %}
{% set disabled = true %}
{% set setting_method = "<i class='bx bx-diamond bx-xs'></i><span>Pro feature</span>" %}
{% endif %}
{% if is_readonly %}
{% set disabled = true %}
{% set setting_method = "readonly" %}
{% endif %}
<div class="col-12 col-sm-6 col-lg-4 pb-3"
{% if disabled %}data-bs-toggle="tooltip" data-bs-placement="top" data-bs-html="true" data-bs-original-title="Disabled by {{ setting_method }}"{% endif %}>
<div class="d-flex justify-content-between align-items-center">
@ -331,21 +332,22 @@
{% set setting_method = setting_config.get("method", "default") %}
{% set setting_template = setting_config.get("template", "") %}
{% set disabled = setting_method not in ('ui', 'default') and (current_endpoint == "global-config" or not setting_config.get("global")) %}
{% if current_endpoint == "new" %}
{% set disabled = false %}
{% endif %}
{% if service_method == "autoconf" %}
{% set setting_method = "autoconf" %}
{% set disabled = true %}
{% endif %}
{% if plugin_data["type"] == "pro" and not is_pro_version %}
{% set disabled = true %}
{% set setting_method = "<i class='bx bx-diamond bx-xs'></i><span>Pro feature</span>" %}
{% if current_endpoint == "new" or clone %}
{% set setting_method = "default" %}
{% set disabled = false %}
{% endif %}
{% if is_readonly %}
{% set disabled = true %}
{% set setting_method = "readonly" %}
{% endif %}
{% if plugin_data["type"] == "pro" and not is_pro_version %}
{% set disabled = true %}
{% set setting_method = "<i class='bx bx-diamond bx-xs'></i><span>Pro feature</span>" %}
{% endif %}
<div class="col-12{% if settings|length > 1 %} col-md-6{% endif %}{% if settings|length > 2 and not multiple_multiples %} col-lg-4{% endif %} pb-2"
{% if disabled %}data-bs-toggle="tooltip" data-bs-placement="top" data-bs-html="true" data-bs-original-title="Disabled by {{ setting_method }}"{% endif %}>
<div class="d-flex justify-content-between align-items-center">

View file

@ -2,7 +2,7 @@
{% block content %}
<!-- Content -->
{% set blacklisted_settings = get_blacklisted_settings() %}
{% set service_method = config.get("SERVER_NAME", {"method": "ui"})["method"] %}
{% set service_method = config.get("SERVER_NAME", {"method": "ui"})["method"] if current_endpoint != 'new' and not clone else "ui" %}
{% set is_draft = config.get("IS_DRAFT", {"value": "no"})["value"] %}
{% set template_method = config.get("USE_TEMPLATE", {"method": "ui"})["method"] %}
{% set selected_template = config.get("USE_TEMPLATE", {"value": ""})["value"] %}
@ -29,7 +29,7 @@
id="is-draft"
name="IS_DRAFT"
value="{{ is_draft }}"
data-original="{% if current_endpoint != 'new' or clone %}{{ is_draft }}{% else %}no{% endif %}"
data-original="{% if current_endpoint != 'new' and not clone %}{{ is_draft }}{% else %}no{% endif %}"
data-default="no">
<div class="tab-content p-0 position-relative">
<div class="tab-pane fade{% if mode == 'easy' %} show active{% endif %}"
@ -43,7 +43,7 @@
role="tabpanel">{% include "models/plugins_settings_raw.html" %}</div>
</div>
<div id="feedback-toast"
class="bs-toast toast fade bg-white border border-warning"
class="bs-toast toast fade bg-{% if theme == 'light' %}white{% else %}dark{% endif %} border border-warning"
role="alert"
aria-live="assertive"
aria-atomic="true"