delete service when root only config

This commit is contained in:
Jordan Blasenhauer 2024-03-21 15:57:45 +01:00
parent f095ecdb8c
commit d3ac9dd0e8
4 changed files with 31 additions and 3 deletions

View file

@ -23,7 +23,7 @@
- [UI] Service page : add the possibility to clone a service in the web UI
- [UI] Service page : add the possibility to set a service as draft in the web UI
- [UI] Service page : add services filter when at least 4 services
- [UI] Configs page : add path filtering related to config presence
- [UI] Configs page : add path filtering related to config presence, remove service when config is root only
- [UI] Pro license : add home card, show pro plugins on menu and plugins page, resume in account page, alert in case issue with license usage
- [UI] Log page : enhance UX
- [FEATURE] Add setting REDIS_SSL_VERIFY to activate/disable the SSL certificate verification when using Redis

View file

@ -265,6 +265,33 @@ class ConfigsInfo {
}
}
// some configs are root only
class SetRootOnlyConf {
constructor() {
this.init();
this.rootOnly = ["server-stream", "server-http", "modsec", "modsec-crs"];
}
init() {
window.addEventListener("DOMContentLoaded", () => {
// remove server when config if root only
const itemsToRemove = [];
for (let i = 0; i < this.rootOnly.length; i++) {
const rootName = this.rootOnly[i];
itemsToRemove.push(
...document.querySelectorAll(
`[data-path^="/etc/bunkerweb/configs/${rootName}"][data-_type="folder"][data-level="2"]`,
),
);
}
console.log(itemsToRemove);
itemsToRemove.forEach((item) => {
item.remove();
});
});
}
}
const setConfigsInfo = new ConfigsInfo();
const setModal = new FolderModal("configs");
const setEditor = new FolderEditor();
@ -272,3 +299,4 @@ const setFolderNav = new FolderNav("configs");
const setDropdown = new FolderDropdown("configs");
const setFilterDropdown = new Dropdown("configs");
const setFilter = new Filter();
const setRootOnlyConf = new SetRootOnlyConf();

View file

@ -282,7 +282,7 @@ class Multiple {
.closest("button")
.hasAttribute(`data-${this.prefix}-multiple-delete`)
) {
// We are not removing it really, just hiding it and update values to defaut
// 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(
`[data-${this.prefix}-settings-multiple]`,

View file

@ -718,7 +718,7 @@ class Multiple {
.closest("button")
.hasAttribute(`data-${this.prefix}-multiple-delete`)
) {
// We are not removing it really, just hiding it and update values to defaut
// 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(
`[data-${this.prefix}-settings-multiple]`,