feat: merge UI vault settings with environment config, improve French UI text clarity, and enhance hidden files whitelist styling with hover effects and empty state

This commit is contained in:
2026-03-26 09:24:56 -04:00
parent fe3ffe5860
commit 08e4d732f5
4 changed files with 104 additions and 44 deletions
+15 -18
View File
@@ -3268,7 +3268,7 @@
// Include all hidden toggle
const toggleRow = el("div", { class: "config-row" }, [
el("label", { class: "config-label", for: `hidden-include-${vault.name}` }, [
document.createTextNode("Inclure tous les fichiers cachés")
document.createTextNode("Afficher tous les fichiers cachés")
]),
el("label", { class: "config-toggle" }, [
el("input", {
@@ -3280,17 +3280,17 @@
el("span", { class: "config-toggle-slider" })
]),
el("span", { class: "config-hint" }, [
document.createTextNode("Activer pour indexer tous les fichiers et dossiers cachés (commençant par un point)")
document.createTextNode("Indexer tous les fichiers/dossiers commençant par un point")
])
]);
// Whitelist section
const whitelistSection = el("div", { class: "hidden-files-whitelist" });
const whitelistLabel = el("label", { class: "config-label" }, [
document.createTextNode("Liste blanche (dossiers cachés spécifiques)")
document.createTextNode("Liste blanche")
]);
const whitelistHint = el("span", { class: "config-hint", style: "display:block;margin-bottom:8px" }, [
document.createTextNode("Ajoutez des dossiers cachés individuels à indexer (ex: .obsidian, .github)")
document.createTextNode("Dossiers cachés spécifiques à afficher (ex: .obsidian, .github)")
]);
const whitelistItems = el("div", { class: "hidden-files-whitelist-items", id: `whitelist-items-${vault.name}` });
@@ -3307,13 +3307,13 @@
type: "text",
class: "config-input",
id: `whitelist-input-${vault.name}`,
placeholder: "Ex: .obsidian"
placeholder: ".obsidian"
}),
el("button", {
class: "config-btn-add",
type: "button",
"data-vault": vault.name
}, [document.createTextNode("Ajouter")])
}, [document.createTextNode("➕ Ajouter")])
]);
whitelistSection.appendChild(whitelistLabel);
@@ -3367,21 +3367,18 @@
const value = input.value.trim();
if (!value) return;
// Validate format (should start with a dot)
if (!value.startsWith(".")) {
showToast("Le nom doit commencer par un point (ex: .obsidian)", "error");
return;
}
// Auto-add dot if missing
const normalizedValue = value.startsWith(".") ? value : `.${value}`;
// Check for duplicates
const existing = Array.from(container.querySelectorAll(".whitelist-item-text"))
.map(el => el.textContent);
if (existing.includes(value)) {
if (existing.includes(normalizedValue)) {
showToast("Cet élément existe déjà", "error");
return;
}
const item = createWhitelistItem(vaultName, value);
const item = createWhitelistItem(vaultName, normalizedValue);
container.appendChild(item);
input.value = "";
}
@@ -3417,18 +3414,18 @@
});
await Promise.all(promises);
showToast("Paramètres des fichiers cachés sauvegardés", "success");
showToast("✓ Paramètres sauvegardés", "success");
} catch (err) {
console.error("Failed to save hidden files settings:", err);
showToast("Erreur de sauvegarde", "error");
} finally {
if (btn) { btn.disabled = false; btn.textContent = "Sauvegarder les paramètres"; }
if (btn) { btn.disabled = false; btn.textContent = "💾 Sauvegarder"; }
}
}
async function reindexWithHiddenFiles() {
const btn = document.getElementById("cfg-reindex-hidden");
if (btn) { btn.disabled = true; btn.textContent = "Réindexation..."; }
if (btn) { btn.disabled = true; btn.textContent = "⏳ Réindexation..."; }
try {
// First save the settings
@@ -3436,14 +3433,14 @@
// Then trigger reindex
await api("/api/index/reload");
showToast("Réindexation avec nouveaux paramètres terminée", "success");
showToast("✓ Réindexation terminée", "success");
loadDiagnostics();
await Promise.all([loadVaults(), loadTags()]);
} catch (err) {
console.error("Reindex with hidden files error:", err);
showToast("Erreur de réindexation", "error");
} finally {
if (btn) { btn.disabled = false; btn.textContent = "Réindexer avec nouveaux paramètres"; }
if (btn) { btn.disabled = false; btn.textContent = "🔄 Réindexer"; }
}
}