Fix delete row action
This commit is contained in:
parent
f453ed6c43
commit
580837f949
|
@ -15,8 +15,9 @@
|
|||
)
|
||||
$: {
|
||||
// Automatically set rev and table ID based on row ID
|
||||
if (parameters.rowId) {
|
||||
parameters.revId = parameters.rowId.replace("_id", "_rev")
|
||||
if (parameters.providerId) {
|
||||
parameters.rowId = `{{ ${parameters.providerId}._id }}`
|
||||
parameters.revId = `{{ ${parameters.providerId}._rev }}`
|
||||
const providerComponent = dataProviderComponents.find(
|
||||
provider => provider._id === parameters.providerId
|
||||
)
|
||||
|
@ -37,12 +38,10 @@
|
|||
</div>
|
||||
{:else}
|
||||
<Label size="m" color="dark">Datasource</Label>
|
||||
<Select secondary bind:value={parameters.rowId}>
|
||||
<Select secondary bind:value={parameters.providerId}>
|
||||
<option value="" />
|
||||
{#each dataProviderComponents as provider}
|
||||
<option value={`{{ ${provider._id}._id }}`}>
|
||||
{provider._instanceName}
|
||||
</option>
|
||||
<option value={provider._id}>{provider._instanceName}</option>
|
||||
{/each}
|
||||
</Select>
|
||||
{/if}
|
||||
|
|
|
@ -17,19 +17,10 @@ const saveRowHandler = async (action, context) => {
|
|||
}
|
||||
}
|
||||
|
||||
const deleteRowHandler = async (action, context) => {
|
||||
const deleteRowHandler = async action => {
|
||||
const { tableId, revId, rowId } = action.parameters
|
||||
if (tableId && revId && rowId) {
|
||||
const [enrichTable, enrichRow, enrichRev] = await Promise.all([
|
||||
enrichDataBinding(tableId, context),
|
||||
enrichDataBinding(rowId, context),
|
||||
enrichDataBinding(revId, context),
|
||||
])
|
||||
await deleteRow({
|
||||
tableId: enrichTable,
|
||||
rowId: enrichRow,
|
||||
revId: enrichRev,
|
||||
})
|
||||
await deleteRow({ tableId, rowId, revId })
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue