mirror of
https://github.com/khoj-ai/khoj.git
synced 2025-02-17 08:04:21 +00:00
Indicate indexing active on Update button in Obsidian plugin settings
Use moon rotating through phases to indicate notes indexing in progress Resolves #129
This commit is contained in:
parent
11517ba8eb
commit
24aa696ef5
1 changed files with 25 additions and 2 deletions
|
@ -59,14 +59,37 @@ export class KhojSettingTab extends PluginSettingTab {
|
|||
.setCta()
|
||||
.onClick(async () => {
|
||||
// Disable button while updating index
|
||||
button.setButtonText('Updating...');
|
||||
button.setButtonText('Updating 🌑');
|
||||
button.removeCta();
|
||||
indexVaultSetting = indexVaultSetting.setDisabled(true);
|
||||
|
||||
// Show indicator for indexing in progress
|
||||
const progress_indicator = window.setInterval(() => {
|
||||
if (button.buttonEl.innerText === 'Updating 🌑') {
|
||||
button.setButtonText('Updating 🌘');
|
||||
} else if (button.buttonEl.innerText === 'Updating 🌘') {
|
||||
button.setButtonText('Updating 🌗');
|
||||
} else if (button.buttonEl.innerText === 'Updating 🌗') {
|
||||
button.setButtonText('Updating 🌖');
|
||||
} else if (button.buttonEl.innerText === 'Updating 🌖') {
|
||||
button.setButtonText('Updating 🌕');
|
||||
} else if (button.buttonEl.innerText === 'Updating 🌕') {
|
||||
button.setButtonText('Updating 🌔');
|
||||
} else if (button.buttonEl.innerText === 'Updating 🌔') {
|
||||
button.setButtonText('Updating 🌓');
|
||||
} else if (button.buttonEl.innerText === 'Updating 🌓') {
|
||||
button.setButtonText('Updating 🌒');
|
||||
} else if (button.buttonEl.innerText === 'Updating 🌒') {
|
||||
button.setButtonText('Updating 🌑');
|
||||
}
|
||||
}, 300);
|
||||
this.plugin.registerInterval(progress_indicator);
|
||||
|
||||
await request(`${this.plugin.settings.khojUrl}/api/update?t=markdown&force=true`);
|
||||
new Notice('✅ Updated Khoj index.');
|
||||
|
||||
// Re-enable button once index is updated
|
||||
// Reset button once index is updated
|
||||
window.clearInterval(progress_indicator);
|
||||
button.setButtonText('Update');
|
||||
button.setCta();
|
||||
indexVaultSetting = indexVaultSetting.setDisabled(false);
|
||||
|
|
Loading…
Add table
Reference in a new issue