mirror of
https://github.com/bunkerity/bunkerweb
synced 2026-05-24 09:28:37 +00:00
avoid multiple action on pro disabled
This commit is contained in:
parent
0017e725a4
commit
2a061df417
2 changed files with 25 additions and 6 deletions
|
|
@ -1149,7 +1149,11 @@ class Settings {
|
|||
|
||||
setDisabledByMethod(inp, method) {
|
||||
// Check if pro
|
||||
const proDisabled = inp.closest('[data-plugin-item]').hasAttribute('data-pro-disabled') ? true : false;
|
||||
const proDisabled = inp
|
||||
.closest("[data-plugin-item]")
|
||||
.hasAttribute("data-pro-disabled")
|
||||
? true
|
||||
: false;
|
||||
if (proDisabled) return inp.setAttribute("disabled", "");
|
||||
if (method === "ui" || method === "default") {
|
||||
inp.removeAttribute("disabled");
|
||||
|
|
@ -1272,12 +1276,16 @@ class Settings {
|
|||
inp.setAttribute("data-method", method);
|
||||
}
|
||||
|
||||
const proDisabled = inp.closest('[data-plugin-item]').hasAttribute('data-pro-disabled') ? true : false;
|
||||
const proDisabled = inp
|
||||
.closest("[data-plugin-item]")
|
||||
.hasAttribute("data-pro-disabled")
|
||||
? true
|
||||
: false;
|
||||
|
||||
if (proDisabled) return inp.setAttribute("disabled", "");
|
||||
|
||||
if (this.forceEnabled) return inp.removeAttribute("disabled");
|
||||
|
||||
if (this.forceEnabled) return inp.removeAttribute("disabled");
|
||||
|
||||
if (method === "ui" || method === "default") {
|
||||
inp.removeAttribute("disabled");
|
||||
} else {
|
||||
|
|
@ -1285,7 +1293,6 @@ class Settings {
|
|||
}
|
||||
|
||||
if (global) inp.removeAttribute("disabled");
|
||||
|
||||
});
|
||||
} catch (err) {}
|
||||
}
|
||||
|
|
@ -1324,6 +1331,7 @@ class SettingsMultiple extends Settings {
|
|||
.closest("button")
|
||||
.hasAttribute(`data-${this.prefix}-multiple-add`)
|
||||
) {
|
||||
if (this.isAvoidAction(e.target)) return;
|
||||
//get plugin from btn
|
||||
const btn = e.target.closest("button");
|
||||
const attName = btn.getAttribute(`data-${this.prefix}-multiple-add`);
|
||||
|
|
@ -1391,6 +1399,7 @@ class SettingsMultiple extends Settings {
|
|||
.closest("button")
|
||||
.hasAttribute(`data-${this.prefix}-multiple-delete`)
|
||||
) {
|
||||
if (this.isAvoidAction(e.target)) return;
|
||||
// We are not removing it really, just hiding it and update values to default
|
||||
// By setting default value, group will be send to server and delete (because a setting with default value is useless to keep)
|
||||
const multContainer = e.target.closest(
|
||||
|
|
@ -1450,6 +1459,16 @@ class SettingsMultiple extends Settings {
|
|||
});
|
||||
}
|
||||
|
||||
isAvoidAction(target) {
|
||||
// check that not disabled pro plugin
|
||||
const proDisabled = target
|
||||
.closest("[data-plugin-item]")
|
||||
.hasAttribute("data-pro-disabled")
|
||||
? true
|
||||
: false;
|
||||
return true;
|
||||
}
|
||||
|
||||
removePrevMultiples() {
|
||||
const multiPlugins = this.container.querySelectorAll(
|
||||
`[data-${this.prefix}-settings-multiple]`,
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@
|
|||
}
|
||||
|
||||
.custom-select-btn {
|
||||
@apply disabled:opacity-75 dark:disabled:text-gray-300 disabled:text-gray-700 disabled:bg-gray-400 disabled:border-gray-400 dark:disabled:bg-gray-800 dark:disabled:border-gray-800 duration-300 ease-in-out dark:border-slate-600 dark:bg-slate-700 dark:text-gray-200 focus:border-primary flex justify-between align-middle items-center text-left text-sm leading-5.6 w-full rounded-lg border border-solid border-gray-300 bg-white bg-clip-padding px-1.5 py-1 md:px-3 md:py-2 font-normal text-gray-700 transition-all placeholder:text-gray-500;
|
||||
@apply min-h-[38px] disabled:opacity-75 dark:disabled:text-gray-300 disabled:text-gray-700 disabled:bg-gray-400 disabled:border-gray-400 dark:disabled:bg-gray-800 dark:disabled:border-gray-800 duration-300 ease-in-out dark:border-slate-600 dark:bg-slate-700 dark:text-gray-200 focus:border-primary flex justify-between align-middle items-center text-left text-sm leading-5.6 w-full rounded-lg border border-solid border-gray-300 bg-white bg-clip-padding px-1.5 py-1 md:px-3 md:py-2 font-normal text-gray-700 transition-all placeholder:text-gray-500;
|
||||
}
|
||||
|
||||
.custom-dropdown-btn {
|
||||
|
|
|
|||
Loading…
Reference in a new issue