Skip to content
This repository was archived by the owner on Oct 30, 2023. It is now read-only.

Commit 3021769

Browse files
authored
Merge pull request #569 from FlowzPlatform/issue-504-n4
filter-search
2 parents 51d2922 + a7364df commit 3021769

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

client/src/components/SchemaView.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,8 @@ export default {
313313
$limit: this.limit,
314314
'_currentStatus': true,
315315
'_state': this.$route.params.stateid,
316-
'id[$search]': '^' + query.text
316+
// 'id[$search]': '^' + query.text
317+
'$search': query.text
317318
}, heads)
318319
.then(res => {
319320
this.isFlowzLoaded = true
@@ -375,6 +376,7 @@ export default {
375376
// })
376377
},
377378
sortData (object) {
379+
// console.log('object')
378380
},
379381
emailService (item) {
380382
this.isEmailDone = true

service/src/services/dflowzdata/dflowzdata.hooks.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,23 @@ let beforeFind = function (hook) {
6060
const query = hook.service.service.createQuery(hook.params.query);
6161
hook.params.rethinkdb = query.group(value)
6262
}
63+
if (query.$search !== undefined) {
64+
hook.service.service.options.name = hook.params.headers.ftablename;
65+
hook.service.service.table = hook.service.rDB.table(hook.params.headers.ftablename);
66+
let value = hook.params.query.$search
67+
delete hook.params.query.$search
68+
const query = hook.service.service.createQuery(hook.params.query);
69+
// hook.params.rethinkdb = query.group(value)
70+
hook.params.rethinkdb = query.filter(function(doc) {
71+
return doc.coerceTo('string').match('(?i)' + value);
72+
})
73+
// console.log('hook.params.rethinkdb', hook.params.rethinkdb)
74+
}
6375
}
6476

6577
function beforeCreate (hook) {
6678
try {
67-
console.log('before create ================================', hook.params)
79+
// console.log('before create ================================', hook.params)
6880
hook.params.done = true
6981
if (hook.params.headers.ftablename !== undefined && hook.data._state !== undefined) {
7082
let regex = /_/g

0 commit comments

Comments
 (0)