feat(records): move sync settings and preserve paginated navigation
This commit is contained in:
1 parent
de30cb5706
commit
c215e6ec6c
26 files changed
+201
-34
No files matched your search
@@ -41,6 +41,7 @@ class BpmScanStore{
|
||||
if(q){conditions.push("value LIKE ? ESCAPE '\\'");args.push('%'+q.replace(/[\\%_]/g,'\\$&')+'%');}
|
||||
if(from){conditions.push('day>=?');args.push(from);}if(to){conditions.push('day<=?');args.push(to);}
|
||||
const where=conditions.length?' WHERE '+conditions.join(' AND '):'',total=this.db.prepare('SELECT COUNT(*) n FROM arrivals'+where).get(...args).n;
|
||||
page=Math.min(page,Math.max(1,Math.ceil(total/pageSize)));
|
||||
const items=this.db.prepare("SELECT connection_id AS connectionId,source,task_id AS storageKey,value,first_seen AS firstSeenAt,last_seen AS lastSeenAt FROM arrivals"+where+" ORDER BY json_extract(value,'$.arrivedAt') DESC,connection_id,source,task_id LIMIT ? OFFSET ?").all(...args,pageSize,(page-1)*pageSize).map(({value,storageKey,...rest})=>({...JSON.parse(value),...rest,recordId:JSON.stringify([rest.connectionId,rest.source,storageKey])}));
|
||||
return {items,total,page,pageSize};
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user