@@ -59,14 +59,37 @@ export class KhojSettingTab extends PluginSettingTab {
59
59
. setCta ( )
60
60
. onClick ( async ( ) => {
61
61
// Disable button while updating index
62
- button . setButtonText ( 'Updating... ' ) ;
62
+ button . setButtonText ( 'Updating 🌑 ' ) ;
63
63
button . removeCta ( ) ;
64
64
indexVaultSetting = indexVaultSetting . setDisabled ( true ) ;
65
65
66
+ // Show indicator for indexing in progress
67
+ const progress_indicator = window . setInterval ( ( ) => {
68
+ if ( button . buttonEl . innerText === 'Updating 🌑' ) {
69
+ button . setButtonText ( 'Updating 🌘' ) ;
70
+ } else if ( button . buttonEl . innerText === 'Updating 🌘' ) {
71
+ button . setButtonText ( 'Updating 🌗' ) ;
72
+ } else if ( button . buttonEl . innerText === 'Updating 🌗' ) {
73
+ button . setButtonText ( 'Updating 🌖' ) ;
74
+ } else if ( button . buttonEl . innerText === 'Updating 🌖' ) {
75
+ button . setButtonText ( 'Updating 🌕' ) ;
76
+ } else if ( button . buttonEl . innerText === 'Updating 🌕' ) {
77
+ button . setButtonText ( 'Updating 🌔' ) ;
78
+ } else if ( button . buttonEl . innerText === 'Updating 🌔' ) {
79
+ button . setButtonText ( 'Updating 🌓' ) ;
80
+ } else if ( button . buttonEl . innerText === 'Updating 🌓' ) {
81
+ button . setButtonText ( 'Updating 🌒' ) ;
82
+ } else if ( button . buttonEl . innerText === 'Updating 🌒' ) {
83
+ button . setButtonText ( 'Updating 🌑' ) ;
84
+ }
85
+ } , 300 ) ;
86
+ this . plugin . registerInterval ( progress_indicator ) ;
87
+
66
88
await request ( `${ this . plugin . settings . khojUrl } /api/update?t=markdown&force=true` ) ;
67
89
new Notice ( '✅ Updated Khoj index.' ) ;
68
90
69
- // Re-enable button once index is updated
91
+ // Reset button once index is updated
92
+ window . clearInterval ( progress_indicator ) ;
70
93
button . setButtonText ( 'Update' ) ;
71
94
button . setCta ( ) ;
72
95
indexVaultSetting = indexVaultSetting . setDisabled ( false ) ;
0 commit comments