File tree Expand file tree Collapse file tree 6 files changed +40
-51
lines changed Expand file tree Collapse file tree 6 files changed +40
-51
lines changed Original file line number Diff line number Diff line change 1818 </q-item-section >
1919 </q-item >
2020
21- <q-item v-ripple clickable to =" /aliases" exact >
21+ <q-item v-ripple clickable to =" /aliases" exact :disable = " !store.data.features.aliases " >
2222 <q-item-section avatar >
2323 <q-icon name =" sym_s_call_split" />
2424 </q-item-section >
2525
2626 <q-item-section > Aliases </q-item-section >
2727 </q-item >
2828
29- <q-item v-ripple clickable to =" /apikeys" exact >
29+ <q-item v-ripple clickable to =" /apikeys" exact :disable = " !store.data.features.apiKeys " >
3030 <q-item-section avatar >
3131 <q-icon name =" sym_s_key" />
3232 </q-item-section >
Original file line number Diff line number Diff line change 2020 color =" info"
2121 flat
2222 dense
23- :href =" `https://typesense.org/docs/${store.data.debug.version}/api/api-keys.html#create-an-api-key`"
23+ :href =" `https://typesense.org/docs/${store.data.debug.version || store.data.defaultDocVersion }/api/api-keys.html#create-an-api-key`"
2424 target =" _blank"
2525 >Documentation</q-btn
2626 >
Original file line number Diff line number Diff line change 2525 color =" info"
2626 flat
2727 dense
28- :href =" `https://typesense.org/docs/${store.data.debug.version}/api/search.html#presets`"
28+ :href =" `https://typesense.org/docs/${store.data.debug.version || store.data.defaultDocVersion }/api/search.html#presets`"
2929 target =" _blank"
3030 >Documentation</q-btn
3131 >
Original file line number Diff line number Diff line change 139139 <div >Protocol: {{ store.loginData?.node.protocol }}</div >
140140 <div >Host: {{ store.loginData?.node.host }}</div >
141141 <div >Port: {{ store.loginData?.node.port }}</div >
142- <div >Version: {{ store.data.debug.version }}</div >
142+ <div v-if = " store.data.debug.version " >Version: {{ store.data.debug.version }}</div >
143143 <div v-if =" Object.hasOwnProperty.call(store.data.debug, 'state')" >
144144 Role:
145145 {{ store.data.debug.state === 1 ? 'Leader' : 'Follower' }}
Original file line number Diff line number Diff line change 3131 color =" info"
3232 flat
3333 dense
34- :href =" `https://typesense.org/docs/${store.data.debug.version}/api/stopwords.html`"
34+ :href =" `https://typesense.org/docs/${store.data.debug.version || store.data.defaultDocVersion }/api/stopwords.html`"
3535 target =" _blank"
3636 >
3737 Documentation
Original file line number Diff line number Diff line change @@ -32,11 +32,15 @@ export interface NodeDataInterface {
3232 stopwords : StopwordSchema [ ] ;
3333 overrides : OverrideSchema [ ] ;
3434 synonyms : SynonymSchema [ ] ;
35+ defaultDocVersion : string ;
3536 features : {
3637 stopwords : boolean ;
3738 analyticsRules : boolean ;
3839 searchPresets : boolean ;
3940 stats : boolean ;
41+ aliases : boolean ;
42+ apiKeys : boolean ;
43+ debug : boolean ;
4044 } ;
4145}
4246
@@ -91,11 +95,15 @@ function state(): NodeStateInterface {
9195 stopwords : [ ] ,
9296 overrides : [ ] ,
9397 synonyms : [ ] ,
98+ defaultDocVersion : '28.0' ,
9499 features : {
95100 stopwords : false ,
96101 analyticsRules : false ,
97102 searchPresets : false ,
98103 stats : false ,
104+ aliases : false ,
105+ apiKeys : false ,
106+ debug : false ,
99107 } ,
100108 } ,
101109 } ;
@@ -130,52 +138,33 @@ export const useNodeStore = defineStore('node', {
130138 metrics : response . data ,
131139 } ) ;
132140 // minimal required data to consider the connection as successful
133- await Promise . all ( [
134- this . getCollections ( ) ,
135- this . getAliases ( ) ,
136- this . getApiKeys ( ) ,
137- this . getDebug ( ) ,
138- ] ) ;
139- // optional features depending on the server capabilities
140- this . getSearchPresets ( )
141- . then ( ( ) => {
142- this . setFeature ( {
143- key : 'searchPresets' ,
144- value : true ,
141+ await this . getCollections ( ) ;
142+ // optional features depending on the apiKey and server capabilities
143+ [
144+ 'getAliases' ,
145+ 'getSearchPresets' ,
146+ 'getAnalyticsRules' ,
147+ 'getStopwords' ,
148+ 'getApiKeys' ,
149+ 'getDebug' ,
150+ ] . forEach ( ( funcName ) => {
151+ const key = ( funcName [ 3 ] ?. toLowerCase ( ) +
152+ funcName . slice ( 4 ) ) as keyof NodeDataInterface [ 'features' ] ;
153+ const func = ( this as any ) [ funcName ] ;
154+ func ( )
155+ . then ( ( ) => {
156+ this . setFeature ( {
157+ key,
158+ value : true ,
159+ } ) ;
160+ } )
161+ . catch ( ( ) => {
162+ this . setFeature ( {
163+ key,
164+ value : false ,
165+ } ) ;
145166 } ) ;
146- } )
147- . catch ( ( ) => {
148- this . setFeature ( {
149- key : 'searchPresets' ,
150- value : false ,
151- } ) ;
152- } ) ;
153- this . getAnalyticsRules ( )
154- . then ( ( ) => {
155- this . setFeature ( {
156- key : 'analyticsRules' ,
157- value : true ,
158- } ) ;
159- } )
160- . catch ( ( ) => {
161- this . setFeature ( {
162- key : 'analyticsRules' ,
163- value : false ,
164- } ) ;
165- } ) ;
166- this . getStopwords ( )
167- . then ( ( ) => {
168- this . setFeature ( {
169- key : 'stopwords' ,
170- value : true ,
171- } ) ;
172- } )
173- . catch ( ( ) => {
174- this . setFeature ( {
175- key : 'stopwords' ,
176- value : false ,
177- } ) ;
178- } ) ;
167+ } ) ;
179168 this . setIsConnected ( true ) ;
180169 this . saveHistory ( ) ;
181170 this . setError ( null ) ;
You can’t perform that action at this time.
0 commit comments