1
0
Fork 0
mirror of synced 2024-06-30 12:00:31 +12:00

Merge pull request #1188 from Budibase/develop

Develop
This commit is contained in:
Martin McKeaveney 2021-02-24 22:42:58 +00:00 committed by GitHub
commit 3e1744c759
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 16 additions and 4 deletions

View file

@ -2,6 +2,7 @@
import { Button, Input, Select } from "@budibase/bbui"
import { backendUiStore } from "builderStore"
import { notifier } from "builderStore/store/notifications"
import { FIELDS } from "constants/backend"
export let view = {}
export let onClosed
@ -9,7 +10,11 @@
$: viewTable = $backendUiStore.tables.find(
({ _id }) => _id === $backendUiStore.selectedView.tableId
)
$: fields = viewTable && Object.keys(viewTable.schema)
$: fields =
viewTable &&
Object.entries(viewTable.schema)
.filter(entry => entry[1].type !== FIELDS.LINK.type)
.map(([key]) => key)
function saveView() {
backendUiStore.actions.views.save(view)

View file

@ -202,6 +202,11 @@ exports.fetchView = async function(ctx) {
const db = new CouchDB(appId)
const { calculation, group, field } = ctx.query
const designDoc = await db.get("_design/database")
const viewInfo = designDoc.views[viewName]
if (!viewInfo) {
ctx.throw(400, "View does not exist.")
}
const response = await db.query(`database/${viewName}`, {
include_docs: !calculation,
group,
@ -211,7 +216,7 @@ exports.fetchView = async function(ctx) {
response.rows = response.rows.map(row => row.doc)
let table
try {
table = await db.get(ctx.params.tableId)
table = await db.get(viewInfo.meta.tableId)
} catch (err) {
table = {
schema: {},

View file

@ -55,7 +55,7 @@ const SCHEMA = {
class MySQLIntegration {
constructor(config) {
this.config = config
if (Object.keys(config.ssl) === 0) {
if (Object.keys(config.ssl).length === 0) {
delete config.ssl
}
this.client = mysql.createConnection(config)

View file

@ -136,6 +136,8 @@ exports.coerce = (row, type) => {
*/
exports.inputProcessing = (user, table, row) => {
let clonedRow = cloneDeep(row)
// need to copy the table so it can be differenced on way out
const copiedTable = cloneDeep(table)
for (let [key, value] of Object.entries(clonedRow)) {
const field = table.schema[key]
if (!field) {
@ -144,7 +146,7 @@ exports.inputProcessing = (user, table, row) => {
clonedRow[key] = exports.coerce(value, field.type)
}
// handle auto columns - this returns an object like {table, row}
return processAutoColumn(user, table, clonedRow)
return processAutoColumn(user, copiedTable, clonedRow)
}
/**