Updating tests and re-formatting.

This commit is contained in:
mike12345567 2020-10-09 19:30:50 +01:00
parent 763f7b3321
commit dc9552dbad
7 changed files with 10 additions and 15 deletions

View File

@ -52,7 +52,7 @@
onOk={deleteRow} onOk={deleteRow}
title="Confirm Delete" /> title="Confirm Delete" />
<Modal bind:this={modal}> <Modal bind:this={modal}>
<CreateEditRowModal row={row} /> <CreateEditRowModal {row} />
</Modal> </Modal>
<style> <style>

View File

@ -36,7 +36,7 @@
title={table.name} title={table.name}
icon="ri-table-fill" icon="ri-table-fill"
on:click={() => selectTable(table)}> on:click={() => selectTable(table)}>
<EditTablePopover table={table} /> <EditTablePopover {table} />
</ListItem> </ListItem>
{#each Object.keys(table.views || {}) as viewName} {#each Object.keys(table.views || {}) as viewName}
<ListItem <ListItem

View File

@ -86,8 +86,8 @@
<div class="root"> <div class="root">
{#if idFields.length === 0} {#if idFields.length === 0}
<div class="cannot-use"> <div class="cannot-use">
Update row can only be used within a component that provides data, such Update row can only be used within a component that provides data, such as
as a List a List
</div> </div>
{:else} {:else}
<Label size="m" color="dark">Row Id</Label> <Label size="m" color="dark">Row Id</Label>

View File

@ -218,8 +218,7 @@ exports.destroy = async function(ctx) {
// for automations include the row that was deleted // for automations include the row that was deleted
ctx.row = row ctx.row = row
ctx.eventEmitter && ctx.eventEmitter && ctx.eventEmitter.emitRow(`row:delete`, instanceId, row)
ctx.eventEmitter.emitRow(`row:delete`, instanceId, row)
} }
exports.validate = async function(ctx) { exports.validate = async function(ctx) {

View File

@ -116,9 +116,7 @@ exports.destroy = async function(ctx) {
include_docs: true, include_docs: true,
}) })
) )
await db.bulkDocs( await db.bulkDocs(rows.rows.map(row => ({ _id: row.id, _deleted: true })))
rows.rows.map(row => ({ _id: row.id, _deleted: true }))
)
// update linked rows // update linked rows
await linkRows.updateLinks({ await linkRows.updateLinks({

View File

@ -12,7 +12,6 @@ Object {
"field": "myField", "field": "myField",
"filters": Array [], "filters": Array [],
"groupBy": undefined, "groupBy": undefined,
"tableId": "14f1c4e94d6a47b682ce89d35d4c78b0",
"schema": Object { "schema": Object {
"avg": Object { "avg": Object {
"type": "number", "type": "number",
@ -36,6 +35,7 @@ Object {
"type": "number", "type": "number",
}, },
}, },
"tableId": "14f1c4e94d6a47b682ce89d35d4c78b0",
}, },
"reduce": "_stats", "reduce": "_stats",
} }
@ -65,8 +65,8 @@ Object {
}, },
], ],
"groupBy": undefined, "groupBy": undefined,
"tableId": "14f1c4e94d6a47b682ce89d35d4c78b0",
"schema": null, "schema": null,
"tableId": "14f1c4e94d6a47b682ce89d35d4c78b0",
}, },
} }
`; `;
@ -83,8 +83,8 @@ Object {
"field": "score", "field": "score",
"filters": Array [], "filters": Array [],
"groupBy": "age", "groupBy": "age",
"tableId": "14f1c4e94d6a47b682ce89d35d4c78b0",
"schema": null, "schema": null,
"tableId": "14f1c4e94d6a47b682ce89d35d4c78b0",
}, },
"reduce": "_stats", "reduce": "_stats",
} }

View File

@ -67,9 +67,7 @@ exports.getRowParams = (tableId, rowId = null, otherProps = {}) => {
throw "Cannot build params for rows without a table ID" throw "Cannot build params for rows without a table ID"
} }
const endOfKey = const endOfKey =
rowId == null rowId == null ? `${tableId}${SEPARATOR}` : `${tableId}${SEPARATOR}${rowId}`
? `${tableId}${SEPARATOR}`
: `${tableId}${SEPARATOR}${rowId}`
return getDocParams(DocumentTypes.ROW, endOfKey, otherProps) return getDocParams(DocumentTypes.ROW, endOfKey, otherProps)
} }