mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-04 13:20:17 +00:00
Update plugin notifications for errors and success
- Only show notification on plugin load and failure. - In settings page, set current backend status at top of pane instead of showing notification Notices bubbles cluttered the UI while typing updates to settings - Show notification once index updated via settings pane button click There was no notification on index updated, which usually takes time on the backend
This commit is contained in:
@@ -9,7 +9,7 @@ export function getVaultAbsolutePath(): string {
|
||||
return '';
|
||||
}
|
||||
|
||||
export async function configureKhojBackend(setting: KhojSetting) {
|
||||
export async function configureKhojBackend(setting: KhojSetting, notify: boolean = true) {
|
||||
let mdInVault = `${setting.obsidianVaultPath}/**/*.md`;
|
||||
let khojConfigUrl = `${setting.khojUrl}/api/config/data`;
|
||||
|
||||
@@ -21,7 +21,8 @@ export async function configureKhojBackend(setting: KhojSetting) {
|
||||
})
|
||||
.catch(error => {
|
||||
setting.connectedToBackend = false;
|
||||
new Notice(`❗️Ensure Khoj backend is running and Khoj URL is pointing to it in the plugin settings.\n\n${error}`);
|
||||
if (notify)
|
||||
new Notice(`❗️Ensure Khoj backend is running and Khoj URL is pointing to it in the plugin settings.\n\n${error}`);
|
||||
})
|
||||
// Short-circuit configuring khoj if unable to connect to khoj backend
|
||||
if (!setting.connectedToBackend) return;
|
||||
@@ -79,10 +80,10 @@ export async function configureKhojBackend(setting: KhojSetting) {
|
||||
updateKhojBackend(setting.khojUrl, data);
|
||||
console.log(`Khoj: Updated markdown config in khoj backend config:\n${JSON.stringify(data["content-type"]["markdown"])}`)
|
||||
}
|
||||
new Notice(`✅ Successfully Setup Khoj`);
|
||||
})
|
||||
.catch(error => {
|
||||
new Notice(`❗️Failed to configure Khoj backend. Contact developer on Github.\n\nError: ${error}`);
|
||||
if (notify)
|
||||
new Notice(`❗️Failed to configure Khoj backend. Contact developer on Github.\n\nError: ${error}`);
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user