Compare commits
2 Commits
master
...
a5e413e216
| Author | SHA1 | Date | |
|---|---|---|---|
| a5e413e216 | |||
| dd84a2044f |
@@ -519,6 +519,35 @@ function scheduleSidebarErrors() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let tocUpdateFrame = null;
|
||||||
|
function scheduleTocUpdate() {
|
||||||
|
if (!toc) return;
|
||||||
|
if (tocUpdateFrame) return;
|
||||||
|
tocUpdateFrame = requestAnimationFrame(() => {
|
||||||
|
tocUpdateFrame = null;
|
||||||
|
updateToc(collectWorkspaces(), collectSites());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const TOC_NAME_INPUT_SELECTOR = [
|
||||||
|
".api-key-name",
|
||||||
|
".api-config-name",
|
||||||
|
".env-config-name",
|
||||||
|
".profile-name",
|
||||||
|
".task-name",
|
||||||
|
".shortcut-name",
|
||||||
|
".workspace-name",
|
||||||
|
".site-name",
|
||||||
|
".site-pattern"
|
||||||
|
].join(", ");
|
||||||
|
|
||||||
|
function handleTocNameInput(event) {
|
||||||
|
const target = event.target;
|
||||||
|
if (!(target instanceof Element)) return;
|
||||||
|
if (!target.matches(TOC_NAME_INPUT_SELECTOR)) return;
|
||||||
|
scheduleTocUpdate();
|
||||||
|
}
|
||||||
|
|
||||||
function renderGlobalSitesList(sites) {
|
function renderGlobalSitesList(sites) {
|
||||||
if (!globalSitesContainer) return;
|
if (!globalSitesContainer) return;
|
||||||
globalSitesContainer.innerHTML = "";
|
globalSitesContainer.innerHTML = "";
|
||||||
@@ -1230,6 +1259,7 @@ function updateApiConfigControls() {
|
|||||||
if (moveDownBtn) moveDownBtn.disabled = index === cards.length - 1;
|
if (moveDownBtn) moveDownBtn.disabled = index === cards.length - 1;
|
||||||
});
|
});
|
||||||
scheduleSidebarErrors();
|
scheduleSidebarErrors();
|
||||||
|
scheduleTocUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
function buildApiKeyCard(entry) {
|
function buildApiKeyCard(entry) {
|
||||||
@@ -1404,6 +1434,7 @@ function updateApiKeyControls() {
|
|||||||
if (moveDownBtn) moveDownBtn.disabled = index === cards.length - 1;
|
if (moveDownBtn) moveDownBtn.disabled = index === cards.length - 1;
|
||||||
});
|
});
|
||||||
scheduleSidebarErrors();
|
scheduleSidebarErrors();
|
||||||
|
scheduleTocUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateApiConfigKeyOptions() {
|
function updateApiConfigKeyOptions() {
|
||||||
@@ -1630,6 +1661,7 @@ function updateEnvControls(container = envConfigsContainer) {
|
|||||||
if (moveDownBtn) moveDownBtn.disabled = index === cards.length - 1;
|
if (moveDownBtn) moveDownBtn.disabled = index === cards.length - 1;
|
||||||
});
|
});
|
||||||
scheduleSidebarErrors();
|
scheduleSidebarErrors();
|
||||||
|
scheduleTocUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateTaskEnvOptionsForContainer(container, envs, allEnvsById) {
|
function updateTaskEnvOptionsForContainer(container, envs, allEnvsById) {
|
||||||
@@ -1879,6 +1911,7 @@ function updateProfileControls(container = profilesContainer) {
|
|||||||
if (moveDownBtn) moveDownBtn.disabled = index === cards.length - 1;
|
if (moveDownBtn) moveDownBtn.disabled = index === cards.length - 1;
|
||||||
});
|
});
|
||||||
scheduleSidebarErrors();
|
scheduleSidebarErrors();
|
||||||
|
scheduleTocUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateTaskProfileOptionsForContainer(container, profiles, allProfilesById) {
|
function updateTaskProfileOptionsForContainer(container, profiles, allProfilesById) {
|
||||||
@@ -1952,7 +1985,9 @@ function updateEnvApiOptionsForContainer(container, apiConfigs) {
|
|||||||
if (!container) return;
|
if (!container) return;
|
||||||
const selects = container.querySelectorAll(".env-config-api-select");
|
const selects = container.querySelectorAll(".env-config-api-select");
|
||||||
selects.forEach((select) => {
|
selects.forEach((select) => {
|
||||||
select.dataset.preferred = select.value;
|
if (select.value) {
|
||||||
|
select.dataset.preferred = select.value;
|
||||||
|
}
|
||||||
populateSelect(select, apiConfigs, "No API configs configured");
|
populateSelect(select, apiConfigs, "No API configs configured");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -2195,15 +2230,21 @@ function updateShortcutOptionsForContainer(container, options = {}) {
|
|||||||
const profileSelect = card.querySelector(".shortcut-profile");
|
const profileSelect = card.querySelector(".shortcut-profile");
|
||||||
const taskSelect = card.querySelector(".shortcut-task");
|
const taskSelect = card.querySelector(".shortcut-task");
|
||||||
if (envSelect) {
|
if (envSelect) {
|
||||||
envSelect.dataset.preferred = envSelect.value;
|
if (envSelect.value) {
|
||||||
|
envSelect.dataset.preferred = envSelect.value;
|
||||||
|
}
|
||||||
populateSelect(envSelect, envs, "No environments configured");
|
populateSelect(envSelect, envs, "No environments configured");
|
||||||
}
|
}
|
||||||
if (profileSelect) {
|
if (profileSelect) {
|
||||||
profileSelect.dataset.preferred = profileSelect.value;
|
if (profileSelect.value) {
|
||||||
|
profileSelect.dataset.preferred = profileSelect.value;
|
||||||
|
}
|
||||||
populateSelect(profileSelect, profiles, "No profiles configured");
|
populateSelect(profileSelect, profiles, "No profiles configured");
|
||||||
}
|
}
|
||||||
if (taskSelect) {
|
if (taskSelect) {
|
||||||
taskSelect.dataset.preferred = taskSelect.value;
|
if (taskSelect.value) {
|
||||||
|
taskSelect.dataset.preferred = taskSelect.value;
|
||||||
|
}
|
||||||
populateSelect(taskSelect, tasks, "No tasks configured");
|
populateSelect(taskSelect, tasks, "No tasks configured");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -5026,6 +5067,7 @@ function updateShortcutControls(container = shortcutsContainer) {
|
|||||||
if (moveDownBtn) moveDownBtn.disabled = index === cards.length - 1;
|
if (moveDownBtn) moveDownBtn.disabled = index === cards.length - 1;
|
||||||
});
|
});
|
||||||
scheduleSidebarErrors();
|
scheduleSidebarErrors();
|
||||||
|
scheduleTocUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateTaskControls(container = tasksContainer) {
|
function updateTaskControls(container = tasksContainer) {
|
||||||
@@ -5039,6 +5081,7 @@ function updateTaskControls(container = tasksContainer) {
|
|||||||
if (moveDownBtn) moveDownBtn.disabled = index === cards.length - 1;
|
if (moveDownBtn) moveDownBtn.disabled = index === cards.length - 1;
|
||||||
});
|
});
|
||||||
scheduleSidebarErrors();
|
scheduleSidebarErrors();
|
||||||
|
scheduleTocUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
function collectTasks(container = tasksContainer) {
|
function collectTasks(container = tasksContainer) {
|
||||||
@@ -6109,6 +6152,9 @@ async function initSettings() {
|
|||||||
registerAllDetails();
|
registerAllDetails();
|
||||||
restoreScrollPosition();
|
restoreScrollPosition();
|
||||||
initDirtyObserver();
|
initDirtyObserver();
|
||||||
|
if (settingsLayout) {
|
||||||
|
settingsLayout.addEventListener("input", handleTocNameInput);
|
||||||
|
}
|
||||||
captureSavedSnapshot();
|
captureSavedSnapshot();
|
||||||
suppressDirtyTracking = false;
|
suppressDirtyTracking = false;
|
||||||
window.addEventListener("scroll", handleSettingsScroll, { passive: true });
|
window.addEventListener("scroll", handleSettingsScroll, { passive: true });
|
||||||
|
|||||||
Reference in New Issue
Block a user