code review

This commit is contained in:
Martin McKeaveney 2021-02-10 14:24:42 +00:00
parent 587d20b611
commit 24c2dd2cdb
4 changed files with 29 additions and 17 deletions

View File

@ -256,7 +256,9 @@ exports.search = async function(ctx) {
}
}
ctx.body = await linkRows.attachLinkInfo(appId, rows)
const table = await db.get(ctx.params.tableId)
ctx.body = await enrichRows(appId, table, rows)
}
exports.fetchTableRows = async function(ctx) {

View File

@ -41,6 +41,7 @@ router
)
.post(
"/api/:tableId/rows/search",
paramResource("tableId"),
authorized(PermissionTypes.TABLE, PermissionLevels.READ),
rowController.search
)

View File

@ -146,7 +146,8 @@
{
"type": "text",
"label": "No Rows Message",
"key": "noRowsMessage"
"key": "noRowsMessage",
"defaultValue": "No Rows"
}
]
},

View File

@ -16,7 +16,7 @@
export let table = []
export let columns = []
export let pageSize = 50
export let noRowsMessage = "No Rows"
export let noRowsMessage
let rows = []
let loaded = false
@ -94,23 +94,32 @@
}}>
Reset
</Button>
<Button primary on:click={() => fetchData(table)}>Search</Button>
<Button
primary
on:click={() => {
page = 0
fetchData(table, page)
}}>
Search
</Button>
</div>
</div>
{#if rows.length > 0}
{#if $component.children === 0 && $builderStore.inBuilder}
<p>Add some components too</p>
{#if loaded}
{#if rows.length > 0}
{#if $component.children === 0 && $builderStore.inBuilder}
<p>Add some components too</p>
{:else}
{#each rows as row}
<DataProvider {row}>
<slot />
</DataProvider>
{/each}
{/if}
{:else if $builderStore.inBuilder}
<p>Feed me some data</p>
{:else}
{#each rows as row}
<DataProvider {row}>
<slot />
</DataProvider>
{/each}
<p>{noRowsMessage}</p>
{/if}
{:else if loaded && $builderStore.inBuilder}
<p>Feed me some data</p>
{:else}
<p>{noRowsMessage}</p>
{/if}
<div class="pagination">
{#if page > 0}
@ -133,7 +142,6 @@
.query-builder {
padding: var(--spacing-m);
background: var(--background);
border-radius: var(--border-radius-s);
}