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

filter-search #569

Merged
merged 1 commit into from
Sep 26, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion client/src/components/SchemaView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,8 @@ export default {
$limit: this.limit,
'_currentStatus': true,
'_state': this.$route.params.stateid,
'id[$search]': '^' + query.text
// 'id[$search]': '^' + query.text
'$search': query.text
}, heads)
.then(res => {
this.isFlowzLoaded = true
Expand Down Expand Up @@ -375,6 +376,7 @@ export default {
// })
},
sortData (object) {
// console.log('object')
},
emailService (item) {
this.isEmailDone = true
Expand Down
14 changes: 13 additions & 1 deletion service/src/services/dflowzdata/dflowzdata.hooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,23 @@ let beforeFind = function (hook) {
const query = hook.service.service.createQuery(hook.params.query);
hook.params.rethinkdb = query.group(value)
}
if (query.$search !== undefined) {
hook.service.service.options.name = hook.params.headers.ftablename;
hook.service.service.table = hook.service.rDB.table(hook.params.headers.ftablename);
let value = hook.params.query.$search
delete hook.params.query.$search
const query = hook.service.service.createQuery(hook.params.query);
// hook.params.rethinkdb = query.group(value)
hook.params.rethinkdb = query.filter(function(doc) {
return doc.coerceTo('string').match('(?i)' + value);
})
// console.log('hook.params.rethinkdb', hook.params.rethinkdb)
}
}

function beforeCreate (hook) {
try {
console.log('before create ================================', hook.params)
// console.log('before create ================================', hook.params)
hook.params.done = true
if (hook.params.headers.ftablename !== undefined && hook.data._state !== undefined) {
let regex = /_/g
Expand Down