diff --git a/src/ui/static/css/dashboard.css b/src/ui/static/css/dashboard.css index 99a7638a..3dd89447 100644 --- a/src/ui/static/css/dashboard.css +++ b/src/ui/static/css/dashboard.css @@ -859,10 +859,6 @@ h6 { z-index: -10; } -.z-0 { - z-index: 0; -} - .z-10 { z-index: 10; } @@ -992,16 +988,6 @@ h6 { margin-right: 0.75rem; } -.mx-4 { - margin-left: 1rem; - margin-right: 1rem; -} - -.my-1\.5 { - margin-top: 0.375rem; - margin-bottom: 0.375rem; -} - .mb-2 { margin-bottom: 0.5rem; } @@ -1130,10 +1116,6 @@ h6 { margin-right: 1rem; } -.mb-1\.5 { - margin-bottom: 0.375rem; -} - .block { display: block; } @@ -1473,6 +1455,16 @@ h6 { transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y)); } +.translate-y-0\.5 { + --tw-translate-y: 0.125rem; + transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y)); +} + +.translate-y-0 { + --tw-translate-y: 0px; + transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y)); +} + .translate-x-1 { --tw-translate-x: 0.25rem; transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y)); @@ -1498,16 +1490,6 @@ h6 { transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y)); } -.translate-y-0\.5 { - --tw-translate-y: 0.125rem; - transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y)); -} - -.translate-y-0 { - --tw-translate-y: 0px; - transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y)); -} - .rotate-12 { --tw-rotate: 12deg; transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y)); @@ -1547,16 +1529,6 @@ h6 { transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y)); } -.scale-y-110 { - --tw-scale-y: 1.1; - transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y)); -} - -.scale-y-125 { - --tw-scale-y: 1.25; - transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y)); -} - .transform { transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y)); } @@ -1796,10 +1768,6 @@ h6 { border-style: solid; } -.\!border-solid { - border-style: solid !important; -} - .border-dashed { border-style: dashed; } @@ -1895,10 +1863,6 @@ h6 { background-color: rgb(58 65 111 / 0.1); } -.bg-slate-700\/50 { - background-color: rgb(52 71 103 / 0.5); -} - .bg-none { background-image: none; } @@ -2274,11 +2238,6 @@ h6 { line-height: 1.75rem; } -.text-2xl { - font-size: 1.5rem; - line-height: 2rem; -} - .text-3xl { font-size: 1.875rem; line-height: 2.25rem; @@ -2300,6 +2259,10 @@ h6 { text-transform: uppercase; } +.lowercase { + text-transform: lowercase; +} + .capitalize { text-transform: capitalize; } @@ -2308,6 +2271,11 @@ h6 { font-style: italic; } +.ordinal { + --tw-ordinal: ordinal; + font-variant-numeric: var(--tw-ordinal) var(--tw-slashed-zero) var(--tw-numeric-figure) var(--tw-numeric-spacing) var(--tw-numeric-fraction); +} + .leading-default { line-height: 1.6; } @@ -2751,11 +2719,6 @@ h6 { background-color: rgb(8 85 119 / 0.05); } -.hover\:bg-gray-200:hover { - --tw-bg-opacity: 1; - background-color: rgb(233 236 239 / var(--tw-bg-opacity)); -} - .hover\:bg-blue-500\/80:hover { background-color: rgb(94 114 228 / 0.8); } @@ -2864,10 +2827,22 @@ h6 { opacity: 0.85; } +.disabled\:pointer-events-none:disabled { + pointer-events: none; +} + .disabled\:cursor-not-allowed:disabled { cursor: not-allowed; } +.disabled\:cursor-none:disabled { + cursor: none; +} + +.disabled\:cursor-default:disabled { + cursor: default; +} + .disabled\:border-gray-400:disabled { --tw-border-opacity: 1; border-color: rgb(206 212 218 / var(--tw-border-opacity)); @@ -2947,15 +2922,15 @@ h6 { background-color: rgb(5 17 57 / 0.3); } +.dark .dark\:bg-slate-700\/50 { + background-color: rgb(52 71 103 / 0.5); +} + .dark .dark\:bg-gray-800 { --tw-bg-opacity: 1; background-color: rgb(37 47 64 / var(--tw-bg-opacity)); } -.dark .dark\:bg-slate-700\/50 { - background-color: rgb(52 71 103 / 0.5); -} - .dark .dark\:bg-gradient-to-r { background-image: linear-gradient(to right, var(--tw-gradient-stops)); } @@ -2987,22 +2962,6 @@ h6 { fill: #495057; } -.dark .dark\:stroke-slate-700 { - stroke: #344767; -} - -.dark .dark\:stroke-gray-400 { - stroke: #ced4da; -} - -.dark .dark\:stroke-gray-700 { - stroke: #495057; -} - -.dark .dark\:stroke-gray-500 { - stroke: #adb5bd; -} - .dark .dark\:stroke-gray-600 { stroke: #6c757d; } @@ -3117,11 +3076,6 @@ h6 { background-color: rgb(8 85 119 / 0.2); } -.dark .dark\:hover\:bg-slate-700:hover { - --tw-bg-opacity: 1; - background-color: rgb(52 71 103 / var(--tw-bg-opacity)); -} - .dark .dark\:hover\:bg-slate-700\/50:hover { background-color: rgb(52 71 103 / 0.5); } diff --git a/src/ui/static/js/cache.js b/src/ui/static/js/cache.js index 2f3826d2..b1288c88 100644 --- a/src/ui/static/js/cache.js +++ b/src/ui/static/js/cache.js @@ -29,12 +29,14 @@ class Download { async sendFileToDL(jobName, fileName) { window.open( - `${location.href}/download?job_name=${jobName}&file_name=${fileName}` + `${location.href.replace( + "cache", + "jobs" + )}/download?job_name=${jobName}&file_name=${fileName}` ); } } - const setModal = new FolderModal("cache"); const setEditor = new FolderEditor(); const setFolderNav = new FolderNav("cache"); diff --git a/src/ui/static/js/global.js b/src/ui/static/js/global.js index 97e9eb5d..d786614a 100644 --- a/src/ui/static/js/global.js +++ b/src/ui/static/js/global.js @@ -21,27 +21,30 @@ class Menu { class News { constructor() { - this.BASE_URL = "https://www.staging.bunkerweb.io/"; + this.BASE_URL = "https://www.bunkerweb.io/"; this.init(); } init() { - window.addEventListener("load", async () => { - try { - const res = await fetch( - "https://www.staging.bunkerweb.io/api/posts/0/2", - { - headers: { - method: "GET", - }, - } - ); - return await this.render(res); - } catch (err) {} + window.addEventListener("load", () => { + const res = fetch("https://www.bunkerweb.io/api/posts/0/1", { + headers: { + method: "GET", + Accept: "application/json", + "Content-Type": "application/json", + }, + }) + .then((res) => { + console.log("data"); + const data = res.data; + console.log(data); + this.render(res); + }) + .catch((err) => console.log(err)); }); } - async render(lastNews) { + render(lastNews) { const newsContainer = document.querySelector("[news-container]"); //remove default message newsContainer.textContent = ""; diff --git a/src/ui/static/js/logs.js b/src/ui/static/js/logs.js index f6a7d4c7..8a5b55b1 100644 --- a/src/ui/static/js/logs.js +++ b/src/ui/static/js/logs.js @@ -250,7 +250,7 @@ class FetchLogs { //get settings setSettings() { - this.instanceName = this.instance.textContent; + this.instanceName = this.instance.textContent.trim(); //get range date this.fromDate = Date.parse(this.fromDateInp.value) ? Date.parse(this.fromDateInp.value) diff --git a/src/ui/static/js/services.js b/src/ui/static/js/services.js index d0289d76..1ee45a57 100644 --- a/src/ui/static/js/services.js +++ b/src/ui/static/js/services.js @@ -20,18 +20,19 @@ class ServiceModal { this.formDelete = this.modal.querySelector("[services-modal-form-delete]"); //container this.container = document.querySelector("main"); - //general inputs - this.inputs = this.modal.querySelectorAll("input[default-value]"); - this.selects = this.modal.querySelectorAll("select[default-value]"); - this.lastGroup = ""; - this.lastAction = ""; - this.init(); } //store default config data on DOM //to update modal data on new button click + getActionAndServName(target) { + const action = target.closest("button").getAttribute("services-action"); + const serviceName = target.closest("button").getAttribute("services-name"); + + return [action, serviceName]; + } + init() { this.modal.addEventListener("click", (e) => { //close @@ -43,152 +44,112 @@ class ServiceModal { }); this.container.addEventListener("click", (e) => { - //actions + //edit action try { - if (e.target.closest("button").hasAttribute("services-action")) { - //do nothing if same btn and service as before - const isLastSame = this.isLastServAndAct(e.target); - if (isLastSame) return; - //else set the good form - const action = e.target - .closest("button") - .getAttribute("services-action"); - const serviceName = e.target - .closest("button") - .getAttribute("services-name"); - - if (action === "edit" || action === "new") { - this.setForm(action, serviceName, this.formNewEdit); - } - - if (action === "delete") - this.setForm(action, serviceName, this.formDelete); - - //get custom settings of service and apply it to modal settings - if (action === "edit") { - const servicesSettings = e.target - .closest("[services-service]") - .querySelector("[services-settings]") - .getAttribute("value"); - const obj = JSON.parse(servicesSettings); - this.updateModalData(obj); - } - //open modal when all done - - if (action === "new") this.addOneMultGroup(); + if ( + e.target.closest("button").getAttribute("services-action") === "edit" + ) { + //set form info and right form + const [action, serviceName] = this.getActionAndServName(e.target); + this.setForm(action, serviceName, this.formNewEdit); + //get service data and parse it + //multiple type logic is launch at same time on relate class + const servicesSettings = e.target + .closest("[services-service]") + .querySelector("[services-settings]") + .getAttribute("value"); + const obj = JSON.parse(servicesSettings); + this.updateModalData(obj); + //show modal + this.openModal(); + } + } catch (err) {} + //new action + try { + if ( + e.target.closest("button").getAttribute("services-action") === "new" + ) { + //set form info and right form + const [action, serviceName] = this.getActionAndServName(e.target); + this.setForm(action, serviceName, this.formNewEdit); + //set default value with method default + this.setSettingsDefault(); + //server name is unset + const inpServName = document.querySelector("input#SERVER_NAME"); + inpServName.value = ""; + //show modal + this.openModal(); + } + } catch (err) {} + //delete action + try { + if ( + e.target.closest("button").getAttribute("services-action") === + "delete" + ) { + //set form info and right form + const [action, serviceName] = this.getActionAndServName(e.target); + this.setForm(action, serviceName, this.formDelete); + //show modal this.openModal(); } } catch (err) {} }); } - addOneMultGroup() { - const settings = document.querySelector("[services-modal-form]"); - const multAddBtns = settings.querySelectorAll("[services-multiple-add]"); - multAddBtns.forEach((btn) => { - //check if already one (SCHEMA exclude so length >= 2) - const plugin = btn.closest("[plugin-item]"); - if (plugin.querySelectorAll("[services-settings-multiple]").length >= 2) + setSettingsDefault() { + const inps = this.modal.querySelectorAll("input"); + inps.forEach((inp) => { + //form related values are excludes + const inpName = inp.getAttribute("name"); + if ( + inpName === "csrf_token" || + inpName === "SERVER_NAME" || + inpName === "OLD_SERVER_NAME" || + inpName === "operation" + ) return; - btn.click(); - }); - } - isLastServAndAct(target) { - const serviceName = target.closest("button").getAttribute("services-name"); - const serviceAction = target - .closest("button") - .getAttribute("services-action"); - - if (this.lastGroup === serviceName && this.lastAction === serviceAction) { - this.openModal(); - return true; - } else { - this.lastGroup = serviceName; - this.lastAction = serviceAction; - return false; - } - } - - setDefaultValue() { - this.inputs.forEach((inp) => { - let defaultVal = ""; - try { - defaultVal = inp.getAttribute("default-value"); - } catch (err) { - defaultVal = ""; - } - - let defaultMethod = "ui"; - try { - defaultMethod = inp.getAttribute("default-method"); - } catch (err) { - defaultMethod = "ui"; - } - //SET METHOD - this.setDisabled(inp, defaultMethod); + //for all other settings values + const defaultMethod = "default"; + const defaultVal = inp.getAttribute("default-value") || ""; //SET VALUE if (inp.getAttribute("type") === "checkbox") { inp.checked = defaultVal === "yes" ? true : false; inp.setAttribute("value", defaultVal); inp.value = defaultVal; + inp.setAttribute("method", defaultMethod); } if (inp.getAttribute("type") !== "checkbox") { inp.setAttribute("value", defaultVal); + inp.setAttribute("method", defaultMethod); } + + //SET METHOD + this.setDisabled(inp, defaultMethod); }); - this.selects.forEach((select) => { - let defaultVal = ""; - try { - defaultVal = select.getAttribute("default-value"); - } catch (err) { - defaultVal = ""; - } + const selects = this.modal.querySelectorAll("select"); + selects.forEach((select) => { + const defaultMethod = "default"; + const defaultVal = select.getAttribute("default-value") || ""; - let defaultMethod = "ui"; - try { - defaultMethod = select.getAttribute("default-method"); - } catch (err) { - defaultMethod = "ui"; - } + document + .querySelector( + `[setting-select=${select.getAttribute("setting-select-default")}]` + ) + .removeAttribute("disabled"); - if (defaultMethod === "ui" || defaultMethod === "default") { - document - .querySelector( - `[setting-select=${select.getAttribute("setting-select-default")}]` - ) - .removeAttribute("disabled"); - } else { - document - .querySelector( - `[setting-select=${select.getAttribute("setting-select-default")}]` - ) - .setAttribute("disabled", ""); - } select.parentElement .querySelector( `button[setting-select-dropdown-btn][value='${defaultVal}']` ) .click(); + + this.setDisabled(select, defaultMethod); }); - - //server name always enabled for default - this.setNameSetting("ui", ""); - } - - setNameSetting(method, value) { - const nameInp = document.querySelector('input[name="SERVER_NAME"]'); - - if (method === "ui" || method === "default") { - nameInp.removeAttribute("disabled"); - } else { - nameInp.setAttribute("disabled", ""); - } - - nameInp.value = value; } setDisabled(inp, method) { @@ -280,9 +241,17 @@ class ServiceModal { const inps = this.modal.querySelectorAll(`[name='${key}']`); inps.forEach((inp) => { + //form related values are excludes + const inpName = inp.getAttribute("name"); + if ( + inpName === "csrf_token" || + inpName === "SERVER_NAME" || + inpName === "OLD_SERVER_NAME" || + inpName === "operation" + ) + return; + //SET DISABLED / ENABLED - this.setDisabled(inp, method); - //SET VALUE //for regular input if ( inp.tagName === "INPUT" && @@ -290,6 +259,7 @@ class ServiceModal { ) { inp.setAttribute("value", value); inp.value = value; + inp.setAttribute("method", method); } //for checkbox if ( @@ -298,11 +268,14 @@ class ServiceModal { ) { inp.checked = value === "yes" ? true : false; inp.setAttribute("value", value); - if (inpt.hasAttribute("disabled")) { - const hidden_inpt = inpt + inp.setAttribute("method", method); + + if (inp.hasAttribute("disabled")) { + const hidden_inp = inp .closest("div[checkbox-handler]") .querySelector("input[type='hidden']"); - hidden_inpt.setAttribute("value", value); + hidden_inp.setAttribute("value", value); + hidden_inp.setAttribute("method", method); } } //for select @@ -312,15 +285,14 @@ class ServiceModal { `button[setting-select-dropdown-btn][value='${value}']` ) .click(); + inp.setAttribute("method", method); } + + //check disabled/enabled after setting values and methods + this.setDisabled(inp, method); }); } catch (err) {} } - //name setting value - this.setNameSetting( - settings["SERVER_NAME"]["method"], - settings["SERVER_NAME"]["value"] - ); } //UTILS @@ -335,6 +307,9 @@ class ServiceModal { } openModal() { + //switch to first setting + document.querySelector("button[tab-handler]").click(); + //show modal el this.modal.classList.add("flex"); this.modal.classList.remove("hidden"); } @@ -345,42 +320,9 @@ class Multiple { this.prefix = prefix; this.container = document.querySelector("main"); this.modalForm = document.querySelector(`[${this.prefix}-modal-form]`); - this.lastGroup = ""; this.init(); } - sortMultipleByContainerAndSuffixe(obj) { - const sortMultiples = {}; - for (const [name, value] of Object.entries(obj)) { - //split name and check if there is a suffixe - const splitName = name.split("_"); - //suffixe start with number 1, if none give arbitrary 0 value to store on same group - const isSuffixe = !isNaN(splitName[splitName.length - 1]) ? true : false; - const suffixe = isSuffixe ? splitName[splitName.length - 1] : "0"; - //remove suffix if exists and query related name_SCHEMA to get container info - const nameSuffixLess = isSuffixe - ? name.replace(`_${splitName[splitName.length - 1]}`, "").trim() - : name.trim(); - const relateSetting = document.querySelector( - `[setting-container=${nameSuffixLess}_SCHEMA]` - ); - const relateCtnr = relateSetting.closest("[services-settings-multiple]"); - const relateCtnrName = relateCtnr.getAttribute( - "services-settings-multiple" - ); - //then we sort the setting on the right container name by suffixe number - if (!(relateCtnrName in sortMultiples)) { - sortMultiples[relateCtnrName] = {}; - } - - if (!(suffixe in sortMultiples[relateCtnrName])) { - sortMultiples[relateCtnrName][suffixe] = {}; - } - sortMultiples[relateCtnrName][suffixe][name] = value; - } - return sortMultiples; - } - init() { window.addEventListener("load", () => { this.hiddenIfNoMultiples(); @@ -392,13 +334,6 @@ class Multiple { if ( e.target.closest("button").getAttribute("services-action") === "edit" ) { - //avoid reupdate if same service - const serviceName = e.target - .closest("button") - .getAttribute("services-name"); - if (this.lastGroup === serviceName) return; - //else - this.lastGroup = serviceName; //remove all multiples this.removePrevMultiples(); //get multiple service values and parse as obj @@ -414,6 +349,15 @@ class Multiple { this.setMultipleToDOM(sortMultiples); } } catch (err) {} + //new button + try { + if ( + e.target.closest("button").getAttribute("services-action") === "new" + ) { + this.removePrevMultiples(); + this.addOneMultGroup(); + } + } catch (err) {} }); this.modalForm.addEventListener("click", (e) => { @@ -455,7 +399,7 @@ class Multiple { //clone schema to create a group with new num const schemaClone = schema.cloneNode(true); this.changeCloneSuffix(schemaClone, setNum); - + this.setDisabled(); this.showClone(schema, schemaClone); //insert new group before first one //show all groups @@ -495,6 +439,50 @@ class Multiple { }); } + sortMultipleByContainerAndSuffixe(obj) { + const sortMultiples = {}; + for (const [name, value] of Object.entries(obj)) { + //split name and check if there is a suffixe + const splitName = name.split("_"); + //suffixe start with number 1, if none give arbitrary 0 value to store on same group + const isSuffixe = !isNaN(splitName[splitName.length - 1]) ? true : false; + const suffixe = isSuffixe ? splitName[splitName.length - 1] : "0"; + //remove suffix if exists and query related name_SCHEMA to get container info + const nameSuffixLess = isSuffixe + ? name.replace(`_${splitName[splitName.length - 1]}`, "").trim() + : name.trim(); + const relateSetting = document.querySelector( + `[setting-container=${nameSuffixLess}_SCHEMA]` + ); + const relateCtnr = relateSetting.closest("[services-settings-multiple]"); + const relateCtnrName = relateCtnr.getAttribute( + "services-settings-multiple" + ); + //then we sort the setting on the right container name by suffixe number + if (!(relateCtnrName in sortMultiples)) { + sortMultiples[relateCtnrName] = {}; + } + + if (!(suffixe in sortMultiples[relateCtnrName])) { + sortMultiples[relateCtnrName][suffixe] = {}; + } + sortMultiples[relateCtnrName][suffixe][name] = value; + } + return sortMultiples; + } + + addOneMultGroup() { + const settings = document.querySelector("[services-modal-form]"); + const multAddBtns = settings.querySelectorAll("[services-multiple-add]"); + multAddBtns.forEach((btn) => { + //check if already one (SCHEMA exclude so length >= 2) + const plugin = btn.closest("[plugin-item]"); + if (plugin.querySelectorAll("[services-settings-multiple]").length >= 2) + return; + btn.click(); + }); + } + showMultByAtt(att) { const multContainers = document.querySelectorAll( `[services-settings-multiple^=${att}]` @@ -635,6 +623,17 @@ class Multiple { try { const inps = settingContainer.querySelectorAll("input"); inps.forEach((inp) => { + //form related values are excludes + const inpName = inp.getAttribute("name"); + if ( + inpName === "csrf_token" || + inpName === "SERVER_NAME" || + inpName === "OLD_SERVER_NAME" || + inpName === "operation" + ) + return; + + //for settings input if (inp.getAttribute("type") === "checkbox") { inp.checked = value === "yes" ? true : false; if (inp.hasAttribute("disabled")) { @@ -646,7 +645,7 @@ class Multiple { } inp.value = value; - inp.setAttribute("default-method", method); + inp.setAttribute("method", method); }); } catch (err) {} //update select @@ -667,7 +666,7 @@ class Multiple { ? option.setAttribute("selected") : option.removeAttribute("selected"); } - select.setAttribute("default-method", method); + select.setAttribute("method", method); } catch (err) {} } @@ -687,27 +686,31 @@ class Multiple { settings.forEach((setting) => { //replace input info try { - const inp = setting.querySelector("input"); - const method = inp.getAttribute("default-method"); - if (method === "ui" || method === "default") { - inp.removeAttribute("disabled"); - } else { - inp.setAttribute("disabled", ""); - } + const inps = setting.querySelectorAll("input"); + inps.forEach((inp) => { + const method = inp.getAttribute("method") || "default"; + if (method === "ui" || method === "default") { + inp.removeAttribute("disabled"); + } else { + inp.setAttribute("disabled", ""); + } + }); } catch (err) {} //or select try { - const select = setting.querySelector("select"); - const method = select.getAttribute("default-method"); - const name = select.getAttribute("services-setting-select-default"); - const selDOM = document.querySelector( - `button[services-setting-select='${name}']` - ); - if (method === "ui" || method === "default") { - selDOM.setAttribute("disabled", ""); - } else { - selDOM.setAttribute("disabled", ""); - } + const selects = setting.querySelectorAll("select"); + selects.forEach((select) => { + const method = select.getAttribute("method") || "default"; + const name = select.getAttribute("services-setting-select-default"); + const selDOM = document.querySelector( + `button[services-setting-select='${name}']` + ); + if (method === "ui" || method === "default") { + selDOM.removeAttribute("disabled", ""); + } else { + selDOM.setAttribute("disabled", ""); + } + }); } catch (err) {} }); }); diff --git a/src/ui/tailwind.config.js b/src/ui/tailwind.config.js index 477c60ce..68af7b43 100644 --- a/src/ui/tailwind.config.js +++ b/src/ui/tailwind.config.js @@ -3,8 +3,8 @@ const plugin = require("tailwindcss/plugin"); module.exports = { content: [ "./templates/*.{html,js}", - "./templates/components/*.{html,js}", "./static/js/*.js", + "./static/js/utils/*.js", ], presets: [], diff --git a/src/ui/templates/home.html b/src/ui/templates/home.html index bc8f3064..88865efb 100644 --- a/src/ui/templates/home.html +++ b/src/ui/templates/home.html @@ -2,7 +2,7 @@
@@ -54,7 +54,7 @@
@@ -93,7 +93,7 @@
@@ -140,7 +140,7 @@
diff --git a/src/ui/templates/loading.html b/src/ui/templates/loading.html index eb90945a..e2170a92 100644 --- a/src/ui/templates/loading.html +++ b/src/ui/templates/loading.html @@ -22,9 +22,14 @@ alt="main logo" /> {%if message %} -

- {%endif%} -

+
+

+ {{ message }} +

+
+ {%endif%}
diff --git a/src/ui/templates/logs.html b/src/ui/templates/logs.html index 04cb733a..4fa0e011 100644 --- a/src/ui/templates/logs.html +++ b/src/ui/templates/logs.html @@ -26,7 +26,10 @@ url_for(request.endpoint)[1:].split("/")[-1].strip().replace('_', '-') %} id="logs-instance" name="logs-instance" {{current_endpoint}}-setting-select-text="instances" - >none + > + {% for instance in instances %} {% if loop.first %} {% if + instance.name %} {{instance.name}} {%else%} no instance {%endif%} + {%endif%} {% endfor %} - Update Delay + Live update
+ diff --git a/src/ui/templates/plugins.html b/src/ui/templates/plugins.html index 83fced5c..1359de37 100644 --- a/src/ui/templates/plugins.html +++ b/src/ui/templates/plugins.html @@ -118,7 +118,7 @@ include "plugins-modal.html" %}
FILTER
diff --git a/src/ui/templates/services-modal.html b/src/ui/templates/services-modal.html index 7f7c7019..68b7c9e4 100644 --- a/src/ui/templates/services-modal.html +++ b/src/ui/templates/services-modal.html @@ -71,14 +71,14 @@ @@ -96,7 +96,7 @@ -
+

Close diff --git a/src/ui/templates/settings_plugins.html b/src/ui/templates/settings_plugins.html index f5d9a547..cf578d49 100644 --- a/src/ui/templates/settings_plugins.html +++ b/src/ui/templates/settings_plugins.html @@ -176,9 +176,7 @@ != 'default' %} disabled {% endif %} {% if global_config[setting]['value'] and global_config[setting]['value'] == 'yes' or not global_config[setting]['value'] and value['default'] == 'yes' %} checked {% - endif %} id="checkbox-{{value['id']}}" class="{% if - global_config[setting]['method'] != 'ui' and global_config[setting]['method'] - != 'default' %} pointer-events-none {% else %} cursor-pointer {% endif %} + endif %} id="checkbox-{{value['id']}}" class="cursor-pointer disabled:cursor-default disabled:pointer-events-none relative dark:border-slate-600 dark:bg-slate-700 z-10 checked:z-0 w-5 h-5 ease text-base rounded-1.4 checked:bg-primary checked:border-primary dark:checked:bg-primary dark:checked:border-primary duration-250 float-left @@ -197,7 +195,7 @@ != 'default' %}{{global_config[setting]['value']}}{% else %}no{% endif %}" default-method="default" /> @@ -387,7 +385,7 @@