Revert "regular inp and multiple global=true are enabled"
This reverts commit 9ceaaa8746
.
This commit is contained in:
parent
9ceaaa8746
commit
5c50f57f1c
|
@ -151,7 +151,6 @@ class ServiceModal {
|
|||
//for all other settings values
|
||||
const defaultMethod = inp.getAttribute("data-default-method");
|
||||
const defaultVal = inp.getAttribute("data-default-value");
|
||||
const defaultGlobal = inp.getAttribute("data-default-global");
|
||||
|
||||
//SET VALUE
|
||||
if (inp.getAttribute("type") === "checkbox") {
|
||||
|
@ -170,15 +169,13 @@ class ServiceModal {
|
|||
}
|
||||
|
||||
//SET METHOD
|
||||
this.setDisabled(inp, defaultMethod, defaultGlobal);
|
||||
this.setDisabled(inp, defaultMethod);
|
||||
});
|
||||
|
||||
const selects = this.modal.querySelectorAll("select");
|
||||
selects.forEach((select) => {
|
||||
//for all other settings values
|
||||
const defaultMethod = select.getAttribute("data-default-method");
|
||||
const defaultVal = select.getAttribute("data-default-value");
|
||||
const defaultGlobal = select.getAttribute("data-default-global");
|
||||
const defaultMethod = "default";
|
||||
const defaultVal = select.getAttribute("data-default-value") || "";
|
||||
|
||||
document
|
||||
.querySelector(
|
||||
|
@ -194,18 +191,15 @@ class ServiceModal {
|
|||
)
|
||||
.click();
|
||||
|
||||
this.setDisabled(select, defaultMethod, defaultGlobal);
|
||||
this.setDisabled(select, defaultMethod);
|
||||
});
|
||||
}
|
||||
|
||||
setDisabled(inp, method, global) {
|
||||
console.log(inp, method, global);
|
||||
if (global === "true") return inp.removeAttribute("disabled");
|
||||
|
||||
setDisabled(inp, method) {
|
||||
if (method === "ui" || method === "default") {
|
||||
return inp.removeAttribute("disabled");
|
||||
inp.removeAttribute("disabled");
|
||||
} else {
|
||||
return inp.setAttribute("disabled", "");
|
||||
inp.setAttribute("disabled", "");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -291,7 +285,6 @@ class ServiceModal {
|
|||
inps.forEach((inp) => {
|
||||
//form related values are excludes
|
||||
const inpName = inp.getAttribute("name");
|
||||
const inpGlobal = inp.getAttribute("data-default-global");
|
||||
if (
|
||||
inpName === "csrf_token" ||
|
||||
inpName === "OLD_SERVER_NAME" ||
|
||||
|
@ -333,7 +326,7 @@ class ServiceModal {
|
|||
}
|
||||
|
||||
//check disabled/enabled after setting values and methods
|
||||
this.setDisabled(inp, method, inpGlobal);
|
||||
this.setDisabled(inp, method);
|
||||
});
|
||||
} catch (err) {}
|
||||
}
|
||||
|
@ -392,7 +385,6 @@ class Multiple {
|
|||
const sortMultiples =
|
||||
this.sortMultipleByContainerAndSuffixe(multipleSettings);
|
||||
this.setMultipleToDOM(sortMultiples);
|
||||
this.setDisabledMult();
|
||||
}
|
||||
} catch (err) {}
|
||||
//new button
|
||||
|
@ -448,7 +440,7 @@ class Multiple {
|
|||
//clone schema to create a group with new num
|
||||
const schemaClone = schema.cloneNode(true);
|
||||
this.changeCloneSuffix(schemaClone, setNum);
|
||||
this.setDisabledMult();
|
||||
this.setDisabled();
|
||||
this.showClone(schema, schemaClone);
|
||||
//insert new group before first one
|
||||
//show all groups
|
||||
|
@ -626,7 +618,7 @@ class Multiple {
|
|||
}
|
||||
|
||||
//disabled after update values and method
|
||||
this.setDisabledMult();
|
||||
this.setDisabled();
|
||||
}
|
||||
|
||||
changeCloneSuffix(schemaCtnrClone, suffix) {
|
||||
|
@ -745,7 +737,7 @@ class Multiple {
|
|||
schemaCtnrClone.classList.add("grid");
|
||||
}
|
||||
|
||||
setDisabledMult() {
|
||||
setDisabled() {
|
||||
const multipleCtnr = document.querySelectorAll(
|
||||
"[data-services-settings-multiple]"
|
||||
);
|
||||
|
@ -757,10 +749,7 @@ class Multiple {
|
|||
try {
|
||||
const inps = setting.querySelectorAll("input");
|
||||
inps.forEach((inp) => {
|
||||
const global = inp.getAttribute("data-default-method");
|
||||
if (global === "true") return inp.removeAttribute("disabled");
|
||||
|
||||
const method = inp.getAttribute("data-default-method");
|
||||
const method = inp.getAttribute("data-method") || "default";
|
||||
if (method === "ui" || method === "default") {
|
||||
inp.removeAttribute("disabled");
|
||||
} else {
|
||||
|
@ -772,20 +761,15 @@ class Multiple {
|
|||
try {
|
||||
const selects = setting.querySelectorAll("select");
|
||||
selects.forEach((select) => {
|
||||
//get el
|
||||
const method = select.getAttribute("data-method") || "default";
|
||||
const name = select.getAttribute(
|
||||
"data-services-setting-select-default"
|
||||
);
|
||||
const selDOM = document.querySelector(
|
||||
`button[data-services-setting-select='${name}']`
|
||||
);
|
||||
//logic
|
||||
const method = select.getAttribute("data-default-method");
|
||||
const global = inp.getAttribute("data-default-method");
|
||||
if (global === "true") return selDOM.removeAttribute("disabled");
|
||||
|
||||
if (method === "ui" || method === "default") {
|
||||
selDOM.removeAttribute("disabled");
|
||||
selDOM.removeAttribute("disabled", "");
|
||||
} else {
|
||||
selDOM.setAttribute("disabled", "");
|
||||
}
|
||||
|
|
|
@ -65,9 +65,7 @@ data-plugin-item="{{plugin['id']}}"
|
|||
<div class="relative flex items-center">
|
||||
<input
|
||||
{% if setting == "SERVER_NAME" %}required{%endif%}
|
||||
data-default-value="{{global_config[setting]['value']}}"
|
||||
data-default-method="{{global_config[setting]['method']}}"
|
||||
data-default-global="{% if global_config[setting]['global'] == True %}true{% else %}false{%endif%}"
|
||||
data-default-value="{{global_config[setting]['value']}}" data-default-method="{{global_config[setting]['method']}}"
|
||||
{% if global_config[setting]['method'] != 'ui' and global_config[setting]['method'] != 'default' %} disabled {% endif %} id="{{setting}}" name="{{setting}}"
|
||||
class="regular-input"
|
||||
value="{% if global_config[setting]['value'] %} {{global_config[setting]['value']}} {% else %} {{value['default']}} {% endif %}" type="{{value['type']}}" pattern="{{value['regex']|safe}}" />
|
||||
|
@ -90,10 +88,7 @@ data-plugin-item="{{plugin['id']}}"
|
|||
<!-- select -->
|
||||
{% if value["type"] == "select" %}
|
||||
<!-- default hidden-->
|
||||
<select
|
||||
data-default-method="{{global_config[setting]['method']}}"
|
||||
data-default-value="{{value['default']}}"
|
||||
data-default-global="{% if global_config[setting]['global'] == True %}true{% else %}false{%endif%}"
|
||||
<select data-default-method="{{global_config[setting]['method']}}" data-default-value="{{value['default']}}"
|
||||
id="{{setting}}" name="{{setting}}" data-setting-select-default="{{value['id']}}" data-type="form-select" id="{{setting}}" name="{{setting}}"
|
||||
class="hidden">
|
||||
{% for item in value['select'] %}
|
||||
|
@ -107,9 +102,7 @@ data-plugin-item="{{plugin['id']}}"
|
|||
<button
|
||||
{% if global_config[setting]['method'] != 'ui' and global_config[setting]['method'] != 'default' %} disabled {% endif %} data-setting-select="{{value['id']}}"
|
||||
data-default-value="{{global_config[setting]['value']}}"
|
||||
data-default-method="{{global_config[setting]['method']}}"
|
||||
data-default-global="{% if global_config[setting]['global'] == True %}true{% else %}false{%endif%}"
|
||||
|
||||
data-default-method="{{global_config[setting]['method']}}"
|
||||
type="button"
|
||||
class="custom-select-btn"
|
||||
>
|
||||
|
@ -180,8 +173,6 @@ data-plugin-item="{{plugin['id']}}"
|
|||
<input id="{{setting}}" name="{{setting}}"
|
||||
data-default-method="{% if setting in ["AUTOCONF_MODE", "SWARM_MODE", "KUBERNETES_MODE"] %}mode{% else %}{{global_config[setting]['method']}}{% endif %}"
|
||||
data-default-value="{{global_config[setting]['value']}}"
|
||||
data-default-global="{% if global_config[setting]['global'] == True %}true{% else %}false{%endif%}"
|
||||
|
||||
|
||||
{% if
|
||||
setting in ["AUTOCONF_MODE", "SWARM_MODE", "KUBERNETES_MODE"] or global_config[setting]['method'] != 'ui' and global_config[setting]['method']
|
||||
|
@ -289,12 +280,7 @@ data-plugin-item="{{plugin['id']}}"
|
|||
{% if value["type"] != "select" and value["type"] != "check" %}
|
||||
<div class="relative flex items-center">
|
||||
<input
|
||||
data-default-value="{{value['default']}}"
|
||||
data-default-method="default"
|
||||
data-default-global="{% if global_config[setting]['global'] == True %}true{% else %}false{%endif%}"
|
||||
|
||||
id="{{setting}}_SCHEMA"
|
||||
name="{{setting}}_SCHEMA"
|
||||
data-default-value="{{value['default']}}" data-default-method="default" id="{{setting}}_SCHEMA" name="{{setting}}_SCHEMA"
|
||||
class="regular-input"
|
||||
value="{{value['default']}}" type="{{value['type']}}" pattern="{{value['regex']|safe}}" />
|
||||
|
||||
|
@ -315,11 +301,7 @@ data-plugin-item="{{plugin['id']}}"
|
|||
<!-- select -->
|
||||
{% if value["type"] == "select" %}
|
||||
<!-- default hidden-->
|
||||
<select
|
||||
data-default-method="default"
|
||||
data-default-value="{{value['default']}}"
|
||||
data-default-global="{% if global_config[setting]['global'] == True %}true{% else %}false{%endif%}"
|
||||
|
||||
<select data-default-method="default" data-default-value="{{value['default']}}"
|
||||
id="{{setting}}_SCHEMA" name="{{setting}}_SCHEMA" data-select-default="{{value['id']}}" data-type="form-select" id="{{setting}}" name="{{setting}}"
|
||||
class="hidden">
|
||||
{% for item in value['select'] %}
|
||||
|
@ -333,8 +315,6 @@ data-plugin-item="{{plugin['id']}}"
|
|||
<button
|
||||
data-setting-select="{{value['id']}}"
|
||||
data-default-value="{{value['default']}}"
|
||||
data-default-global="{% if global_config[setting]['global'] == True %}true{% else %}false{%endif%}"
|
||||
|
||||
type="button"
|
||||
class="custom-select-btn"
|
||||
>
|
||||
|
@ -395,7 +375,6 @@ data-plugin-item="{{plugin['id']}}"
|
|||
<div data-checkbox-handler="{{value['id']}}" class="relative mb-7 md:mb-0">
|
||||
<input id="{{setting}}_SCHEMA" name="{{setting}}_SCHEMA"
|
||||
data-default-method="default"
|
||||
data-default-global="{% if global_config[setting]['global'] == True %}true{% else %}false{%endif%}"
|
||||
data-default-value="{{value['default']}}" {% if value['default'] == 'yes' %} checked {%
|
||||
endif %} id="checkbox-{{value['id']}}"
|
||||
class="checkbox" type="checkbox" data-pattern="{{value['regex']|safe}}"
|
||||
|
|
Loading…
Reference in New Issue