File tree Expand file tree Collapse file tree 1 file changed +6
-10
lines changed
Expand file tree Collapse file tree 1 file changed +6
-10
lines changed Original file line number Diff line number Diff line change @@ -16,19 +16,15 @@ import { AsyncAutocomplete, vsAutocomplete } from './fields';
1616import { get , update } from 'lodash' ;
1717
1818export const SiteFilter = ( props : EditorProps ) => {
19- const getSites = ( inputValue : string ) =>
20- props . datasource
21- . doRequest ( { refId : 'siteQuery' , params : { action : 'get_user_sites' } , context : { } } )
22- . then ( ( response ) =>
23- response . data . result
24- . filter ( ( [ _ , text ] : [ string , string ] ) => text . toLowerCase ( ) . includes ( inputValue . toLowerCase ( ) ) )
25- . map ( ( [ value , text ] : [ string , string ] ) => ( { label : text , value : value } ) )
26- )
27- . then ( ( sites ) => [ { label : 'All Sites' , value : '' } , ...sites ] ) ;
19+ const sitesVS = { ident : 'sites' , params : { strict : false , context : props . query . context } } ;
2820
2921 return (
3022 < InlineField labelWidth = { 14 } label = "Site" >
31- < AsyncAutocomplete autocompleter = { getSites } contextPath = "context.siteopt.site" { ...props } />
23+ < AsyncAutocomplete
24+ autocompleter = { vsAutocomplete ( props . datasource , sitesVS ) }
25+ contextPath = "context.siteopt.site"
26+ { ...props }
27+ />
3228 </ InlineField >
3329 ) ;
3430} ;
You can’t perform that action at this time.
0 commit comments