File tree Expand file tree Collapse file tree 5 files changed +51
-9
lines changed
controllers/scopes/scope/session-recordings
routes/scopes/scope/session-recordings
templates/scopes/scope/session-recordings Expand file tree Collapse file tree 5 files changed +51
-9
lines changed Original file line number Diff line number Diff line change @@ -145,12 +145,12 @@ function addSearchConditions({
145
145
146
146
// Use the special prefix indicator "*" for full-text search
147
147
if ( typeOf ( search ) === 'object' ) {
148
- if ( ! search ?. value ) {
148
+ if ( ! search ?. text ) {
149
149
return ;
150
150
}
151
151
152
152
parameters . push (
153
- or ( search . fields . map ( ( field ) => `${ field } :"${ search . value } "*` ) ) ,
153
+ or ( search . fields . map ( ( field ) => `${ field } :"${ search . text } "*` ) ) ,
154
154
) ;
155
155
} else {
156
156
parameters . push ( `"${ search } "*` ) ;
Original file line number Diff line number Diff line change @@ -300,6 +300,31 @@ module('Unit | Utility | sqlite-query', function (hooks) {
300
300
] ) ;
301
301
} ) ;
302
302
303
+ test ( 'it generates FTS5 search with object parameter' , function ( assert ) {
304
+ const query = {
305
+ search : {
306
+ text : 'favorite' ,
307
+ fields : [ 'name' , 'description' ] ,
308
+ } ,
309
+ filters : {
310
+ type : [ { equals : 'ssh' } ] ,
311
+ } ,
312
+ } ;
313
+
314
+ const { sql, parameters } = generateSQLExpressions ( 'target' , query ) ;
315
+ assert . strictEqual (
316
+ sql ,
317
+ `
318
+ SELECT * FROM "target"
319
+ WHERE (type = ?) AND rowid IN (SELECT rowid FROM target_fts WHERE target_fts MATCH ?)
320
+ ORDER BY created_time DESC` . removeExtraWhiteSpace ( ) ,
321
+ ) ;
322
+ assert . deepEqual ( parameters , [
323
+ 'ssh' ,
324
+ 'name:"favorite"* OR description:"favorite"*' ,
325
+ ] ) ;
326
+ } ) ;
327
+
303
328
test ( 'it generates SQL with all clauses combined' , function ( assert ) {
304
329
const query = {
305
330
search : 'favorite' ,
Original file line number Diff line number Diff line change @@ -176,7 +176,7 @@ export default class ScopesScopeSessionRecordingsIndexController extends Control
176
176
{
177
177
select : config . select ,
178
178
query : {
179
- search : { value : search , fields : config . searchFields } ,
179
+ search : { text : search , fields : config . searchFields } ,
180
180
} ,
181
181
page : 1 ,
182
182
pageSize : 250 ,
@@ -187,13 +187,21 @@ export default class ScopesScopeSessionRecordingsIndexController extends Control
187
187
return results . map ( config . mapper ) ;
188
188
}
189
189
190
- async loadItems ( ) {
190
+ loadItems = restartableTask ( async ( ) => {
191
191
this . userFilters . options = await this . retrieveFilterOptions ( 'userFilters' ) ;
192
192
this . scopeFilters . options =
193
193
await this . retrieveFilterOptions ( 'scopeFilters' ) ;
194
194
this . targetFilters . options =
195
195
await this . retrieveFilterOptions ( 'targetFilters' ) ;
196
- }
196
+ } ) ;
197
+
198
+ // async loadItems() {
199
+ // this.userFilters.options = await this.retrieveFilterOptions('userFilters');
200
+ // this.scopeFilters.options =
201
+ // await this.retrieveFilterOptions('scopeFilters');
202
+ // this.targetFilters.options =
203
+ // await this.retrieveFilterOptions('targetFilters');
204
+ // }
197
205
198
206
// =actions
199
207
Original file line number Diff line number Diff line change @@ -222,6 +222,6 @@ export default class ScopesScopeSessionRecordingsIndexRoute extends Route {
222
222
*/
223
223
setupController ( controller ) {
224
224
super . setupController ( ...arguments ) ;
225
- controller . loadItems ( ) ;
225
+ controller . loadItems . perform ( ) ;
226
226
}
227
227
}
Original file line number Diff line number Diff line change 55
55
@isSearchable ={{ true }}
56
56
@searchTerm ={{ this.userFilters.search }}
57
57
@updateSearchTerm ={{ fn this.onFilterSearch.perform ' userFilters' }}
58
- @isLoading ={{ this.onFilterSearch.isRunning }}
58
+ @isLoading ={{ or
59
+ this.onFilterSearch.isRunning
60
+ this.loadItems.isRunning
61
+ }}
59
62
as |FD selectItem itemOptions|
60
63
>
61
64
{{ #each itemOptions as |itemOption |}}
82
85
this.onFilterSearch.perform
83
86
' scopeFilters'
84
87
}}
85
- @isLoading ={{ this.onFilterSearch.isRunning }}
88
+ @isLoading ={{ or
89
+ this.onFilterSearch.isRunning
90
+ this.loadItems.isRunning
91
+ }}
86
92
as |FD selectItem itemOptions|
87
93
>
88
94
{{ #each-in
118
124
this.onFilterSearch.perform
119
125
' targetFilters'
120
126
}}
121
- @isLoading ={{ this.onFilterSearch.isRunning }}
127
+ @isLoading ={{ or
128
+ this.onFilterSearch.isRunning
129
+ this.loadItems.isRunning
130
+ }}
122
131
as |FD selectItem itemOptions|
123
132
>
124
133
{{ #each itemOptions as |itemOption |}}
You can’t perform that action at this time.
0 commit comments