File tree Expand file tree Collapse file tree 2 files changed +20
-6
lines changed
src/Umbraco.Cms.Integrations.Search.Algolia/App_Plugins/UmbracoCms.Integrations/Search/Algolia Expand file tree Collapse file tree 2 files changed +20
-6
lines changed Original file line number Diff line number Diff line change 1515 vm . saveIndex = saveIndex ;
1616 vm . viewIndex = viewIndex ;
1717 vm . buildIndex = buildIndex ;
18- vm . search = search ;
18+ vm . searchIndex = searchIndex ;
1919 vm . deleteIndex = deleteIndex ;
20+ vm . search = search ;
2021
2122 function init ( ) {
2223
9293 else {
9394 const propertyIndex = this . contentData . find ( p => p . contentType === this . selectedContentType ) . properties . indexOf ( property . alias ) ;
9495 if ( propertyIndex > - 1 ) this . contentData . find ( p => p . contentType === this . selectedContentType ) . properties . splice ( propertyIndex , 1 ) ;
96+
97+ this . properties . find ( p => p . alias == property . alias ) . checked = false ;
9598 }
9699 } ,
97100 reset : function ( ) {
127130 return false ;
128131 }
129132
133+ if ( vm . manageIndex . contentData . filter ( p => p . properties . length == 0 ) . length > 0 ) {
134+ notificationsService . error ( "Selected content types must have at least one property." ) ;
135+ return false ;
136+ }
137+
130138 vm . loading = true ;
131139
132140 umbracoCmsIntegrationsSearchAlgoliaResource
189197 overlayService . open ( dialogOptions ) ;
190198 }
191199
192- function search ( ) {
193- umbracoCmsIntegrationsSearchAlgoliaResource . search ( vm . searchIndex . id , vm . searchQuery ) . then ( function ( response ) {
194- vm . searchResults = response ;
195- } ) ;
200+ function searchIndex ( index ) {
201+ vm . viewState = "search" ;
202+ vm . searchIndex = index ;
196203 }
197204
198205 function deleteIndex ( index ) {
199206 umbracoCmsIntegrationsSearchAlgoliaResource . deleteIndex ( index . id ) . then ( function ( response ) {
200207 getIndices ( ) ;
201208 } ) ;
202209 }
210+
211+ function search ( ) {
212+ umbracoCmsIntegrationsSearchAlgoliaResource . search ( vm . searchIndex . id , vm . searchQuery ) . then ( function ( response ) {
213+ vm . searchResults = response ;
214+ } ) ;
215+ }
203216}
204217
205218angular . module ( "umbraco" )
Original file line number Diff line number Diff line change 5151 </ umb-button >
5252 < umb-button label ="search "
5353 type ="button "
54- button-style ="success ">
54+ button-style ="success "
55+ action ="vm.searchIndex(index) ">
5556 </ umb-button >
5657 < umb-button label ="delete "
5758 type ="button "
You can’t perform that action at this time.
0 commit comments