mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-07 21:29:13 +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:
@@ -189,9 +189,8 @@ export class KhojSettingTab extends PluginSettingTab {
|
|||||||
this.plugin.registerInterval(progress_indicator);
|
this.plugin.registerInterval(progress_indicator);
|
||||||
|
|
||||||
this.plugin.settings.lastSync = await updateContentIndex(
|
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
|
// Reset button once index is updated
|
||||||
window.clearInterval(progress_indicator);
|
window.clearInterval(progress_indicator);
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ export const supportedImageFilesTypes = fileTypeToExtension.image;
|
|||||||
export const supportedBinaryFileTypes = fileTypeToExtension.pdf.concat(supportedImageFilesTypes);
|
export const supportedBinaryFileTypes = fileTypeToExtension.pdf.concat(supportedImageFilesTypes);
|
||||||
export const supportedFileTypes = fileTypeToExtension.markdown.concat(supportedBinaryFileTypes);
|
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
|
// Get all markdown, pdf files in the vault
|
||||||
console.log(`Khoj: Updating Khoj content index...`)
|
console.log(`Khoj: Updating Khoj content index...`)
|
||||||
const files = vault.getFiles()
|
const files = vault.getFiles()
|
||||||
@@ -179,6 +179,7 @@ export async function updateContentIndex(vault: Vault, setting: KhojSetting, las
|
|||||||
if (error_message) {
|
if (error_message) {
|
||||||
new Notice(error_message);
|
new Notice(error_message);
|
||||||
} else {
|
} else {
|
||||||
|
if (userTriggered) new Notice('✅ Updated Khoj index.');
|
||||||
console.log(`✅ Refreshed Khoj content index. Updated: ${countOfFilesToIndex} files, Deleted: ${countOfFilesToDelete} files.`);
|
console.log(`✅ Refreshed Khoj content index. Updated: ${countOfFilesToIndex} files, Deleted: ${countOfFilesToDelete} files.`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user