Merge remote-tracking branch 'origin/develop' into feature/templates-home-screen

This commit is contained in:
Dean 2022-03-25 09:45:35 +00:00
commit 04aad3406d
30 changed files with 1219 additions and 7176 deletions

View File

@ -1,5 +1,5 @@
{
"version": "1.0.91-alpha.12",
"version": "1.0.91-alpha.16",
"npmClient": "yarn",
"packages": [
"packages/*"

View File

@ -1,6 +1,6 @@
{
"name": "@budibase/backend-core",
"version": "1.0.91-alpha.12",
"version": "1.0.91-alpha.16",
"description": "Budibase backend core libraries used in server and worker",
"main": "src/index.js",
"author": "Budibase",

View File

@ -1,7 +1,7 @@
{
"name": "@budibase/bbui",
"description": "A UI solution used in the different Budibase projects.",
"version": "1.0.91-alpha.12",
"version": "1.0.91-alpha.16",
"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.0.91-alpha.12",
"@budibase/string-templates": "^1.0.91-alpha.16",
"@spectrum-css/actionbutton": "^1.0.1",
"@spectrum-css/actiongroup": "^1.0.1",
"@spectrum-css/avatar": "^3.0.2",

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
{
"name": "@budibase/builder",
"version": "1.0.91-alpha.12",
"version": "1.0.91-alpha.16",
"license": "GPL-3.0",
"private": true,
"scripts": {
@ -65,10 +65,10 @@
}
},
"dependencies": {
"@budibase/bbui": "^1.0.91-alpha.12",
"@budibase/client": "^1.0.91-alpha.12",
"@budibase/frontend-core": "^1.0.91-alpha.12",
"@budibase/string-templates": "^1.0.91-alpha.12",
"@budibase/bbui": "^1.0.91-alpha.16",
"@budibase/client": "^1.0.91-alpha.16",
"@budibase/frontend-core": "^1.0.91-alpha.16",
"@budibase/string-templates": "^1.0.91-alpha.16",
"@sentry/browser": "5.19.1",
"@spectrum-css/page": "^3.0.1",
"@spectrum-css/vars": "^3.0.1",

View File

@ -68,6 +68,7 @@
customTheme: $store.customTheme,
previewDevice: $store.previewDevice,
messagePassing: $store.clientFeatures.messagePassing,
isBudibaseEvent: true
}
$: json = JSON.stringify(previewData)

View File

@ -52,7 +52,7 @@ export default `
console.error("Client received invalid JSON")
// Ignore
}
if (!parsed) {
if (!parsed || !parsed.isBudibaseEvent) {
return
}

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
{
"name": "@budibase/cli",
"version": "1.0.91-alpha.12",
"version": "1.0.91-alpha.16",
"description": "Budibase CLI, for developers, self hosting and migrations.",
"main": "src/index.js",
"bin": {

View File

@ -264,7 +264,8 @@
{
"label": "Primary",
"value": "primary"
}, {
},
{
"label": "Secondary",
"value": "secondary"
},
@ -626,28 +627,36 @@
"defaultValue": "M",
"showInBar": true,
"barStyle": "picker",
"options": [{
"options": [
{
"label": "Extra Small",
"value": "XS"
}, {
},
{
"label": "Small",
"value": "S"
}, {
},
{
"label": "Medium",
"value": "M"
}, {
},
{
"label": "Large",
"value": "L"
}, {
},
{
"label": "Extra Large",
"value": "XL"
}, {
},
{
"label": "2XL",
"value": "XXL"
}, {
},
{
"label": "3XL",
"value": "XXXL"
}]
}
]
},
{
"type": "color",
@ -689,27 +698,32 @@
"defaultValue": "left",
"showInBar": true,
"barStyle": "buttons",
"options": [{
"options": [
{
"label": "Left",
"value": "left",
"barIcon": "TextAlignLeft",
"barTitle": "Align left"
}, {
},
{
"label": "Center",
"value": "center",
"barIcon": "TextAlignCenter",
"barTitle": "Align center"
}, {
},
{
"label": "Right",
"value": "right",
"barIcon": "TextAlignRight",
"barTitle": "Align right"
}, {
},
{
"label": "Justify",
"value": "justify",
"barIcon": "TextAlignJustify",
"barTitle": "Justify text"
}]
}
]
}
]
},
@ -733,28 +747,36 @@
"defaultValue": "M",
"showInBar": true,
"barStyle": "picker",
"options": [{
"options": [
{
"label": "Extra Small",
"value": "XS"
}, {
},
{
"label": "Small",
"value": "S"
}, {
},
{
"label": "Medium",
"value": "M"
}, {
},
{
"label": "Large",
"value": "L"
}, {
},
{
"label": "Extra Large",
"value": "XL"
}, {
},
{
"label": "2XL",
"value": "XXL"
}, {
},
{
"label": "3XL",
"value": "XXXL"
}]
}
]
},
{
"type": "color",
@ -796,27 +818,32 @@
"defaultValue": "left",
"showInBar": true,
"barStyle": "buttons",
"options": [{
"options": [
{
"label": "Left",
"value": "left",
"barIcon": "TextAlignLeft",
"barTitle": "Align left"
}, {
},
{
"label": "Center",
"value": "center",
"barIcon": "TextAlignCenter",
"barTitle": "Align center"
}, {
},
{
"label": "Right",
"value": "right",
"barIcon": "TextAlignRight",
"barTitle": "Align right"
}, {
},
{
"label": "Justify",
"value": "justify",
"barIcon": "TextAlignJustify",
"barTitle": "Justify text"
}]
}
]
}
]
},
@ -837,16 +864,20 @@
"defaultValue": "M",
"showInBar": true,
"barStyle": "picker",
"options": [{
"options": [
{
"label": "Small",
"value": "S"
}, {
},
{
"label": "Medium",
"value": "M"
}, {
},
{
"label": "Large",
"value": "L"
}]
}
]
},
{
"type": "color",
@ -1037,16 +1068,20 @@
"defaultValue": "M",
"showInBar": true,
"barStyle": "picker",
"options": [{
"options": [
{
"label": "Small",
"value": "S"
}, {
},
{
"label": "Medium",
"value": "M"
}, {
},
{
"label": "Large",
"value": "L"
}]
}
]
},
{
"type": "color",
@ -1088,27 +1123,32 @@
"defaultValue": "left",
"showInBar": true,
"barStyle": "buttons",
"options": [{
"options": [
{
"label": "Left",
"value": "left",
"barIcon": "TextAlignLeft",
"barTitle": "Align left"
}, {
},
{
"label": "Center",
"value": "center",
"barIcon": "TextAlignCenter",
"barTitle": "Align center"
}, {
},
{
"label": "Right",
"value": "right",
"barIcon": "TextAlignRight",
"barTitle": "Align right"
}, {
},
{
"label": "Justify",
"value": "justify",
"barIcon": "TextAlignJustify",
"barTitle": "Justify text"
}]
}
]
}
]
},
@ -1165,7 +1205,15 @@
"type": "select",
"label": "Card Width",
"key": "cardWidth",
"options": ["24rem", "28rem", "32rem", "40rem", "48rem", "60rem", "100%"],
"options": [
"24rem",
"28rem",
"32rem",
"40rem",
"48rem",
"60rem",
"100%"
],
"defaultValue": "32rem"
},
{
@ -1785,11 +1833,7 @@
"icon": "Form",
"hasChildren": true,
"illegalChildren": ["section", "form"],
"actions": [
"ValidateForm",
"ClearForm",
"ChangeFormStep"
],
"actions": ["ValidateForm", "ClearForm", "ChangeFormStep"],
"styles": ["size"],
"settings": [
{
@ -1816,7 +1860,8 @@
{
"label": "Medium",
"value": "spectrum--medium"
}, {
},
{
"label": "Large",
"value": "spectrum--large"
}
@ -1947,27 +1992,32 @@
"defaultValue": "left",
"showInBar": true,
"barStyle": "buttons",
"options": [{
"options": [
{
"label": "Left",
"value": "left",
"barIcon": "TextAlignLeft",
"barTitle": "Align left"
}, {
},
{
"label": "Center",
"value": "center",
"barIcon": "TextAlignCenter",
"barTitle": "Align center"
}, {
},
{
"label": "Right",
"value": "right",
"barIcon": "TextAlignRight",
"barTitle": "Align right"
}, {
},
{
"label": "Justify",
"value": "justify",
"barIcon": "TextAlignJustify",
"barTitle": "Justify text"
}]
}
]
}
]
},
@ -2964,7 +3014,8 @@
"label": "Table Columns",
"key": "tableColumns",
"dependsOn": "dataSource",
"placeholder": "All columns"
"placeholder": "All columns",
"nested": true
},
{
"type": "boolean",
@ -3116,7 +3167,6 @@
"key": "cardDescription",
"label": "Description",
"nested": true
},
{
"type": "text",

View File

@ -1,6 +1,6 @@
{
"name": "@budibase/client",
"version": "1.0.91-alpha.12",
"version": "1.0.91-alpha.16",
"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.0.91-alpha.12",
"@budibase/frontend-core": "^1.0.91-alpha.12",
"@budibase/string-templates": "^1.0.91-alpha.12",
"@budibase/bbui": "^1.0.91-alpha.16",
"@budibase/frontend-core": "^1.0.91-alpha.16",
"@budibase/string-templates": "^1.0.91-alpha.16",
"@spectrum-css/button": "^3.0.3",
"@spectrum-css/card": "^3.0.3",
"@spectrum-css/divider": "^1.0.3",

View File

@ -36,4 +36,13 @@
div :global(.apexcharts-datalabel) {
fill: var(--spectrum-global-color-gray-800);
}
div :global(.apexcharts-tooltip) {
background-color: var(--spectrum-global-color-gray-200) !important;
border-color: var(--spectrum-global-color-gray-300) !important;
box-shadow: 2px 2px 6px -4px rgba(0, 0, 0, 0.1) !important;
}
div :global(.apexcharts-tooltip-title) {
background-color: var(--spectrum-global-color-gray-100) !important;
border-color: var(--spectrum-global-color-gray-300) !important;
}
</style>

View File

@ -18,16 +18,53 @@
export let palette
export let horizontal
$: options = setUpChart(dataProvider)
$: options = setUpChart(
title,
dataProvider,
labelColumn,
valueColumns,
xAxisLabel,
yAxisLabel,
height,
width,
dataLabels,
animate,
legend,
stacked,
yAxisUnits,
palette,
horizontal
)
const setUpChart = provider => {
const setUpChart = (
title,
dataProvider,
labelColumn,
valueColumns,
xAxisLabel,
yAxisLabel,
height,
width,
dataLabels,
animate,
legend,
stacked,
yAxisUnits,
palette,
horizontal
) => {
console.log("new chart")
const allCols = [labelColumn, ...(valueColumns || [null])]
if (!provider || !provider.rows?.length || allCols.find(x => x == null)) {
if (
!dataProvider ||
!dataProvider.rows?.length ||
allCols.find(x => x == null)
) {
return null
}
// Fetch data
const { schema, rows } = provider
const { schema, rows } = dataProvider
const reducer = row => (valid, column) => valid && row[column] != null
const hasAllColumns = row => allCols.reduce(reducer(row), true)
const data = rows.filter(row => hasAllColumns(row)).slice(0, 100)

View File

@ -16,17 +16,48 @@
export let animate
export let yAxisUnits
$: options = setUpChart(dataProvider)
$: options = setUpChart(
title,
dataProvider,
dateColumn,
openColumn,
highColumn,
lowColumn,
closeColumn,
xAxisLabel,
yAxisLabel,
height,
width,
animate,
yAxisUnits
)
// Fetch data on mount
const setUpChart = provider => {
const setUpChart = (
title,
dataProvider,
dateColumn,
openColumn,
highColumn,
lowColumn,
closeColumn,
xAxisLabel,
yAxisLabel,
height,
width,
animate,
yAxisUnits
) => {
const allCols = [dateColumn, openColumn, highColumn, lowColumn, closeColumn]
if (!provider || !provider.rows?.length || allCols.find(x => x == null)) {
if (
!dataProvider ||
!dataProvider.rows?.length ||
allCols.find(x => x == null)
) {
return null
}
// Fetch data
const { schema, rows } = provider
const { schema, rows } = dataProvider
const reducer = row => (valid, column) => valid && row[column] != null
const hasAllColumns = row => allCols.reduce(reducer(row), true)
const data = rows.filter(row => hasAllColumns(row))

View File

@ -23,17 +23,56 @@
export let stacked
export let gradient
$: options = setUpChart(dataProvider)
$: options = setUpChart(
title,
dataProvider,
labelColumn,
valueColumns,
xAxisLabel,
yAxisLabel,
height,
width,
animate,
dataLabels,
curve,
legend,
yAxisUnits,
palette,
area,
stacked,
gradient
)
// Fetch data on mount
const setUpChart = provider => {
const setUpChart = (
title,
dataProvider,
labelColumn,
valueColumns,
xAxisLabel,
yAxisLabel,
height,
width,
animate,
dataLabels,
curve,
legend,
yAxisUnits,
palette,
area,
stacked,
gradient
) => {
const allCols = [labelColumn, ...(valueColumns || [null])]
if (!provider || !provider.rows?.length || allCols.find(x => x == null)) {
if (
!dataProvider ||
!dataProvider.rows?.length ||
allCols.find(x => x == null)
) {
return null
}
// Fetch, filter and sort data
const { schema, rows } = provider
const { schema, rows } = dataProvider
const reducer = row => (valid, column) => valid && row[column] != null
const hasAllColumns = row => allCols.reduce(reducer(row), true)
const data = rows.filter(row => hasAllColumns(row))

View File

@ -14,16 +14,44 @@
export let donut
export let palette
$: options = setUpChart(dataProvider)
$: options = setUpChart(
title,
dataProvider,
labelColumn,
valueColumn,
height,
width,
dataLabels,
animate,
legend,
donut,
palette
)
// Fetch data on mount
const setUpChart = provider => {
if (!provider || !provider.rows?.length || !labelColumn || !valueColumn) {
const setUpChart = (
title,
dataProvider,
labelColumn,
valueColumn,
height,
width,
dataLabels,
animate,
legend,
donut,
palette
) => {
if (
!dataProvider ||
!dataProvider.rows?.length ||
!labelColumn ||
!valueColumn
) {
return null
}
// Fetch, filter and sort data
const { schema, rows } = provider
const { schema, rows } = dataProvider
const data = rows
.filter(row => row[labelColumn] != null && row[valueColumn] != null)
.slice(0, 100)

View File

@ -4,7 +4,6 @@
Button,
Combobox,
DatePicker,
DrawerContent,
Icon,
Input,
Layout,
@ -12,10 +11,12 @@
} from "@budibase/bbui"
import { generate } from "shortid"
import { LuceneUtils, Constants } from "@budibase/frontend-core"
import { getContext } from "svelte"
export let schemaFields
export let filters = []
const context = getContext("context")
const BannedTypes = ["link", "attachment", "json"]
$: fieldOptions = (schemaFields ?? [])
@ -89,8 +90,7 @@
}
</script>
<DrawerContent>
<div class="container">
<div class="container" class:mobile={$context.device.mobile}>
<Layout noPadding>
<Body size="S">
{#if !filters?.length}
@ -138,6 +138,7 @@
{:else}
<Input disabled />
{/if}
<div class="controls">
<Icon
name="Duplicate"
hoverable
@ -150,6 +151,7 @@
size="S"
on:click={() => removeFilter(filter.id)}
/>
</div>
{/each}
</div>
{/if}
@ -160,7 +162,6 @@
</div>
</Layout>
</div>
</DrawerContent>
<style>
.container {
@ -175,4 +176,19 @@
align-items: center;
grid-template-columns: 1fr 120px 1fr auto auto;
}
.controls {
display: contents;
}
.container.mobile .fields {
grid-template-columns: 1fr;
}
.container.mobile .controls {
display: flex;
flex-direction: row;
justify-content: flex-start;
align-items: center;
padding: var(--spacing-s) 0;
gap: var(--spacing-s);
}
</style>

View File

@ -157,13 +157,9 @@
const { fieldState } = get(existingField)
fieldId = fieldState.fieldId
// Use new default value if default value changed,
// otherwise use the current value if possible
if (defaultValue !== fieldState.defaultValue) {
initialValue = defaultValue
} else {
// Determine the initial value for this field, reusing the current
// value if one exists
initialValue = fieldState.value ?? initialValue
}
// If this field has already been registered and we previously had an
// error set, then re-run the validator to see if we can unset it

View File

@ -6,12 +6,26 @@ const createAuthStore = () => {
// Fetches the user object if someone is logged in and has reloaded the page
const fetchUser = async () => {
let globalSelf = null
let appSelf = null
// First try and get the global user, to see if we are logged in at all
try {
const user = await API.fetchSelf()
store.set(user)
globalSelf = await API.fetchBuilderSelf()
} catch (error) {
store.set(null)
return
}
// Then try and get the user for this app to provide via context
try {
appSelf = await API.fetchSelf()
} catch (error) {
// Swallow
}
// Use the app self if present, otherwise fallback to the global self
store.set(appSelf || globalSelf || null)
}
const logOut = async () => {

File diff suppressed because it is too large Load Diff

View File

@ -1,12 +1,12 @@
{
"name": "@budibase/frontend-core",
"version": "1.0.91-alpha.12",
"version": "1.0.91-alpha.16",
"description": "Budibase frontend core libraries used in builder and client",
"author": "Budibase",
"license": "MPL-2.0",
"svelte": "src/index.js",
"dependencies": {
"@budibase/bbui": "^1.0.91-alpha.12",
"@budibase/bbui": "^1.0.91-alpha.16",
"lodash": "^4.17.21",
"svelte": "^3.46.2"
}

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
{
"name": "@budibase/server",
"email": "hi@budibase.com",
"version": "1.0.91-alpha.12",
"version": "1.0.91-alpha.16",
"description": "Budibase Web Server",
"main": "src/index.ts",
"repository": {
@ -71,9 +71,9 @@
"license": "GPL-3.0",
"dependencies": {
"@apidevtools/swagger-parser": "^10.0.3",
"@budibase/backend-core": "^1.0.91-alpha.12",
"@budibase/client": "^1.0.91-alpha.12",
"@budibase/string-templates": "^1.0.91-alpha.12",
"@budibase/backend-core": "^1.0.91-alpha.16",
"@budibase/client": "^1.0.91-alpha.16",
"@budibase/string-templates": "^1.0.91-alpha.16",
"@bull-board/api": "^3.7.0",
"@bull-board/koa": "^3.7.0",
"@elastic/elasticsearch": "7.10.0",
@ -149,6 +149,7 @@
"@types/jest": "^26.0.23",
"@types/koa": "^2.13.3",
"@types/koa-router": "^7.4.2",
"@types/lodash": "4.14.180",
"@types/node": "^15.12.4",
"@types/oracledb": "^5.2.1",
"@types/redis": "^4.0.11",

View File

@ -52,16 +52,14 @@ export async function read(ctx: any, next: any) {
}
export async function update(ctx: any, next: any) {
ctx.request.body = await addRev(fixRow(ctx.request.body, ctx.params.tableId))
ctx.request.body = await addRev(fixRow(ctx.request.body, ctx.params))
await rowController.save(ctx)
await next()
}
export async function destroy(ctx: any, next: any) {
// set the body as expected, with the _id and _rev fields
ctx.request.body = await addRev(
fixRow({ _id: ctx.params.rowId }, ctx.params.tableId)
)
ctx.request.body = await addRev(fixRow({ _id: ctx.params.rowId }, ctx.params))
await rowController.destroy(ctx)
// destroy controller doesn't currently return the row as the body, need to adjust this
// in the public API to be correct

File diff suppressed because it is too large Load Diff

View File

@ -11,6 +11,7 @@ import {
PaginationValues,
} from "../definitions/datasource"
import { IntegrationBase } from "./base/IntegrationBase"
import { get } from "lodash"
const BodyTypes = {
NONE: "none",
@ -163,7 +164,7 @@ module RestModule {
// Check if a pagination cursor exists in the response
let nextCursor = null
if (pagination?.responseParam) {
nextCursor = data?.[pagination.responseParam]
nextCursor = get(data, pagination.responseParam)
}
return {

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
{
"name": "@budibase/string-templates",
"version": "1.0.91-alpha.12",
"version": "1.0.91-alpha.16",
"description": "Handlebars wrapper for Budibase templating.",
"main": "src/index.cjs",
"module": "dist/bundle.mjs",

View File

@ -1,7 +1,7 @@
{
"name": "@budibase/worker",
"email": "hi@budibase.com",
"version": "1.0.91-alpha.12",
"version": "1.0.91-alpha.16",
"description": "Budibase background service",
"main": "src/index.ts",
"repository": {
@ -34,8 +34,8 @@
"author": "Budibase",
"license": "GPL-3.0",
"dependencies": {
"@budibase/backend-core": "^1.0.91-alpha.12",
"@budibase/string-templates": "^1.0.91-alpha.12",
"@budibase/backend-core": "^1.0.91-alpha.16",
"@budibase/string-templates": "^1.0.91-alpha.16",
"@koa/router": "^8.0.0",
"@sentry/node": "^6.0.0",
"@techpass/passport-openidconnect": "^0.3.0",

File diff suppressed because it is too large Load Diff