Browse Source

Merge pull request #5498 from Budibase/bug/sev3/remove-row-rev

Remove Row Rev field for Actions and Automations
master
melohagan 5 years ago
committed by GitHub
parent
commit
67a268e2b3
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      packages/builder/src/components/design/PropertiesPanel/PropertyControls/ButtonActionEditor/actions/DeleteRow.svelte
  2. 2
      packages/client/src/utils/buttonActions.js
  3. 2
      packages/frontend-core/src/api/rows.js
  4. 3
      packages/server/src/api/controllers/row/internal.js
  5. 8
      packages/server/src/automations/steps/deleteRow.js

8
packages/builder/src/components/design/PropertiesPanel/PropertyControls/ButtonActionEditor/actions/DeleteRow.svelte

@ -26,14 +26,6 @@
on:change={value => (parameters.rowId = value.detail)} on:change={value => (parameters.rowId = value.detail)}
/> />
<Label small>Row Rev</Label>
<DrawerBindableInput
{bindings}
title="Row rev to delete"
value={parameters.revId}
on:change={value => (parameters.revId = value.detail)}
/>
<Label small /> <Label small />
<Checkbox text="Require confirmation" bind:value={parameters.confirm} /> <Checkbox text="Require confirmation" bind:value={parameters.confirm} />

2
packages/client/src/utils/buttonActions.js

@ -81,7 +81,7 @@ const duplicateRowHandler = async (action, context) => {
const deleteRowHandler = async action => { const deleteRowHandler = async action => {
const { tableId, revId, rowId } = action.parameters const { tableId, revId, rowId } = action.parameters
if (tableId && revId && rowId) { if (tableId && rowId) {
try { try {
await API.deleteRow({ tableId, rowId, revId }) await API.deleteRow({ tableId, rowId, revId })
notificationStore.actions.success("Row deleted") notificationStore.actions.success("Row deleted")

2
packages/frontend-core/src/api/rows.js

@ -35,7 +35,7 @@ export const buildRowEndpoints = API => ({
* @param revId the rev of the row to delete * @param revId the rev of the row to delete
*/ */
deleteRow: async ({ tableId, rowId, revId }) => { deleteRow: async ({ tableId, rowId, revId }) => {
if (!tableId || !rowId || !revId) { if (!tableId || !rowId) {
return return
} }
return await API.delete({ return await API.delete({

3
packages/server/src/api/controllers/row/internal.js

@ -259,8 +259,9 @@ exports.find = async ctx => {
exports.destroy = async function (ctx) { exports.destroy = async function (ctx) {
const db = getAppDB() const db = getAppDB()
const { _id, _rev } = ctx.request.body const { _id } = ctx.request.body
let row = await db.get(_id) let row = await db.get(_id)
let _rev = ctx.request.body._rev || row._rev
if (row.tableId !== ctx.params.tableId) { if (row.tableId !== ctx.params.tableId) {
throw "Supplied tableId doesn't match the row's tableId" throw "Supplied tableId doesn't match the row's tableId"

8
packages/server/src/automations/steps/deleteRow.js

@ -24,12 +24,8 @@ exports.definition = {
type: "string", type: "string",
title: "Row ID", title: "Row ID",
}, },
revision: {
type: "string",
title: "Row Revision",
},
}, },
required: ["tableId", "id", "revision"], required: ["tableId", "id"],
}, },
outputs: { outputs: {
properties: { properties: {
@ -53,7 +49,7 @@ exports.definition = {
} }
exports.run = async function ({ inputs, appId, emitter }) { exports.run = async function ({ inputs, appId, emitter }) {
if (inputs.id == null || inputs.revision == null) { if (inputs.id == null) {
return { return {
success: false, success: false,
response: { response: {

Loading…
Cancel
Save