From 4be3014e91d3351902cfab196d7c59d5540b0b2e Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Wed, 14 Oct 2020 15:06:48 +0100 Subject: [PATCH] update row_save event --- .../userInterface/temporaryPanelStructure.js | 74 +++++++++---------- packages/server/src/api/controllers/row.js | 24 +++--- 2 files changed, 45 insertions(+), 53 deletions(-) diff --git a/packages/builder/src/components/userInterface/temporaryPanelStructure.js b/packages/builder/src/components/userInterface/temporaryPanelStructure.js index 7914e1a43a..36a6c8e073 100644 --- a/packages/builder/src/components/userInterface/temporaryPanelStructure.js +++ b/packages/builder/src/components/userInterface/temporaryPanelStructure.js @@ -1165,14 +1165,6 @@ export default { }, children: [], }, - // { - // name: "Map", - // _component: "@budibase/standard-components/datamap", - // description: "Shiny map", - // icon: "ri-map-pin-line", - // properties: { design: { ...all } }, - // children: [], - // }, ], }, { @@ -1206,39 +1198,39 @@ export default { ], }, }, - { - name: "Login", - _component: "@budibase/standard-components/login", - description: - "A component that automatically generates a login screen for your app.", - icon: "ri-login-box-line", - children: [], - properties: { - design: { ...all }, - settings: [ - { - label: "Name", - key: "name", - control: Input, - }, - { - label: "Logo", - key: "logo", - control: Input, - }, - { - label: "Title", - key: "title", - control: Input, - }, - { - label: "Button Text", - key: "buttonText", - control: Input, - }, - ], - }, - }, + // { + // name: "Login", + // _component: "@budibase/standard-components/login", + // description: + // "A component that automatically generates a login screen for your app.", + // icon: "ri-login-box-line", + // children: [], + // properties: { + // design: { ...all }, + // settings: [ + // { + // label: "Name", + // key: "name", + // control: Input, + // }, + // { + // label: "Logo", + // key: "logo", + // control: Input, + // }, + // { + // label: "Title", + // key: "title", + // control: Input, + // }, + // { + // label: "Button Text", + // key: "buttonText", + // control: Input, + // }, + // ], + // }, + // }, ], }, ], diff --git a/packages/server/src/api/controllers/row.js b/packages/server/src/api/controllers/row.js index 9c39149bae..8466cfcc33 100644 --- a/packages/server/src/api/controllers/row.js +++ b/packages/server/src/api/controllers/row.js @@ -12,16 +12,16 @@ const { cloneDeep } = require("lodash") const TABLE_VIEW_BEGINS_WITH = `all${SEPARATOR}${DocumentTypes.TABLE}${SEPARATOR}` validateJs.extend(validateJs.validators.datetime, { - parse: function(value) { + parse: function (value) { return new Date(value).getTime() }, // Input is a unix timestamp - format: function(value) { + format: function (value) { return new Date(value).toISOString() }, }) -exports.patch = async function(ctx) { +exports.patch = async function (ctx) { const instanceId = ctx.user.instanceId const db = new CouchDB(instanceId) let row = await db.get(ctx.params.id) @@ -67,7 +67,7 @@ exports.patch = async function(ctx) { ctx.message = `${table.name} updated successfully.` } -exports.save = async function(ctx) { +exports.save = async function (ctx) { const instanceId = ctx.user.instanceId const db = new CouchDB(instanceId) let row = ctx.request.body @@ -107,7 +107,7 @@ exports.save = async function(ctx) { // make sure link rows are up to date row = await linkRows.updateLinks({ instanceId, - eventType: linkRows.EventType.RECORD_SAVE, + eventType: linkRows.EventType.ROW_SAVE, row, tableId: row.tableId, table, @@ -134,7 +134,7 @@ exports.save = async function(ctx) { ctx.message = `${table.name} created successfully` } -exports.fetchView = async function(ctx) { +exports.fetchView = async function (ctx) { const instanceId = ctx.user.instanceId const db = new CouchDB(instanceId) const { stats, group, field } = ctx.query @@ -166,7 +166,7 @@ exports.fetchView = async function(ctx) { ctx.body = await linkRows.attachLinkInfo(instanceId, response.rows) } -exports.fetchTableRows = async function(ctx) { +exports.fetchTableRows = async function (ctx) { const instanceId = ctx.user.instanceId const db = new CouchDB(instanceId) const response = await db.allDocs( @@ -181,7 +181,7 @@ exports.fetchTableRows = async function(ctx) { ) } -exports.search = async function(ctx) { +exports.search = async function (ctx) { const instanceId = ctx.user.instanceId const db = new CouchDB(instanceId) const response = await db.allDocs({ @@ -194,7 +194,7 @@ exports.search = async function(ctx) { ) } -exports.find = async function(ctx) { +exports.find = async function (ctx) { const instanceId = ctx.user.instanceId const db = new CouchDB(instanceId) const row = await db.get(ctx.params.rowId) @@ -205,7 +205,7 @@ exports.find = async function(ctx) { ctx.body = await linkRows.attachLinkInfo(instanceId, row) } -exports.destroy = async function(ctx) { +exports.destroy = async function (ctx) { const instanceId = ctx.user.instanceId const db = new CouchDB(instanceId) const row = await db.get(ctx.params.rowId) @@ -227,7 +227,7 @@ exports.destroy = async function(ctx) { ctx.eventEmitter && ctx.eventEmitter.emitRow(`row:delete`, instanceId, row) } -exports.validate = async function(ctx) { +exports.validate = async function (ctx) { const errors = await validate({ instanceId: ctx.user.instanceId, tableId: ctx.params.tableId, @@ -253,7 +253,7 @@ async function validate({ instanceId, tableId, row, table }) { return { valid: Object.keys(errors).length === 0, errors } } -exports.fetchEnrichedRow = async function(ctx) { +exports.fetchEnrichedRow = async function (ctx) { const instanceId = ctx.user.instanceId const db = new CouchDB(instanceId) const tableId = ctx.params.tableId