mirror of
https://github.com/bunkerity/bunkerweb
synced 2026-05-24 09:28:37 +00:00
Refactor plugin deletion logic and fix dropdown styling
This commit is contained in:
parent
4e2c0a1908
commit
f6566235ac
4 changed files with 9 additions and 11 deletions
|
|
@ -999,9 +999,9 @@ def plugins():
|
|||
if variables["type"] in ("core", "pro"):
|
||||
return redirect_flash_error(f"Can't delete {variables['type']} plugin {variables['name']}", "plugins", True)
|
||||
|
||||
plugins = app.config["CONFIG"].get_plugins()
|
||||
for x, plugin in enumerate(deepcopy(plugins)):
|
||||
if plugin["type"] in ("core", "pro") or plugin["id"] == variables["name"]:
|
||||
plugins = app.config["CONFIG"].get_plugins(_type="external")
|
||||
for x, plugin in enumerate(plugins):
|
||||
if plugin["id"] == variables["name"]:
|
||||
del plugins[x]
|
||||
|
||||
err = db.update_external_plugins(plugins)
|
||||
|
|
|
|||
|
|
@ -442,7 +442,7 @@ class Modal {
|
|||
this.container = document.querySelector(`[data-${this.prefix}-list]`);
|
||||
this.modal = document.querySelector(`[data-${this.prefix}-modal]`);
|
||||
this.modalNameInp = this.modal.querySelector("input#name");
|
||||
this.modalExtInp = this.modal.querySelector("input#external");
|
||||
this.modalTypeInp = this.modal.querySelector("input#type");
|
||||
|
||||
this.modalTitle = this.modal.querySelector(
|
||||
`[data-${this.prefix}-modal-title]`,
|
||||
|
|
@ -490,14 +490,11 @@ class Modal {
|
|||
this.modalTitle.textContent = `DELETE ${elName}`;
|
||||
this.modalTxt.textContent = `Are you sure you want to delete ${elName} ?`;
|
||||
//external
|
||||
const isExternal = el
|
||||
const pluginType = el
|
||||
.closest("[data-plugins-type]")
|
||||
.getAttribute("data-plugins-type")
|
||||
.trim()
|
||||
.includes("external")
|
||||
? "True"
|
||||
: "False";
|
||||
this.modalExtInp.value = isExternal;
|
||||
.trim();
|
||||
this.modalTypeInp.value = pluginType;
|
||||
}
|
||||
|
||||
showModal() {
|
||||
|
|
|
|||
1
src/ui/templates/plugins_modal.html
vendored
1
src/ui/templates/plugins_modal.html
vendored
|
|
@ -26,6 +26,7 @@
|
|||
<input type="hidden" name="external" id="external" />
|
||||
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}" />
|
||||
<input type="hidden" value="name" name="name" id="name" />
|
||||
<input type="hidden" value="external" name="type" id="type" />
|
||||
<input type="hidden" value="delete" name="operation" id="operation" />
|
||||
<div>
|
||||
<p aria-description="delete plugin message"
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ try:
|
|||
if TEST_TYPE == "linux":
|
||||
wait_for_service()
|
||||
|
||||
external_plugins = safe_get_element(DRIVER, By.XPATH, "//div[@data-plugins-external=' external ']", multiple=True)
|
||||
external_plugins = safe_get_element(DRIVER, By.XPATH, "//div[@data-plugins-type='external']", multiple=True)
|
||||
assert isinstance(external_plugins, list), "External plugins list is not a list"
|
||||
|
||||
if len(external_plugins) != 1:
|
||||
|
|
|
|||
Loading…
Reference in a new issue