From f1a94ee4b0a9c7668bc2e28e683adb30a3ad094f Mon Sep 17 00:00:00 2001 From: robertvoy Date: Sun, 13 Jul 2025 13:29:45 +1000 Subject: [PATCH] ui tweaks --- web/constants.js | 2 +- web/sidebarRenderer.js | 4 +++- web/ui.js | 27 ++++++++++++++++++++++++++- 3 files changed, 30 insertions(+), 3 deletions(-) diff --git a/web/constants.js b/web/constants.js index 2b3f0ad..441a766 100644 --- a/web/constants.js +++ b/web/constants.js @@ -117,7 +117,7 @@ export const UI_STYLES = { export const TIMEOUTS = { DEFAULT_FETCH: 5000, // ms for general API calls - STATUS_CHECK: 500, // ms for status checks + STATUS_CHECK: 1200, // ms for status checks LAUNCH: 90000, // ms for worker launch (longer for model loading) RETRY_DELAY: 1000, // initial delay for exponential backoff MAX_RETRIES: 3, // max retry attempts diff --git a/web/sidebarRenderer.js b/web/sidebarRenderer.js index d88e4cd..3187ee4 100644 --- a/web/sidebarRenderer.js +++ b/web/sidebarRenderer.js @@ -173,7 +173,7 @@ export async function renderSidebarContent(extension, el) { // Collapsible settings content const settingsContent = document.createElement("div"); - settingsContent.style.cssText = "max-height: 0; overflow: hidden; transition: max-height 0.3s ease;"; + settingsContent.style.cssText = "max-height: 0; overflow: hidden; opacity: 0; transition: max-height 0.3s ease, opacity 0.3s ease;"; const settingsDiv = document.createElement("div"); settingsDiv.style.cssText = "display: flex; flex-direction: column; gap: 8px; padding-top: 10px;"; @@ -184,9 +184,11 @@ export async function renderSidebarContent(extension, el) { settingsExpanded = !settingsExpanded; if (settingsExpanded) { settingsContent.style.maxHeight = "200px"; + settingsContent.style.opacity = "1"; workerSettingsToggle.style.transform = "rotate(90deg)"; } else { settingsContent.style.maxHeight = "0"; + settingsContent.style.opacity = "0"; workerSettingsToggle.style.transform = "rotate(0deg)"; } }; diff --git a/web/ui.js b/web/ui.js index d8a2fd6..24f0808 100644 --- a/web/ui.js +++ b/web/ui.js @@ -821,17 +821,42 @@ export class DistributedUI { if (!extension.config.master) extension.config.master = {}; extension.config.master.name = nameInput.value.trim() || "Master"; + const hostValue = hostInput.value.trim(); + await extension.api.updateMaster({ - host: hostInput.value.trim(), + host: hostValue, name: extension.config.master.name }); // Reload config to refresh any updated values await extension.loadConfig(); + // If host was emptied, trigger auto-detection + if (!hostValue) { + extension.log("Host field cleared, triggering IP auto-detection", "debug"); + await extension.detectMasterIP(); + // Reload config again to get the auto-detected IP + await extension.loadConfig(); + // Update the input field with the detected IP + document.getElementById('master-host').value = extension.config?.master?.host || ""; + } + document.getElementById('master-name-display').textContent = extension.config.master.name; this.updateMasterDisplay(extension); + // Show toast notification + if (extension.app?.extensionManager?.toast) { + const message = !hostValue ? + "Master settings saved and IP auto-detected" : + "Master settings saved successfully"; + extension.app.extensionManager.toast.add({ + severity: "success", + summary: "Master Updated", + detail: message, + life: 3000 + }); + } + saveBtn.textContent = "Saved!"; setTimeout(() => { saveBtn.textContent = "Save"; }, TIMEOUTS.FLASH_LONG); }, "background-color: #4a7c4a;");