diff --git a/packages/builder/src/builderStore/dataBinding.js b/packages/builder/src/builderStore/dataBinding.js
index c1cbdf4b07..79785f4e8d 100644
--- a/packages/builder/src/builderStore/dataBinding.js
+++ b/packages/builder/src/builderStore/dataBinding.js
@@ -64,7 +64,6 @@ export const getDatasourceForProvider = component => {
return {
tableId: component[datasourceSetting?.key],
type: "table",
- searchableOnly: datasourceSetting.searchableOnly,
}
}
return null
@@ -196,12 +195,6 @@ export const getSchemaForDatasource = datasource => {
schema = cloneDeep(table.views?.[datasource.name]?.schema)
} else {
schema = cloneDeep(table.schema)
- // Find searchable fields only
- if (datasource.searchableOnly) {
- Object.keys(table.schema).forEach(key => {
- if (!table.schema[key].searchable) delete schema[key]
- })
- }
}
}
}
diff --git a/packages/builder/src/components/backend/DataTable/modals/CreateEditColumn.svelte b/packages/builder/src/components/backend/DataTable/modals/CreateEditColumn.svelte
index 147969ce93..6878b5b92b 100644
--- a/packages/builder/src/components/backend/DataTable/modals/CreateEditColumn.svelte
+++ b/packages/builder/src/components/backend/DataTable/modals/CreateEditColumn.svelte
@@ -127,7 +127,7 @@
+ text="Index for Search" />
{/if}
{#if field.type === 'string'}
diff --git a/packages/builder/src/components/design/PropertiesPanel/PropertyControls/TableViewSelect.svelte b/packages/builder/src/components/design/PropertiesPanel/PropertyControls/TableViewSelect.svelte
index b8d975e2a4..a467a954a2 100644
--- a/packages/builder/src/components/design/PropertiesPanel/PropertyControls/TableViewSelect.svelte
+++ b/packages/builder/src/components/design/PropertiesPanel/PropertyControls/TableViewSelect.svelte
@@ -17,7 +17,6 @@
const dispatch = createEventDispatcher()
let anchorRight, dropdownRight
let drawer
- let tableDrawer
export let value = {}
diff --git a/packages/server/src/api/controllers/row.js b/packages/server/src/api/controllers/row.js
index b005c1d2f3..3bb72f08c3 100644
--- a/packages/server/src/api/controllers/row.js
+++ b/packages/server/src/api/controllers/row.js
@@ -233,6 +233,8 @@ exports.createIndex = async function(ctx) {
const appId = "app_1987903cf3604d459969c80cf17651a0"
const db = new CouchDB(appId)
+ const indexes = await db.getIndexes()
+
// ctx.body = await db.get("_design/search_ddoc")
ctx.body = await db.createIndex({
index: {
@@ -246,28 +248,32 @@ exports.createIndex = async function(ctx) {
}
exports.search = async function(ctx) {
- const appId = ctx.user.appId
- // const appId = "app_1987903cf3604d459969c80cf17651a0"
+ // const appId = ctx.user.appId
+ const appId = "app_1987903cf3604d459969c80cf17651a0"
const db = new CouchDB(appId)
const {
query,
- pagination: { pageSize = 10, cursor },
+ pagination: { pageSize = 10, page },
} = ctx.request.body
query.tableId = ctx.params.tableId
// Paginating
- if (cursor) {
- query._id = { $gte: cursor }
- }
+ // if (cursor) {
+ // if (backwards) {
+ // query._id = { $lte: cursor }
+ // } else {
+ // query._id = { $gte: cursor }
+ // }
+ // }
const response = await db.find({
selector: query,
limit: pageSize,
- sort: ["_id"],
- skip: 1,
+ skip: pageSize * page,
+ // sort: ["_id"],
})
const rows = response.docs
@@ -279,6 +285,7 @@ exports.search = async function(ctx) {
}
}
+ // ctx.body = response
ctx.body = await linkRows.attachLinkInfo(appId, rows)
}
diff --git a/packages/standard-components/manifest.json b/packages/standard-components/manifest.json
index 291979a527..7f30f10886 100644
--- a/packages/standard-components/manifest.json
+++ b/packages/standard-components/manifest.json
@@ -130,8 +130,7 @@
{
"type": "table",
"label": "Table",
- "key": "table",
- "searchableOnly": true
+ "key": "table"
},
{
"type": "multifield",
diff --git a/packages/standard-components/src/Search.svelte b/packages/standard-components/src/Search.svelte
index 9e17810af3..31b800acbc 100644
--- a/packages/standard-components/src/Search.svelte
+++ b/packages/standard-components/src/Search.svelte
@@ -25,15 +25,13 @@
let schema
// pagination
- let pagination = {
- page: 1
- }
+ let page = 0
- $: fetchData(table, pagination)
+ $: fetchData(table, page)
// omit empty strings
$: parsedSearch = Object.keys(search).reduce((acc, next) => search[next] === "" ? acc : { ...acc, [next]: search[next] }, {})
- async function fetchData(table, pagination) {
+ async function fetchData(table, page) {
if (!isEmpty(table)) {
const tableDef = await API.fetchTableDefinition(table)
schema = tableDef.schema
@@ -42,7 +40,7 @@
search: parsedSearch,
pagination: {
pageSize,
- ...pagination
+ page
}
})
}
@@ -50,22 +48,11 @@
}
function nextPage() {
- // set cursor to last element
- pagination = {
- // lastCursor: rows[0],
- cursor: rows[rows.length - 1]?._id,
- reverse: true,
- page: pagination.page += 1
- }
+ page += 1
}
- // TODO: implement
function previousPage() {
- pagination = {
- cursor: lastCursor,
- reverse: true,
- page: pagination.page - 1
- }
+ page -= 1
}
@@ -99,9 +86,7 @@
secondary
on:click={() => {
search = {}
- pagination = {
- page: 1
- }
+ page = 0
}}>
Reset
@@ -124,12 +109,14 @@
{noRowsMessage}
{/if}
@@ -160,8 +147,10 @@
}
.pagination {
- display: flex;
+ display: grid;
+ grid-gap: var(--spacing-s);
justify-content: flex-end;
margin-top: var(--spacing-m);
+ grid-auto-flow: column;
}