mirror of
https://github.com/khoj-ai/khoj.git
synced 2025-02-17 08:04:21 +00:00
Only show updated index notice on success in Obsidian plugin
Previously it'd show indexing success notice on error and success
This commit is contained in:
parent
cb425a073d
commit
bc26cf8b2f
2 changed files with 3 additions and 3 deletions
|
@ -189,9 +189,8 @@ export class KhojSettingTab extends PluginSettingTab {
|
|||
this.plugin.registerInterval(progress_indicator);
|
||||
|
||||
this.plugin.settings.lastSync = await updateContentIndex(
|
||||
this.app.vault, this.plugin.settings, this.plugin.settings.lastSync, true
|
||||
this.app.vault, this.plugin.settings, this.plugin.settings.lastSync, true, true
|
||||
);
|
||||
new Notice('✅ Updated Khoj index.');
|
||||
|
||||
// Reset button once index is updated
|
||||
window.clearInterval(progress_indicator);
|
||||
|
|
|
@ -57,7 +57,7 @@ export const supportedImageFilesTypes = fileTypeToExtension.image;
|
|||
export const supportedBinaryFileTypes = fileTypeToExtension.pdf.concat(supportedImageFilesTypes);
|
||||
export const supportedFileTypes = fileTypeToExtension.markdown.concat(supportedBinaryFileTypes);
|
||||
|
||||
export async function updateContentIndex(vault: Vault, setting: KhojSetting, lastSync: Map<TFile, number>, regenerate: boolean = false): Promise<Map<TFile, number>> {
|
||||
export async function updateContentIndex(vault: Vault, setting: KhojSetting, lastSync: Map<TFile, number>, regenerate: boolean = false, userTriggered: boolean = false): Promise<Map<TFile, number>> {
|
||||
// Get all markdown, pdf files in the vault
|
||||
console.log(`Khoj: Updating Khoj content index...`)
|
||||
const files = vault.getFiles()
|
||||
|
@ -179,6 +179,7 @@ export async function updateContentIndex(vault: Vault, setting: KhojSetting, las
|
|||
if (error_message) {
|
||||
new Notice(error_message);
|
||||
} else {
|
||||
if (userTriggered) new Notice('✅ Updated Khoj index.');
|
||||
console.log(`✅ Refreshed Khoj content index. Updated: ${countOfFilesToIndex} files, Deleted: ${countOfFilesToDelete} files.`);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue