Merge pull request #6627 from Budibase/fix/june-fixes

Various fixes for release
This commit is contained in:
Martin McKeaveney 2022-07-11 10:00:31 +01:00 committed by GitHub
commit bd87f0a9b3
14 changed files with 602 additions and 1799 deletions

View File

@ -5,8 +5,9 @@
import { notifications } from "@budibase/bbui"
import RowFieldControl from "../RowFieldControl.svelte"
import { API } from "api"
import { ModalContent, Select } from "@budibase/bbui"
import { ModalContent, Select, Link } from "@budibase/bbui"
import ErrorsBox from "components/common/ErrorsBox.svelte"
import { goto } from "@roxi/routify"
export let row = {}
@ -87,6 +88,15 @@
onConfirm={saveRow}
>
<ErrorsBox {errors} />
<!-- need to explain to the user the readonly fields -->
{#if !creating}
<div>
A user's email, role, first and last names cannot be changed from within
the app builder. Please go to the <Link
on:click={$goto("/builder/portal/manage/users")}>user portal</Link
> to do this.
</div>
{/if}
<RowFieldControl
meta={{ ...tableSchema.email, name: "Email" }}
bind:value={row.email}

View File

@ -99,6 +99,7 @@
}
onMount(async () => {
await automationStore.actions.fetch()
const params = new URLSearchParams(window.location.search)
const shouldOpen = params.get("open") === ERROR
// open with errors, open panel for latest

View File

@ -304,9 +304,11 @@
on:unpublish={e => unpublishApp(e.detail)}
/>
</Tab>
<Tab title="Automation History">
<HistoryTab app={selectedApp} />
</Tab>
{#if isPublished}
<Tab title="Automation History">
<HistoryTab app={selectedApp} />
</Tab>
{/if}
{#if false}
<Tab title="Backups">
<div class="container">Backups contents</div>

File diff suppressed because it is too large Load Diff

View File

@ -2137,6 +2137,10 @@
"query": {
"type": "object",
"properties": {
"allOr": {
"type": "boolean",
"description": "Specifies that a row should be returned if it satisfies any of the specified options, rather than requiring it to fulfill all the search parameters. This defaults to false, meaning AND logic will be used."
},
"string": {
"type": "object",
"example": {
@ -2155,12 +2159,12 @@
},
"range": {
"type": "object",
"description": "Searches within a range, the format of this must be columnName -> [low, high].",
"description": "Searches within a range, the format of this must be in the format of an object with a \"low\" and \"high\" property.",
"example": {
"columnName1": [
10,
20
]
"columnName1": {
"low": 10,
"high": 20
}
}
},
"equal": {

View File

@ -1551,6 +1551,12 @@ paths:
query:
type: object
properties:
allOr:
type: boolean
description: Specifies that a row should be returned if it satisfies any of the
specified options, rather than requiring it to fulfill
all the search parameters. This defaults to false,
meaning AND logic will be used.
string:
type: object
example:
@ -1566,12 +1572,12 @@ paths:
description: A fuzzy search, only supported by internal tables.
range:
type: object
description: Searches within a range, the format of this must be columnName ->
[low, high].
description: Searches within a range, the format of this must be in the format
of an object with a "low" and "high" property.
example:
columnName1:
- 10
- 20
low: 10
high: 20
equal:
type: object
description: Searches for rows that have a column value that is exactly the

View File

@ -1,6 +1,6 @@
const { getAllApps } = require("@budibase/backend-core/db")
const { updateAppId } = require("@budibase/backend-core/context")
import { search as stringSearch } from "./utils"
import { search as stringSearch, addRev } from "./utils"
import * as controller from "../application"
import { Application } from "../../../definitions/common"
@ -47,7 +47,7 @@ export async function read(ctx: any, next: any) {
}
export async function update(ctx: any, next: any) {
ctx.request.body = fixAppID(ctx.request.body, ctx.params)
ctx.request.body = await addRev(fixAppID(ctx.request.body, ctx.params))
updateAppId(ctx.params.appId)
await controller.update(ctx)
await setResponseApp(ctx)

View File

@ -1,5 +1,6 @@
const { getAppDB } = require("@budibase/backend-core/context")
import { isExternalTable } from "../../../integrations/utils"
import { APP_PREFIX, DocumentTypes } from "../../../db/utils"
export async function addRev(
body: { _id?: string; _rev?: string },
@ -8,9 +9,15 @@ export async function addRev(
if (!body._id || (tableId && isExternalTable(tableId))) {
return body
}
let id = body._id
if (body._id.startsWith(APP_PREFIX)) {
id = DocumentTypes.APP_METADATA
}
const db = getAppDB()
const dbDoc = await db.get(body._id)
const dbDoc = await db.get(id)
body._rev = dbDoc._rev
// update ID in case it is an app ID
body._id = id
return body
}

View File

@ -10,6 +10,7 @@ const { getAppId } = require("@budibase/backend-core/context")
class QueryBuilder {
constructor(base) {
this.query = {
allOr: false,
string: {},
fuzzy: {},
range: {},
@ -146,8 +147,22 @@ class QueryBuilder {
buildSearchQuery() {
const builder = this
let query = "*:*"
let allOr = this.query && this.query.allOr
let query = allOr ? "" : "*:*"
const allPreProcessingOpts = { escape: true, lowercase: true, wrap: true }
let tableId
if (this.query.equal.tableId) {
tableId = this.query.equal.tableId
delete this.query.equal.tableId
}
const equal = (key, value) => {
// 0 evaluates to false, which means we would return all rows if we don't check it
if (!value && value !== 0) {
return null
}
return `${key}:${builder.preprocess(value, allPreProcessingOpts)}`
}
function build(structure, queryFn) {
for (let [key, value] of Object.entries(structure)) {
@ -158,7 +173,10 @@ class QueryBuilder {
if (expression == null) {
continue
}
query += ` AND ${expression}`
if (query.length > 0) {
query += ` ${allOr ? "OR" : "AND"} `
}
query += expression
}
}
@ -204,13 +222,7 @@ class QueryBuilder {
})
}
if (this.query.equal) {
build(this.query.equal, (key, value) => {
// 0 evaluates to false, which means we would return all rows if we don't check it
if (!value && value !== 0) {
return null
}
return `${key}:${builder.preprocess(value, allPreProcessingOpts)}`
})
build(this.query.equal, equal)
}
if (this.query.notEqual) {
build(this.query.notEqual, (key, value) => {
@ -248,6 +260,12 @@ class QueryBuilder {
return `${key}:(${orStatement})`
})
}
// make sure table ID is always added as an AND
if (tableId) {
query = `(${query})`
allOr = false
build({ tableId }, equal)
}
return query
}

View File

@ -150,6 +150,11 @@ read.push(new Endpoint("get", "/tables/:tableId/rows/:rowId", controller.read))
* query:
* type: object
* properties:
* allOr:
* type: boolean
* description: Specifies that a row should be returned if it satisfies
* any of the specified options, rather than requiring it to fulfill all
* the search parameters. This defaults to false, meaning AND logic will be used.
* string:
* type: object
* example:
@ -167,9 +172,9 @@ read.push(new Endpoint("get", "/tables/:tableId/rows/:rowId", controller.read))
* range:
* type: object
* description: Searches within a range, the format of this must be
* columnName -> [low, high].
* in the format of an object with a "low" and "high" property.
* example:
* columnName1: [10, 20]
* columnName1: { low: 10, high: 20 }
* equal:
* type: object
* description: Searches for rows that have a column value that is

View File

@ -58,6 +58,7 @@ function filterObject() {
oneOf: Joi.object().optional(),
contains: Joi.object().optional(),
notContains: Joi.object().optional(),
allOr: Joi.boolean().optional(),
}).unknown(true)
}

File diff suppressed because it is too large Load Diff

View File

@ -1080,11 +1080,12 @@
resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39"
integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==
"@budibase/backend-core@1.0.218":
version "1.0.218"
resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-1.0.218.tgz#be101c8baf220fa3fc55d63071bb38fc6c8cf4d8"
integrity sha512-v9+bvQ2+OsK7eGyDHzMuPawTu2LovRCsuArFeMnaG/AbexkqnbB74w+h3vh/2npuHzrnk8RZkM2c4pp/ycqfKw==
"@budibase/backend-core@1.0.219-alpha.17":
version "1.0.219-alpha.17"
resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-1.0.219-alpha.17.tgz#eacb5feb851f6a20771d9505d38f123398e5dc06"
integrity sha512-cR0MLkXOuVht/1cqXspFaduGeaEroe/JfIkidss1OVvi2E5YjcUjDgZIYvlNiUTnh1ggGv7ql4AI4CZDk5LaHw==
dependencies:
"@budibase/types" "^1.0.219-alpha.17"
"@techpass/passport-openidconnect" "0.3.2"
aws-sdk "2.1030.0"
bcrypt "5.0.1"
@ -1161,12 +1162,13 @@
svelte-flatpickr "^3.2.3"
svelte-portal "^1.0.0"
"@budibase/pro@1.0.218":
version "1.0.218"
resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-1.0.218.tgz#b9e5bb95cca996dc1f7f783a3a02e51cbbf3df55"
integrity sha512-LJpV4rYPP9DzMNkL2Y0euZplkubBKBE+gc5JBTMt1l9Fwn2Sri/Y5bQ+U8fjczjmHxYnZLrFwH+o6LCnk/QJow==
"@budibase/pro@1.0.219-alpha.17":
version "1.0.219-alpha.17"
resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-1.0.219-alpha.17.tgz#bedf4b9e84e8225855e22526b0b1dcc760c6ccfe"
integrity sha512-bQGkeqzZL+fzQ69oFYnEIwGJ3v8kCXxl6jlMqLEW3r2MQQlsS53c7Z4keRQ0bSOclTLg7eYTj6lDvy+0UI0Wpg==
dependencies:
"@budibase/backend-core" "1.0.218"
"@budibase/backend-core" "1.0.219-alpha.17"
"@budibase/types" "1.0.219-alpha.17"
node-fetch "^2.6.1"
"@budibase/standard-components@^0.9.139":
@ -1187,6 +1189,16 @@
svelte-apexcharts "^1.0.2"
svelte-flatpickr "^3.1.0"
"@budibase/types@1.0.219-alpha.17":
version "1.0.219-alpha.17"
resolved "https://registry.yarnpkg.com/@budibase/types/-/types-1.0.219-alpha.17.tgz#f91c820e8be9bbc7a588fb5ede22f0494012947e"
integrity sha512-pWXdKMINgtb5usaKnTPZ5EdE0e8jiegF0zg1460ULVFuYH4Ibs94N1VVyHT/UuqEeTjQXhrGGIcRFUQF88KvBQ==
"@budibase/types@^1.0.219-alpha.17":
version "1.0.219"
resolved "https://registry.yarnpkg.com/@budibase/types/-/types-1.0.219.tgz#817fd90f0604048c222b9a0a1059acf3407c88ff"
integrity sha512-aPYpwEBsP60oKZzz1gP4j+SaiVxebUe/ZExQqdnhzl9qAj8PzXVD8dKR/oozXqZHJ37hgkgai7i83eXDqeU/qQ==
"@bull-board/api@3.7.0":
version "3.7.0"
resolved "https://registry.yarnpkg.com/@bull-board/api/-/api-3.7.0.tgz#231f687187c0cb34e0b97f463917b6aaeb4ef6af"

View File

@ -293,11 +293,12 @@
resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39"
integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==
"@budibase/backend-core@1.0.218":
version "1.0.218"
resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-1.0.218.tgz#be101c8baf220fa3fc55d63071bb38fc6c8cf4d8"
integrity sha512-v9+bvQ2+OsK7eGyDHzMuPawTu2LovRCsuArFeMnaG/AbexkqnbB74w+h3vh/2npuHzrnk8RZkM2c4pp/ycqfKw==
"@budibase/backend-core@1.0.219-alpha.17":
version "1.0.219-alpha.17"
resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-1.0.219-alpha.17.tgz#eacb5feb851f6a20771d9505d38f123398e5dc06"
integrity sha512-cR0MLkXOuVht/1cqXspFaduGeaEroe/JfIkidss1OVvi2E5YjcUjDgZIYvlNiUTnh1ggGv7ql4AI4CZDk5LaHw==
dependencies:
"@budibase/types" "^1.0.219-alpha.17"
"@techpass/passport-openidconnect" "0.3.2"
aws-sdk "2.1030.0"
bcrypt "5.0.1"
@ -325,14 +326,25 @@
uuid "8.3.2"
zlib "1.0.5"
"@budibase/pro@1.0.218":
version "1.0.218"
resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-1.0.218.tgz#b9e5bb95cca996dc1f7f783a3a02e51cbbf3df55"
integrity sha512-LJpV4rYPP9DzMNkL2Y0euZplkubBKBE+gc5JBTMt1l9Fwn2Sri/Y5bQ+U8fjczjmHxYnZLrFwH+o6LCnk/QJow==
"@budibase/pro@1.0.219-alpha.17":
version "1.0.219-alpha.17"
resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-1.0.219-alpha.17.tgz#bedf4b9e84e8225855e22526b0b1dcc760c6ccfe"
integrity sha512-bQGkeqzZL+fzQ69oFYnEIwGJ3v8kCXxl6jlMqLEW3r2MQQlsS53c7Z4keRQ0bSOclTLg7eYTj6lDvy+0UI0Wpg==
dependencies:
"@budibase/backend-core" "1.0.218"
"@budibase/backend-core" "1.0.219-alpha.17"
"@budibase/types" "1.0.219-alpha.17"
node-fetch "^2.6.1"
"@budibase/types@1.0.219-alpha.17":
version "1.0.219-alpha.17"
resolved "https://registry.yarnpkg.com/@budibase/types/-/types-1.0.219-alpha.17.tgz#f91c820e8be9bbc7a588fb5ede22f0494012947e"
integrity sha512-pWXdKMINgtb5usaKnTPZ5EdE0e8jiegF0zg1460ULVFuYH4Ibs94N1VVyHT/UuqEeTjQXhrGGIcRFUQF88KvBQ==
"@budibase/types@^1.0.219-alpha.17":
version "1.0.219"
resolved "https://registry.yarnpkg.com/@budibase/types/-/types-1.0.219.tgz#817fd90f0604048c222b9a0a1059acf3407c88ff"
integrity sha512-aPYpwEBsP60oKZzz1gP4j+SaiVxebUe/ZExQqdnhzl9qAj8PzXVD8dKR/oozXqZHJ37hgkgai7i83eXDqeU/qQ==
"@cspotcode/source-map-consumer@0.8.0":
version "0.8.0"
resolved "https://registry.yarnpkg.com/@cspotcode/source-map-consumer/-/source-map-consumer-0.8.0.tgz#33bf4b7b39c178821606f669bbc447a6a629786b"