Merge branch 'develop' of github.com:Budibase/budibase into feature/automation-error-stop
This commit is contained in:
commit
f4db17502a
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"version": "1.1.22-alpha.0",
|
||||
"version": "1.1.24",
|
||||
"npmClient": "yarn",
|
||||
"packages": [
|
||||
"packages/*"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@budibase/backend-core",
|
||||
"version": "1.1.22-alpha.0",
|
||||
"version": "1.1.24",
|
||||
"description": "Budibase backend core libraries used in server and worker",
|
||||
"main": "dist/src/index.js",
|
||||
"types": "dist/src/index.d.ts",
|
||||
|
@ -20,7 +20,7 @@
|
|||
"test:watch": "jest --watchAll"
|
||||
},
|
||||
"dependencies": {
|
||||
"@budibase/types": "^1.1.22-alpha.0",
|
||||
"@budibase/types": "^1.1.24",
|
||||
"@techpass/passport-openidconnect": "0.3.2",
|
||||
"aws-sdk": "2.1030.0",
|
||||
"bcrypt": "5.0.1",
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import BaseCache from "./base"
|
||||
import { getWritethroughClient } from "../redis/init"
|
||||
import { logWarn } from "../logging"
|
||||
|
||||
const DEFAULT_WRITE_RATE_MS = 10000
|
||||
let CACHE: BaseCache | null = null
|
||||
|
@ -51,10 +52,8 @@ export async function put(
|
|||
if (err.status !== 409) {
|
||||
throw err
|
||||
} else {
|
||||
// get the rev, update over it - this is risky, may change in future
|
||||
const readDoc = await db.get(doc._id)
|
||||
doc._rev = readDoc._rev
|
||||
await writeDb(doc)
|
||||
// Swallow 409s but log them
|
||||
logWarn(`Ignoring conflict in write-through cache`)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,7 +25,12 @@ export function logAlertWithInfo(
|
|||
logAlert(message, error)
|
||||
}
|
||||
|
||||
export function logWarn(message: string) {
|
||||
console.warn(`bb-warn: ${message}`)
|
||||
}
|
||||
|
||||
export default {
|
||||
logAlert,
|
||||
logAlertWithInfo,
|
||||
logWarn,
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "@budibase/bbui",
|
||||
"description": "A UI solution used in the different Budibase projects.",
|
||||
"version": "1.1.22-alpha.0",
|
||||
"version": "1.1.24",
|
||||
"license": "MPL-2.0",
|
||||
"svelte": "src/index.js",
|
||||
"module": "dist/bbui.es.js",
|
||||
|
@ -38,7 +38,7 @@
|
|||
],
|
||||
"dependencies": {
|
||||
"@adobe/spectrum-css-workflow-icons": "^1.2.1",
|
||||
"@budibase/string-templates": "^1.1.22-alpha.0",
|
||||
"@budibase/string-templates": "^1.1.24",
|
||||
"@spectrum-css/actionbutton": "^1.0.1",
|
||||
"@spectrum-css/actiongroup": "^1.0.1",
|
||||
"@spectrum-css/avatar": "^3.0.2",
|
||||
|
|
|
@ -26,5 +26,9 @@
|
|||
<style>
|
||||
.tooltip {
|
||||
pointer-events: none;
|
||||
background: var(--spectrum-global-color-gray-500);
|
||||
}
|
||||
.spectrum-Tooltip-tip {
|
||||
border-top-color: var(--spectrum-global-color-gray-500);
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -57,6 +57,7 @@ filterTests(["smoke", "all"], () => {
|
|||
cy.visit(`${Cypress.config().baseUrl}/builder`, { timeout: 5000})
|
||||
cy.get(interact.SPECTRUM_SIDENAV).contains("Users").click()
|
||||
cy.get(interact.SPECTRUM_TABLE, { timeout: 1000 }).contains("bbuser").click()
|
||||
cy.get(interact.SPECTRUM_HEADING).contains("bbuser", { timeout: 2000})
|
||||
for (let i = 0; i < 3; i++) {
|
||||
cy.get(interact.SPECTRUM_TABLE, { timeout: 3000})
|
||||
.eq(1)
|
||||
|
|
|
@ -15,7 +15,7 @@ filterTests(['smoke', 'all'], () => {
|
|||
})
|
||||
cy.get(interact.SPECTRUM_MODAL).within(() => {
|
||||
// Enter app name before revert
|
||||
cy.get("input").type("Cypress Tests")
|
||||
cy.get(interact.SPECTRUM_TEXTFIELD_INPUT).type("Cypress Tests")
|
||||
cy.intercept('**/revert').as('revertApp')
|
||||
// Click Revert
|
||||
cy.get(interact.SPECTRUM_BUTTON).contains("Revert").click({ force: true })
|
||||
|
|
|
@ -289,7 +289,7 @@ Cypress.Commands.add("updateAppName", (changedName, noName) => {
|
|||
})
|
||||
|
||||
Cypress.Commands.add("publishApp", resolvedAppPath => {
|
||||
//Assumes you have navigated to an application first
|
||||
// Assumes you have navigated to an application first
|
||||
cy.get(".toprightnav button.spectrum-Button")
|
||||
.contains("Publish")
|
||||
.click({ force: true })
|
||||
|
@ -301,7 +301,7 @@ Cypress.Commands.add("publishApp", resolvedAppPath => {
|
|||
cy.wait(1000)
|
||||
})
|
||||
|
||||
//Verify that the app url is presented correctly to the user
|
||||
// Verify that the app url is presented correctly to the user
|
||||
cy.get(".spectrum-Modal [data-cy='deploy-app-success-modal']")
|
||||
.should("be.visible")
|
||||
.within(() => {
|
||||
|
@ -514,7 +514,8 @@ Cypress.Commands.add("searchAndAddComponent", component => {
|
|||
cy.get(".spectrum-Button").contains("Component").click({ force: true })
|
||||
|
||||
// Search and add component
|
||||
cy.get(".spectrum-Textfield-input").wait(500).clear().type(component)
|
||||
cy.wait(500)
|
||||
cy.get(".spectrum-Textfield-input").clear().type(component)
|
||||
cy.get(".body").within(() => {
|
||||
cy.get(".component")
|
||||
.contains(new RegExp("^" + component + "$"), { timeout: 3000 })
|
||||
|
|
|
@ -108,6 +108,7 @@ export const CONTAINER = ".container"
|
|||
export const REGENERATE = ".regenerate"
|
||||
export const SPECTRUM_DIALOG_CONTENT = ".spectrum-Dialog-content"
|
||||
export const SPECTRUM_ICON = ".spectrum-Icon"
|
||||
export const SPECTRUM_HEADING = ".spectrum-Heading"
|
||||
|
||||
//createView
|
||||
export const SPECTRUM_MENU_ITEM_LABEL = ".spectrum-Menu-itemLabel"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@budibase/builder",
|
||||
"version": "1.1.22-alpha.0",
|
||||
"version": "1.1.24",
|
||||
"license": "GPL-3.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
|
@ -69,10 +69,10 @@
|
|||
}
|
||||
},
|
||||
"dependencies": {
|
||||
"@budibase/bbui": "^1.1.22-alpha.0",
|
||||
"@budibase/client": "^1.1.22-alpha.0",
|
||||
"@budibase/frontend-core": "^1.1.22-alpha.0",
|
||||
"@budibase/string-templates": "^1.1.22-alpha.0",
|
||||
"@budibase/bbui": "^1.1.24",
|
||||
"@budibase/client": "^1.1.24",
|
||||
"@budibase/frontend-core": "^1.1.24",
|
||||
"@budibase/string-templates": "^1.1.24",
|
||||
"@sentry/browser": "5.19.1",
|
||||
"@spectrum-css/page": "^3.0.1",
|
||||
"@spectrum-css/vars": "^3.0.1",
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
import { createLocalStorageStore } from "@budibase/frontend-core"
|
||||
import { Constants, createLocalStorageStore } from "@budibase/frontend-core"
|
||||
|
||||
export const getThemeStore = () => {
|
||||
const themeElement = document.documentElement
|
||||
|
||||
const initialValue = {
|
||||
theme: "darkest",
|
||||
options: ["lightest", "light", "dark", "darkest", "nord"],
|
||||
}
|
||||
const store = createLocalStorageStore("bb-theme", initialValue)
|
||||
|
||||
|
@ -17,11 +16,14 @@ export const getThemeStore = () => {
|
|||
return
|
||||
}
|
||||
|
||||
state.options.forEach(option => {
|
||||
Constants.ThemeOptions.forEach(option => {
|
||||
themeElement.classList.toggle(
|
||||
`spectrum--${option}`,
|
||||
option === state.theme
|
||||
)
|
||||
|
||||
// Ensure darkest is always added as this is the base class for custom
|
||||
// themes
|
||||
themeElement.classList.add("spectrum--darkest")
|
||||
})
|
||||
})
|
||||
|
|
|
@ -52,8 +52,9 @@
|
|||
x => x.blockToLoop === block.id
|
||||
)
|
||||
|
||||
$: setPermissions(role)
|
||||
$: getPermissions(automationId)
|
||||
$: isAppAction = block?.stepId === TriggerStepID.APP
|
||||
$: isAppAction && setPermissions(role)
|
||||
$: isAppAction && getPermissions(automationId)
|
||||
|
||||
async function setPermissions(role) {
|
||||
if (!role || !automationId) {
|
||||
|
@ -238,7 +239,7 @@
|
|||
</div>
|
||||
{/if}
|
||||
|
||||
{#if block.stepId === TriggerStepID.APP}
|
||||
{#if isAppAction}
|
||||
<Label>Role</Label>
|
||||
<RoleSelect bind:value={role} />
|
||||
{/if}
|
||||
|
|
|
@ -5,6 +5,8 @@ import "@spectrum-css/vars/dist/spectrum-darkest.css"
|
|||
import "@spectrum-css/vars/dist/spectrum-dark.css"
|
||||
import "@spectrum-css/vars/dist/spectrum-light.css"
|
||||
import "@spectrum-css/vars/dist/spectrum-lightest.css"
|
||||
import "@budibase/frontend-core/src/themes/nord.css"
|
||||
import "@budibase/frontend-core/src/themes/midnight.css"
|
||||
import "@spectrum-css/page/dist/index-vars.css"
|
||||
import "./global.css"
|
||||
import { suppressWarnings } from "./helpers/warnings"
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
import { setContext } from "svelte"
|
||||
import DNDPositionIndicator from "./DNDPositionIndicator.svelte"
|
||||
import { DropPosition } from "./dndStore"
|
||||
import { notifications } from "@budibase/bbui"
|
||||
|
||||
let scrollRef
|
||||
|
||||
|
@ -55,6 +56,15 @@
|
|||
})
|
||||
}
|
||||
|
||||
const onDrop = async () => {
|
||||
try {
|
||||
await dndStore.actions.drop()
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
notifications.error("Error saving component")
|
||||
}
|
||||
}
|
||||
|
||||
// Set scroll context so components can invoke scrolling when selected
|
||||
setContext("scroll", {
|
||||
scrollTo,
|
||||
|
@ -83,6 +93,7 @@
|
|||
opened
|
||||
scrollable
|
||||
icon="WebPage"
|
||||
on:drop={onDrop}
|
||||
>
|
||||
<ScreenslotDropdownMenu component={$selectedScreen?.props} />
|
||||
</NavItem>
|
||||
|
|
|
@ -139,9 +139,10 @@
|
|||
notifications.success("App ID copied to clipboard.")
|
||||
}
|
||||
|
||||
const exportApp = app => {
|
||||
const id = isPublished ? app.prodId : app.devId
|
||||
const exportApp = (app, opts = { published: false }) => {
|
||||
const appName = encodeURIComponent(app.name)
|
||||
const id = opts?.published ? app.prodId : app.devId
|
||||
// always export the development version
|
||||
window.location = `/api/backups/export?appId=${id}&appname=${appName}`
|
||||
}
|
||||
|
||||
|
@ -266,12 +267,21 @@
|
|||
<span slot="control" class="app-overview-actions-icon">
|
||||
<Icon hoverable name="More" />
|
||||
</span>
|
||||
<MenuItem on:click={() => exportApp(selectedApp)} icon="Download">
|
||||
Export
|
||||
<MenuItem
|
||||
on:click={() => exportApp(selectedApp, { published: false })}
|
||||
icon="DownloadFromCloud"
|
||||
>
|
||||
Export latest
|
||||
</MenuItem>
|
||||
{#if isPublished}
|
||||
<MenuItem
|
||||
on:click={() => exportApp(selectedApp, { published: true })}
|
||||
icon="DownloadFromCloudOutline"
|
||||
>
|
||||
Export published
|
||||
</MenuItem>
|
||||
<MenuItem on:click={() => copyAppId(selectedApp)} icon="Copy">
|
||||
Copy App ID
|
||||
Copy app ID
|
||||
</MenuItem>
|
||||
{/if}
|
||||
{#if !isPublished}
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
import { Layout, Heading, Body, Divider, Label, Select } from "@budibase/bbui"
|
||||
import { themeStore } from "builderStore"
|
||||
import { capitalise } from "helpers"
|
||||
import { Constants } from "@budibase/frontend-core"
|
||||
</script>
|
||||
|
||||
<Layout noPadding>
|
||||
|
@ -14,7 +15,7 @@
|
|||
<div class="field">
|
||||
<Label size="L">Builder theme</Label>
|
||||
<Select
|
||||
options={$themeStore.options}
|
||||
options={Constants.ThemeOptions}
|
||||
bind:value={$themeStore.theme}
|
||||
placeholder={null}
|
||||
getOptionLabel={capitalise}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@budibase/cli",
|
||||
"version": "1.1.22-alpha.0",
|
||||
"version": "1.1.24",
|
||||
"description": "Budibase CLI, for developers, self hosting and migrations.",
|
||||
"main": "src/index.js",
|
||||
"bin": {
|
||||
|
@ -26,7 +26,7 @@
|
|||
"outputPath": "build"
|
||||
},
|
||||
"dependencies": {
|
||||
"@budibase/backend-core": "^1.1.22-alpha.0",
|
||||
"@budibase/backend-core": "^1.1.22-alpha.2",
|
||||
"axios": "0.21.2",
|
||||
"chalk": "4.1.0",
|
||||
"cli-progress": "3.11.2",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@budibase/client",
|
||||
"version": "1.1.22-alpha.0",
|
||||
"version": "1.1.24",
|
||||
"license": "MPL-2.0",
|
||||
"module": "dist/budibase-client.js",
|
||||
"main": "dist/budibase-client.js",
|
||||
|
@ -19,9 +19,9 @@
|
|||
"dev:builder": "rollup -cw"
|
||||
},
|
||||
"dependencies": {
|
||||
"@budibase/bbui": "^1.1.22-alpha.0",
|
||||
"@budibase/frontend-core": "^1.1.22-alpha.0",
|
||||
"@budibase/string-templates": "^1.1.22-alpha.0",
|
||||
"@budibase/bbui": "^1.1.24",
|
||||
"@budibase/frontend-core": "^1.1.24",
|
||||
"@budibase/string-templates": "^1.1.24",
|
||||
"@spectrum-css/button": "^3.0.3",
|
||||
"@spectrum-css/card": "^3.0.3",
|
||||
"@spectrum-css/divider": "^1.0.3",
|
||||
|
|
|
@ -92,7 +92,7 @@
|
|||
id="spectrum-root"
|
||||
lang="en"
|
||||
dir="ltr"
|
||||
class="spectrum spectrum--medium {$themeStore.theme}"
|
||||
class="spectrum spectrum--medium spectrum--darkest {$themeStore.theme}"
|
||||
>
|
||||
<DeviceBindingsProvider>
|
||||
<UserBindingsProvider>
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
import BlockComponent from "components/BlockComponent.svelte"
|
||||
import { Heading } from "@budibase/bbui"
|
||||
import { makePropSafe as safe } from "@budibase/string-templates"
|
||||
import { enrichSearchColumns, enrichFilter } from "utils/blocks.js"
|
||||
|
||||
export let title
|
||||
export let dataSource
|
||||
|
@ -33,14 +34,6 @@
|
|||
const { fetchDatasourceSchema, styleable } = getContext("sdk")
|
||||
const context = getContext("context")
|
||||
const component = getContext("component")
|
||||
const schemaComponentMap = {
|
||||
string: "stringfield",
|
||||
options: "optionsfield",
|
||||
number: "numberfield",
|
||||
datetime: "datetimefield",
|
||||
boolean: "booleanfield",
|
||||
formula: "stringfield",
|
||||
}
|
||||
|
||||
let formId
|
||||
let dataProviderId
|
||||
|
@ -68,39 +61,6 @@
|
|||
},
|
||||
]
|
||||
|
||||
// Enrich the default filter with the specified search fields
|
||||
const enrichFilter = (filter, columns, formId) => {
|
||||
let enrichedFilter = [...(filter || [])]
|
||||
columns?.forEach(column => {
|
||||
const safePath = column.name.split(".").map(safe).join(".")
|
||||
enrichedFilter.push({
|
||||
field: column.name,
|
||||
operator: column.type === "string" ? "string" : "equal",
|
||||
type: column.type,
|
||||
valueType: "Binding",
|
||||
value: `{{ ${safe(formId)}.${safePath} }}`,
|
||||
})
|
||||
})
|
||||
return enrichedFilter
|
||||
}
|
||||
|
||||
// Determine data types for search fields and only use those that are valid
|
||||
const enrichSearchColumns = (searchColumns, schema) => {
|
||||
let enrichedColumns = []
|
||||
searchColumns?.forEach(column => {
|
||||
const schemaType = schema?.[column]?.type
|
||||
const componentType = schemaComponentMap[schemaType]
|
||||
if (componentType) {
|
||||
enrichedColumns.push({
|
||||
name: column,
|
||||
componentType,
|
||||
type: schemaType,
|
||||
})
|
||||
}
|
||||
})
|
||||
return enrichedColumns.slice(0, 5)
|
||||
}
|
||||
|
||||
// Builds a full details page URL for the card title
|
||||
const buildFullCardUrl = (link, url, repeaterId, linkColumn) => {
|
||||
if (!link || !url || !repeaterId) {
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
import BlockComponent from "components/BlockComponent.svelte"
|
||||
import { Heading } from "@budibase/bbui"
|
||||
import { makePropSafe as safe } from "@budibase/string-templates"
|
||||
import { enrichSearchColumns, enrichFilter } from "utils/blocks.js"
|
||||
|
||||
export let title
|
||||
export let dataSource
|
||||
|
@ -31,14 +32,6 @@
|
|||
const { fetchDatasourceSchema, styleable } = getContext("sdk")
|
||||
const context = getContext("context")
|
||||
const component = getContext("component")
|
||||
const schemaComponentMap = {
|
||||
string: "stringfield",
|
||||
options: "optionsfield",
|
||||
number: "numberfield",
|
||||
datetime: "datetimefield",
|
||||
boolean: "booleanfield",
|
||||
formula: "stringfield",
|
||||
}
|
||||
|
||||
let formId
|
||||
let dataProviderId
|
||||
|
@ -58,40 +51,6 @@
|
|||
},
|
||||
]
|
||||
|
||||
// Enrich the default filter with the specified search fields
|
||||
const enrichFilter = (filter, columns, formId) => {
|
||||
let enrichedFilter = [...(filter || [])]
|
||||
columns?.forEach(column => {
|
||||
const safePath = column.name.split(".").map(safe).join(".")
|
||||
const stringType = column.type === "string" || column.type === "formula"
|
||||
enrichedFilter.push({
|
||||
field: column.name,
|
||||
type: column.type,
|
||||
operator: stringType ? "string" : "equal",
|
||||
valueType: "Binding",
|
||||
value: `{{ ${safe(formId)}.${safePath} }}`,
|
||||
})
|
||||
})
|
||||
return enrichedFilter
|
||||
}
|
||||
|
||||
// Determine data types for search fields and only use those that are valid
|
||||
const enrichSearchColumns = (searchColumns, schema) => {
|
||||
let enrichedColumns = []
|
||||
searchColumns?.forEach(column => {
|
||||
const schemaType = schema?.[column]?.type
|
||||
const componentType = schemaComponentMap[schemaType]
|
||||
if (componentType) {
|
||||
enrichedColumns.push({
|
||||
name: column,
|
||||
componentType,
|
||||
type: schemaType,
|
||||
})
|
||||
}
|
||||
})
|
||||
return enrichedColumns.slice(0, 5)
|
||||
}
|
||||
|
||||
// Load the datasource schema so we can determine column types
|
||||
const fetchSchema = async dataSource => {
|
||||
if (dataSource) {
|
||||
|
@ -109,7 +68,7 @@
|
|||
<BlockComponent
|
||||
type="form"
|
||||
bind:id={formId}
|
||||
props={{ dataSource, disableValidation: true }}
|
||||
props={{ dataSource, disableValidation: true, editAutoColumns: true }}
|
||||
>
|
||||
{#if title || enrichedSearchColumns?.length || showTitleButton}
|
||||
<div class="header" class:mobile={$context.device.mobile}>
|
||||
|
|
|
@ -13,6 +13,10 @@
|
|||
// for fields rendered in things like search blocks.
|
||||
export let disableValidation = false
|
||||
|
||||
// Not exposed as a builder setting. Used internally to allow searching on
|
||||
// auto columns.
|
||||
export let editAutoColumns = false
|
||||
|
||||
const context = getContext("context")
|
||||
const { API, fetchDatasourceSchema } = getContext("sdk")
|
||||
|
||||
|
@ -107,6 +111,7 @@
|
|||
{table}
|
||||
{initialValues}
|
||||
{disableValidation}
|
||||
{editAutoColumns}
|
||||
>
|
||||
<slot />
|
||||
</InnerForm>
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
export let schema
|
||||
export let table
|
||||
export let disableValidation = false
|
||||
export let editAutoColumns = false
|
||||
|
||||
const component = getContext("component")
|
||||
const { styleable, Provider, ActionTypes } = getContext("sdk")
|
||||
|
@ -183,7 +184,8 @@
|
|||
fieldId,
|
||||
value: initialValue,
|
||||
error: initialError,
|
||||
disabled: disabled || fieldDisabled || isAutoColumn,
|
||||
disabled:
|
||||
disabled || fieldDisabled || (isAutoColumn && !editAutoColumns),
|
||||
defaultValue,
|
||||
validator,
|
||||
lastUpdate: Date.now(),
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import "@spectrum-css/vars/dist/spectrum-global.css"
|
||||
import "@spectrum-css/vars/dist/spectrum-medium.css"
|
||||
import "@spectrum-css/vars/dist/spectrum-large.css"
|
||||
import "@spectrum-css/vars/dist/spectrum-lightest.css"
|
||||
import "@spectrum-css/vars/dist/spectrum-light.css"
|
||||
import "@spectrum-css/vars/dist/spectrum-dark.css"
|
||||
import "@spectrum-css/vars/dist/spectrum-darkest.css"
|
||||
import "@spectrum-css/vars/dist/spectrum-dark.css"
|
||||
import "@spectrum-css/vars/dist/spectrum-light.css"
|
||||
import "@spectrum-css/vars/dist/spectrum-lightest.css"
|
||||
import "@spectrum-css/page/dist/index-vars.css"
|
||||
|
||||
// Non user-facing components
|
||||
|
@ -35,6 +35,7 @@ export { default as embeddedmap } from "./embedded-map/EmbeddedMap.svelte"
|
|||
export * from "./charts"
|
||||
export * from "./forms"
|
||||
export * from "./table"
|
||||
|
||||
export * from "./blocks"
|
||||
export * from "./dynamic-filter"
|
||||
|
||||
|
|
|
@ -0,0 +1,81 @@
|
|||
import { makePropSafe as safe } from "@budibase/string-templates"
|
||||
|
||||
// Map of data types to component types for search fields inside blocks
|
||||
const schemaComponentMap = {
|
||||
string: "stringfield",
|
||||
options: "optionsfield",
|
||||
number: "numberfield",
|
||||
datetime: "datetimefield",
|
||||
boolean: "booleanfield",
|
||||
formula: "stringfield",
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine data types for search fields and only use those that are valid
|
||||
* @param searchColumns the search columns to use
|
||||
* @param schema the data source schema
|
||||
*/
|
||||
export const enrichSearchColumns = (searchColumns, schema) => {
|
||||
let enrichedColumns = []
|
||||
searchColumns?.forEach(column => {
|
||||
const schemaType = schema?.[column]?.type
|
||||
const componentType = schemaComponentMap[schemaType]
|
||||
if (componentType) {
|
||||
enrichedColumns.push({
|
||||
name: column,
|
||||
componentType,
|
||||
type: schemaType,
|
||||
})
|
||||
}
|
||||
})
|
||||
return enrichedColumns.slice(0, 5)
|
||||
}
|
||||
|
||||
/**
|
||||
* Enriches a normal datasource filter with bindings representing the additional
|
||||
* search fields configured as part of a searchable block. These bindings are
|
||||
* fields inside a form used as part of the block.
|
||||
* @param filter the normal data provider filter
|
||||
* @param columns the enriched search column structure
|
||||
* @param formId the ID of the form containing the search fields
|
||||
*/
|
||||
export const enrichFilter = (filter, columns, formId) => {
|
||||
let enrichedFilter = [...(filter || [])]
|
||||
columns?.forEach(column => {
|
||||
const safePath = column.name.split(".").map(safe).join(".")
|
||||
const stringType = column.type === "string" || column.type === "formula"
|
||||
const dateType = column.type === "datetime"
|
||||
const binding = `${safe(formId)}.${safePath}`
|
||||
|
||||
// For dates, use a range of the entire day selected
|
||||
if (dateType) {
|
||||
enrichedFilter.push({
|
||||
field: column.name,
|
||||
type: column.type,
|
||||
operator: "rangeLow",
|
||||
valueType: "Binding",
|
||||
value: `{{ ${binding} }}`,
|
||||
})
|
||||
const format = "YYYY-MM-DDTHH:mm:ss.SSSZ"
|
||||
enrichedFilter.push({
|
||||
field: column.name,
|
||||
type: column.type,
|
||||
operator: "rangeHigh",
|
||||
valueType: "Binding",
|
||||
value: `{{ date (add (date ${binding} "x") 86399999) "${format}" }}`,
|
||||
})
|
||||
}
|
||||
|
||||
// For other fields, do an exact match
|
||||
else {
|
||||
enrichedFilter.push({
|
||||
field: column.name,
|
||||
type: column.type,
|
||||
operator: stringType ? "string" : "equal",
|
||||
valueType: "Binding",
|
||||
value: `{{ ${binding} }}`,
|
||||
})
|
||||
}
|
||||
})
|
||||
return enrichedFilter
|
||||
}
|
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"name": "@budibase/frontend-core",
|
||||
"version": "1.1.22-alpha.0",
|
||||
"version": "1.1.24",
|
||||
"description": "Budibase frontend core libraries used in builder and client",
|
||||
"author": "Budibase",
|
||||
"license": "MPL-2.0",
|
||||
"svelte": "src/index.js",
|
||||
"dependencies": {
|
||||
"@budibase/bbui": "^1.1.22-alpha.0",
|
||||
"@budibase/bbui": "^1.1.24",
|
||||
"lodash": "^4.17.21",
|
||||
"svelte": "^3.46.2"
|
||||
}
|
||||
|
|
|
@ -98,3 +98,12 @@ export const SqlNumberTypeRangeMap = {
|
|||
min: -8388608,
|
||||
},
|
||||
}
|
||||
|
||||
export const ThemeOptions = [
|
||||
"lightest",
|
||||
"light",
|
||||
"dark",
|
||||
"darkest",
|
||||
"nord",
|
||||
"midnight",
|
||||
]
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
.spectrum--midnight {
|
||||
--hue: 220;
|
||||
--sat: 10%;
|
||||
--spectrum-global-color-gray-50: hsl(var(--hue), var(--sat), 12%);
|
||||
--spectrum-global-color-gray-75: hsl(var(--hue), var(--sat), 15%);
|
||||
--spectrum-global-color-gray-100: hsl(var(--hue), var(--sat), 17%);
|
||||
--spectrum-global-color-gray-200: hsl(var(--hue), var(--sat), 20%);
|
||||
--spectrum-global-color-gray-300: hsl(var(--hue), var(--sat), 24%);
|
||||
--spectrum-global-color-gray-400: hsl(var(--hue), var(--sat), 32%);
|
||||
--spectrum-global-color-gray-500: hsl(var(--hue), var(--sat), 40%);
|
||||
--spectrum-global-color-gray-600: hsl(var(--hue), var(--sat), 60%);
|
||||
--spectrum-global-color-gray-700: hsl(var(--hue), var(--sat), 70%);
|
||||
--spectrum-global-color-gray-800: hsl(var(--hue), var(--sat), 80%);
|
||||
--spectrum-global-color-gray-900: hsl(var(--hue), var(--sat), 95%);
|
||||
}
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
.spectrum--nord {
|
||||
--spectrum-global-color-red-400: #bf616a;
|
||||
--spectrum-global-color-red-500: #c26971;
|
||||
--spectrum-global-color-red-600: #c57179;
|
||||
--spectrum-global-color-red-700: #c97980;
|
||||
--spectrum-global-color-static-red-400: #bf616a;
|
||||
--spectrum-global-color-static-red-500: #c26971;
|
||||
--spectrum-global-color-static-red-600: #c57179;
|
||||
--spectrum-global-color-static-red-700: #c97980;
|
||||
|
||||
--spectrum-global-color-green-400: #719453;
|
||||
--spectrum-global-color-green-500: #789d58;
|
||||
--spectrum-global-color-green-600: #7fa55e;
|
||||
--spectrum-global-color-green-700: #86aa67;
|
||||
--spectrum-global-color-static-green-400: #719453;
|
||||
--spectrum-global-color-static-green-500: #789d58;
|
||||
--spectrum-global-color-static-green-600: #7fa55e;
|
||||
--spectrum-global-color-static-green-700: #86aa67;
|
||||
|
||||
--spectrum-global-color-blue-400: #5680b4;
|
||||
--spectrum-global-color-blue-500: #5e86b8;
|
||||
--spectrum-global-color-blue-600: #668dbb;
|
||||
--spectrum-global-color-blue-700: #6f93bf;
|
||||
--spectrum-global-color-static-blue-200: #7799c4;
|
||||
--spectrum-global-color-static-blue-300: #6f93bf;
|
||||
--spectrum-global-color-static-blue-400: #668dbb;
|
||||
--spectrum-global-color-static-blue-500: #5e86b8;
|
||||
--spectrum-global-color-static-blue-600: #5680b4;
|
||||
--spectrum-global-color-static-blue-700: #4e79af;
|
||||
--spectrum-global-color-static-blue-800: #4a73a6;
|
||||
|
||||
--spectrum-global-color-gray-50: #2e3440;
|
||||
--spectrum-global-color-gray-75: #353b4a;
|
||||
--spectrum-global-color-gray-100: #3b4252;
|
||||
--spectrum-global-color-gray-200: #4a5367;
|
||||
--spectrum-global-color-gray-300: #4c566a;
|
||||
--spectrum-global-color-gray-400: #5a657d;
|
||||
--spectrum-global-color-gray-500: #677590;
|
||||
--spectrum-global-color-gray-600: #79869f;
|
||||
--spectrum-global-color-gray-700: #a9b1c1;
|
||||
--spectrum-global-color-gray-800: #bac1cd;
|
||||
--spectrum-global-color-gray-900: #eceff4;
|
||||
|
||||
--spectrum-alias-highlight-hover: rgba(169, 177, 193, 0.06);
|
||||
--spectrum-alias-highlight-active: rgba(169, 177, 193, 0.1);
|
||||
}
|
|
@ -99,8 +99,16 @@ export const buildLuceneQuery = filter => {
|
|||
filter.forEach(expression => {
|
||||
let { operator, field, type, value, externalType } = expression
|
||||
// Parse all values into correct types
|
||||
if (type === "datetime" && value) {
|
||||
value = new Date(value).toISOString()
|
||||
if (type === "datetime") {
|
||||
// Ensure date value is a valid date and parse into correct format
|
||||
if (!value) {
|
||||
return
|
||||
}
|
||||
try {
|
||||
value = new Date(value).toISOString()
|
||||
} catch (error) {
|
||||
return
|
||||
}
|
||||
}
|
||||
if (type === "number" && !Array.isArray(value)) {
|
||||
if (operator === "oneOf") {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "@budibase/server",
|
||||
"email": "hi@budibase.com",
|
||||
"version": "1.1.22-alpha.0",
|
||||
"version": "1.1.24",
|
||||
"description": "Budibase Web Server",
|
||||
"main": "src/index.ts",
|
||||
"repository": {
|
||||
|
@ -77,11 +77,11 @@
|
|||
"license": "GPL-3.0",
|
||||
"dependencies": {
|
||||
"@apidevtools/swagger-parser": "10.0.3",
|
||||
"@budibase/backend-core": "^1.1.22-alpha.0",
|
||||
"@budibase/client": "^1.1.22-alpha.0",
|
||||
"@budibase/pro": "1.1.22-alpha.0",
|
||||
"@budibase/string-templates": "^1.1.22-alpha.0",
|
||||
"@budibase/types": "^1.1.22-alpha.0",
|
||||
"@budibase/backend-core": "^1.1.24",
|
||||
"@budibase/client": "^1.1.24",
|
||||
"@budibase/pro": "1.1.24",
|
||||
"@budibase/string-templates": "^1.1.24",
|
||||
"@budibase/types": "^1.1.24",
|
||||
"@bull-board/api": "3.7.0",
|
||||
"@bull-board/koa": "3.9.4",
|
||||
"@elastic/elasticsearch": "7.10.0",
|
||||
|
|
|
@ -20,7 +20,7 @@ import {
|
|||
} from "../definitions/automations"
|
||||
import { WorkerCallback } from "./definitions"
|
||||
const { doInAppContext, getAppDB } = require("@budibase/backend-core/context")
|
||||
const { logAlertWithInfo, logAlert } = require("@budibase/backend-core/logging")
|
||||
const { logAlertWithInfo, logWarn } = require("@budibase/backend-core/logging")
|
||||
const { processObject } = require("@budibase/string-templates")
|
||||
const FILTER_STEP_ID = actions.ACTION_DEFINITIONS.FILTER.stepId
|
||||
const LOOP_STEP_ID = actions.ACTION_DEFINITIONS.LOOP.stepId
|
||||
|
@ -140,7 +140,7 @@ class Orchestrator {
|
|||
const automation = this._automation
|
||||
const trigger = automation.definition.trigger
|
||||
if (metadata.errorCount >= MAX_AUTOMATION_RECURRING_ERRORS) {
|
||||
logAlert(
|
||||
logWarn(
|
||||
`CRON disabled due to errors - ${this._appId}/${this._automation._id}`
|
||||
)
|
||||
await disableCron(this._repeat?.jobId, this._repeat?.jobKey)
|
||||
|
|
|
@ -111,20 +111,12 @@ exports.apiFileReturn = contents => {
|
|||
}
|
||||
|
||||
exports.defineFilter = excludeRows => {
|
||||
const ids = [USER_METDATA_PREFIX, LINK_USER_METADATA_PREFIX]
|
||||
if (excludeRows) {
|
||||
return doc =>
|
||||
!(
|
||||
doc._id.includes(USER_METDATA_PREFIX) ||
|
||||
doc._id.includes(LINK_USER_METADATA_PREFIX) ||
|
||||
doc._id.includes(TABLE_ROW_PREFIX)
|
||||
)
|
||||
} else if (!excludeRows) {
|
||||
return doc =>
|
||||
!(
|
||||
doc._id.includes(USER_METDATA_PREFIX) ||
|
||||
doc._id.includes(LINK_USER_METADATA_PREFIX)
|
||||
)
|
||||
ids.push(TABLE_ROW_PREFIX)
|
||||
}
|
||||
return doc =>
|
||||
!ids.map(key => doc._id.includes(key)).reduce((prev, curr) => prev || curr)
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -132,6 +124,7 @@ exports.defineFilter = excludeRows => {
|
|||
* data or user relationships.
|
||||
* @param {string} appId The app to backup
|
||||
* @param {object} config Config to send to export DB
|
||||
* @param {boolean} includeRows Flag to state whether the export should include data.
|
||||
* @returns {*} either a string or a stream of the backup
|
||||
*/
|
||||
const backupAppData = async (appId, config, includeRows) => {
|
||||
|
@ -154,6 +147,7 @@ exports.performBackup = async (appId, backupName) => {
|
|||
/**
|
||||
* Streams a backup of the database state for an app
|
||||
* @param {string} appId The ID of the app which is to be backed up.
|
||||
* @param {boolean} includeRows Flag to state whether the export should include data.
|
||||
* @returns {*} a readable stream of the backup which is written in real time
|
||||
*/
|
||||
exports.streamBackup = async (appId, includeRows) => {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@budibase/string-templates",
|
||||
"version": "1.1.22-alpha.0",
|
||||
"version": "1.1.24",
|
||||
"description": "Handlebars wrapper for Budibase templating.",
|
||||
"main": "src/index.cjs",
|
||||
"module": "dist/bundle.mjs",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@budibase/types",
|
||||
"version": "1.1.22-alpha.0",
|
||||
"version": "1.1.24",
|
||||
"description": "Budibase types",
|
||||
"main": "dist/index.js",
|
||||
"types": "dist/index.d.ts",
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "@budibase/worker",
|
||||
"email": "hi@budibase.com",
|
||||
"version": "1.1.22-alpha.0",
|
||||
"version": "1.1.24",
|
||||
"description": "Budibase background service",
|
||||
"main": "src/index.ts",
|
||||
"repository": {
|
||||
|
@ -35,10 +35,10 @@
|
|||
"author": "Budibase",
|
||||
"license": "GPL-3.0",
|
||||
"dependencies": {
|
||||
"@budibase/backend-core": "^1.1.22-alpha.0",
|
||||
"@budibase/pro": "1.1.22-alpha.0",
|
||||
"@budibase/string-templates": "^1.1.22-alpha.0",
|
||||
"@budibase/types": "^1.1.22-alpha.0",
|
||||
"@budibase/backend-core": "^1.1.24",
|
||||
"@budibase/pro": "1.1.24",
|
||||
"@budibase/string-templates": "^1.1.24",
|
||||
"@budibase/types": "^1.1.24",
|
||||
"@koa/router": "8.0.8",
|
||||
"@sentry/node": "6.17.7",
|
||||
"@techpass/passport-openidconnect": "0.3.2",
|
||||
|
|
Loading…
Reference in New Issue