Merge branch 'develop' of github.com:Budibase/budibase into experimental-hbs-caching

This commit is contained in:
Andrew Kingston 2022-02-14 17:58:42 +00:00
commit 7828f9377e
21 changed files with 1031 additions and 74 deletions

View File

@ -14,7 +14,7 @@ on:
jobs:
build:
runs-on: [self-hosted, linux]
runs-on: ubuntu-latest
strategy:
matrix:

View File

@ -1,5 +1,5 @@
{
"version": "1.0.58-alpha.2",
"version": "1.0.58-alpha.4",
"npmClient": "yarn",
"packages": [
"packages/*"

View File

@ -1,6 +1,6 @@
{
"name": "@budibase/backend-core",
"version": "1.0.58-alpha.2",
"version": "1.0.58-alpha.4",
"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.58-alpha.2",
"version": "1.0.58-alpha.4",
"license": "MPL-2.0",
"svelte": "src/index.js",
"module": "dist/bbui.es.js",

View File

@ -74,4 +74,12 @@
align-items: flex-start;
gap: var(--spacing-xs);
}
.buttons {
display: flex;
flex-direction: row;
justify-content: flex-start;
align-items: center;
gap: var(--spacing-m);
}
</style>

View File

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

View File

@ -0,0 +1,178 @@
<script>
import {
Button,
Icon,
DrawerContent,
Layout,
Input,
Select,
Label,
Body,
} from "@budibase/bbui"
import { flip } from "svelte/animate"
import { dndzone } from "svelte-dnd-action"
import { generate } from "shortid"
export let columns = []
export let options = []
const flipDurationMs = 150
let dragDisabled = true
$: unselectedColumns = getUnselectedColumns(options, columns)
$: columns.forEach(column => {
if (!column.id) {
column.id = generate()
}
})
const getUnselectedColumns = (allColumns, selectedColumns) => {
let optionsObj = {}
allColumns.forEach(option => {
optionsObj[option] = true
})
selectedColumns?.forEach(column => {
delete optionsObj[column.name]
})
return Object.keys(optionsObj)
}
const getRemainingColumnOptions = selectedColumn => {
if (!selectedColumn || unselectedColumns.includes(selectedColumn)) {
return unselectedColumns
}
return [selectedColumn, ...unselectedColumns]
}
const addColumn = () => {
columns = [...columns, {}]
}
const removeColumn = id => {
columns = columns.filter(column => column.id !== id)
}
const updateColumnOrder = e => {
columns = e.detail.items
}
const handleFinalize = e => {
updateColumnOrder(e)
dragDisabled = true
}
const reset = () => {
columns = options.map(col => ({
name: col,
displayName: col,
}))
}
</script>
<DrawerContent>
<div class="container">
<Layout noPadding gap="S">
{#if columns?.length}
<Layout noPadding gap="XS">
<div class="column">
<div />
<Label size="L">Column</Label>
<Label size="L">Label</Label>
<div />
</div>
<div
class="columns"
use:dndzone={{
items: columns,
flipDurationMs,
dropTargetStyle: { outline: "none" },
dragDisabled,
}}
on:finalize={handleFinalize}
on:consider={updateColumnOrder}
>
{#each columns as column (column.id)}
<div class="column" animate:flip={{ duration: flipDurationMs }}>
<div
class="handle"
aria-label="drag-handle"
style={dragDisabled ? "cursor: grab" : "cursor: grabbing"}
on:mousedown={() => (dragDisabled = false)}
>
<Icon name="DragHandle" size="XL" />
</div>
<Select
bind:value={column.name}
placeholder="Column"
options={getRemainingColumnOptions(column.name)}
on:change={e => (column.displayName = e.detail)}
/>
<Input bind:value={column.displayName} placeholder="Label" />
<Icon
name="Close"
hoverable
size="S"
on:click={() => removeColumn(column.id)}
disabled={columns.length === 1}
/>
</div>
{/each}
</div>
</Layout>
{:else}
<div class="column">
<div />
<Body size="S">Add the first column to your table.</Body>
</div>
{/if}
<div class="columns">
<div class="column">
<div />
<div class="buttons">
<Button secondary icon="Add" on:click={addColumn}>
Add column
</Button>
<Button secondary quiet on:click={reset}>Reset columns</Button>
</div>
</div>
</div>
</Layout>
</div>
</DrawerContent>
<style>
.container {
width: 100%;
max-width: 600px;
margin: 0 auto;
}
.columns {
display: flex;
flex-direction: column;
justify-content: flex-start;
align-items: stretch;
gap: var(--spacing-m);
}
.column {
gap: var(--spacing-l);
display: grid;
grid-template-columns: 20px 1fr 1fr 20px;
align-items: center;
border-radius: var(--border-radius-s);
transition: background-color ease-in-out 130ms;
}
.column:hover {
background-color: var(--spectrum-global-color-gray-100);
}
.handle {
display: grid;
place-items: center;
}
.buttons {
display: flex;
flex-direction: row;
justify-content: flex-start;
align-items: center;
gap: var(--spacing-m);
}
</style>

View File

@ -0,0 +1,64 @@
<script>
import { Button, ActionButton, Drawer } from "@budibase/bbui"
import { createEventDispatcher } from "svelte"
import ColumnDrawer from "./ColumnDrawer.svelte"
import { cloneDeep } from "lodash/fp"
import {
getDatasourceForProvider,
getSchemaForDatasource,
} from "builderStore/dataBinding"
import { currentAsset } from "builderStore"
export let componentInstance
export let value = []
const dispatch = createEventDispatcher()
let drawer
let boundValue
$: datasource = getDatasourceForProvider($currentAsset, componentInstance)
$: schema = getSchemaForDatasource($currentAsset, datasource).schema
$: options = Object.keys(schema || {})
$: sanitisedValue = getValidColumns(value, options)
$: updateBoundValue(sanitisedValue)
const updateBoundValue = value => {
boundValue = cloneDeep(value)
}
const getValidColumns = (columns, options) => {
// If no columns then default to all columns
if (!Array.isArray(columns) || !columns.length) {
return options.map(col => ({
name: col,
displayName: col,
}))
}
// We need to account for legacy configs which would just be an array
// of strings
if (typeof columns[0] === "string") {
columns = columns.map(col => ({
name: col,
displayName: col,
}))
}
return columns.filter(column => {
return options.includes(column.name)
})
}
const save = () => {
dispatch("change", getValidColumns(boundValue, options))
drawer.hide()
}
</script>
<ActionButton on:click={drawer.show}>Configure columns</ActionButton>
<Drawer bind:this={drawer} title="Table Columns">
<svelte:fragment slot="description">
Configure the columns in your table.
</svelte:fragment>
<Button cta slot="buttons" on:click={save}>Save</Button>
<ColumnDrawer slot="body" bind:columns={boundValue} {options} />
</Drawer>

View File

@ -15,7 +15,7 @@
}
</script>
<ActionButton on:click={drawer.show}>Configure Links</ActionButton>
<ActionButton on:click={drawer.show}>Configure links</ActionButton>
<Drawer bind:this={drawer} title={"Navigation Links"}>
<svelte:fragment slot="description">
Configure the links in your navigation bar.

View File

@ -18,6 +18,7 @@ import OptionsEditor from "./OptionsEditor/OptionsEditor.svelte"
import FormFieldSelect from "./FormFieldSelect.svelte"
import ValidationEditor from "./ValidationEditor/ValidationEditor.svelte"
import DrawerBindableCombobox from "components/common/bindings/DrawerBindableCombobox.svelte"
import ColumnEditor from "./ColumnEditor/ColumnEditor.svelte"
const componentMap = {
text: DrawerBindableCombobox,
@ -40,6 +41,7 @@ const componentMap = {
navigation: NavigationEditor,
filter: FilterEditor,
url: URLSelect,
columns: ColumnEditor,
"field/string": FormFieldSelect,
"field/number": FormFieldSelect,
"field/options": FormFieldSelect,

File diff suppressed because it is too large Load Diff

View File

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

View File

@ -704,9 +704,9 @@ flatted@^3.1.0:
integrity sha512-8/sOawo8tJ4QOBX8YlQBMxL8+RLZfxMQOif9o0KUKTNTjMYElWPE0r/m5VNFxTRd0NSw8qSy8dajrwX4RYI1Hw==
follow-redirects@^1.14.0:
version "1.14.5"
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.14.5.tgz#f09a5848981d3c772b5392309778523f8d85c381"
integrity sha512-wtphSXy7d4/OR+MvIFbCVBDzZ5520qV8XfPklSN5QtxuMUJZ+b0Wnst1e1lCDocfzuCkHqj8k0FpZqO+UIaKNA==
version "1.14.8"
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.14.8.tgz#016996fb9a11a100566398b1c6839337d7bfa8fc"
integrity sha512-1x0S9UVJHsQprFcEC/qnNzBLcIxsjAV905f/UkQxbclCsoTWlacCNOpQa/anodLl2uaEKFhfWOvM2Qg77+15zA==
from2@^2.3.0:
version "2.3.0"

View File

@ -2680,11 +2680,10 @@
"defaultValue": 8
},
{
"type": "multifield",
"type": "columns",
"label": "Columns",
"key": "columns",
"dependsOn": "dataProvider",
"placeholder": "All columns"
"dependsOn": "dataProvider"
},
{
"type": "select",
@ -2951,7 +2950,7 @@
"defaultValue": 8
},
{
"type": "multifield",
"type": "columns",
"label": "Table Columns",
"key": "tableColumns",
"dependsOn": "dataSource",

View File

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

View File

@ -40,7 +40,8 @@
// Check for an invalid column selection
let invalid = false
customColumns?.forEach(column => {
if (schema[column] == null) {
const columnName = typeof column === "string" ? column : column.name
if (schema[columnName] == null) {
invalid = true
}
})
@ -75,9 +76,16 @@
}
fields.forEach(field => {
newSchema[field] = schema[field]
if (schema[field] && UnsortableTypes.indexOf(schema[field].type) !== -1) {
newSchema[field].sortable = false
const columnName = typeof field === "string" ? field : field.name
if (!schema[columnName]) {
return
}
newSchema[columnName] = schema[columnName]
if (UnsortableTypes.includes(schema[columnName].type)) {
newSchema[columnName].sortable = false
}
if (field?.displayName) {
newSchema[columnName].displayName = field?.displayName
}
})
return newSchema

View File

@ -1,12 +1,12 @@
{
"name": "@budibase/frontend-core",
"version": "1.0.58-alpha.2",
"version": "1.0.58-alpha.4",
"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.58-alpha.2",
"@budibase/bbui": "^1.0.58-alpha.4",
"lodash": "^4.17.21",
"svelte": "^3.46.2"
}

View File

@ -1,7 +1,7 @@
{
"name": "@budibase/server",
"email": "hi@budibase.com",
"version": "1.0.58-alpha.2",
"version": "1.0.58-alpha.4",
"description": "Budibase Web Server",
"main": "src/index.ts",
"repository": {
@ -70,9 +70,9 @@
"license": "GPL-3.0",
"dependencies": {
"@apidevtools/swagger-parser": "^10.0.3",
"@budibase/backend-core": "^1.0.58-alpha.2",
"@budibase/client": "^1.0.58-alpha.2",
"@budibase/string-templates": "^1.0.58-alpha.2",
"@budibase/backend-core": "^1.0.58-alpha.4",
"@budibase/client": "^1.0.58-alpha.4",
"@budibase/string-templates": "^1.0.58-alpha.4",
"@bull-board/api": "^3.7.0",
"@bull-board/koa": "^3.7.0",
"@elastic/elasticsearch": "7.10.0",

View File

@ -983,10 +983,10 @@
resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39"
integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==
"@budibase/backend-core@^1.0.50-alpha.6":
version "1.0.56"
resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-1.0.56.tgz#898ad4df1d923527cb340ae76ec548d1e5234755"
integrity sha512-Cos2TgI6grgSTiLPGlAZb53BEWPrzU3e9UXhhTtwiROraYxkVQob6kOQMK7Cvnm3IC+viXjDRijysvactlRwFA==
"@budibase/backend-core@^1.0.58-alpha.1":
version "1.0.62"
resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-1.0.62.tgz#ca7f5b81fdf671157a237956fc903da48d7093a1"
integrity sha512-cHPH44zSnhxXqdTn2FQjdZyhB/gOPDUJX1W6BHALsBf4aWdcCVA8EpDmYQD08z6wvQpYdXD85gJ8R2eXE8PBGA==
dependencies:
"@techpass/passport-openidconnect" "^0.3.0"
aws-sdk "^2.901.0"
@ -1056,10 +1056,10 @@
svelte-flatpickr "^3.2.3"
svelte-portal "^1.0.0"
"@budibase/bbui@^1.0.56":
version "1.0.56"
resolved "https://registry.yarnpkg.com/@budibase/bbui/-/bbui-1.0.56.tgz#3c8cd78c97a21a34fc4b9a45483c7eca739a1dd8"
integrity sha512-HNcQFSFyvtQBtDvqLhQwUCGVJsvNmRt5GZsgIZr73oKaowiC6cwBQm/uPg3I9GxqrTz6etPy0E5ELm/cZKptxA==
"@budibase/bbui@^1.0.62":
version "1.0.62"
resolved "https://registry.yarnpkg.com/@budibase/bbui/-/bbui-1.0.62.tgz#985e64f428ff4fa66e936f803abb2368bc2813e0"
integrity sha512-nvzo5li6/UQaIl5MMkinu4gUAZkv7HqWHXrFKWbzTt4xBRO0D8C+QgH62X5ZRBTFd34jIEsNJP1isJl38LvESQ==
dependencies:
"@adobe/spectrum-css-workflow-icons" "^1.2.1"
"@spectrum-css/actionbutton" "^1.0.1"
@ -1107,19 +1107,28 @@
svelte-flatpickr "^3.2.3"
svelte-portal "^1.0.0"
"@budibase/client@^1.0.50-alpha.6":
version "1.0.56"
resolved "https://registry.yarnpkg.com/@budibase/client/-/client-1.0.56.tgz#58376ee2d6f64d1a37e6cc8898006a74f5f810b2"
integrity sha512-a7D+AKzutYk3N5OlKndv4BYtt0vnkDysjNLRtkZnKj3ERwQzI3bERrs+Wp2o5KI3cbZFWYR8x179YYxjBTcnYg==
"@budibase/client@^1.0.58-alpha.1":
version "1.0.62"
resolved "https://registry.yarnpkg.com/@budibase/client/-/client-1.0.62.tgz#a737a94390149da57bb27b2b49bff94053e7660c"
integrity sha512-sX3VmOf9bpGmfkxqKfEvVrpD5X9BEsqoJ9jyjvy3IMHfIQ0Y+Yr0ZAJL25nrh33JL16Ir4CtDSCihdE7qtbA7Q==
dependencies:
"@budibase/bbui" "^1.0.56"
"@budibase/standard-components" "^0.9.139"
"@budibase/string-templates" "^1.0.56"
"@budibase/bbui" "^1.0.62"
"@budibase/frontend-core" "^1.0.62"
"@budibase/string-templates" "^1.0.62"
regexparam "^1.3.0"
rollup-plugin-polyfill-node "^0.8.0"
shortid "^2.2.15"
svelte-spa-router "^3.0.5"
"@budibase/frontend-core@^1.0.62":
version "1.0.62"
resolved "https://registry.yarnpkg.com/@budibase/frontend-core/-/frontend-core-1.0.62.tgz#8d7436bb22a327ba0f1343805323c33c87d44d84"
integrity sha512-LF028SoFAXaHajNr3UYiKuBl+h3h4kDNdu2NfGQjkU96kZq4Aqq2Ey174jj2wT6k97kEV7ht2pBTR4jU7s4aWQ==
dependencies:
"@budibase/bbui" "^1.0.62"
lodash "^4.17.21"
svelte "^3.46.2"
"@budibase/handlebars-helpers@^0.11.7":
version "0.11.8"
resolved "https://registry.yarnpkg.com/@budibase/handlebars-helpers/-/handlebars-helpers-0.11.8.tgz#6953d29673a8c5c407e096c0a84890465c7ce841"
@ -1163,10 +1172,10 @@
svelte-apexcharts "^1.0.2"
svelte-flatpickr "^3.1.0"
"@budibase/string-templates@^1.0.50-alpha.6", "@budibase/string-templates@^1.0.56":
version "1.0.56"
resolved "https://registry.yarnpkg.com/@budibase/string-templates/-/string-templates-1.0.56.tgz#13869566e344ec175904e7b535dba31f8ddd723d"
integrity sha512-lynmirU/3v+RPmuLGUG3SQUZ8EhjkaGsGTCtzzJq+59bR72zkpoxk+p2XbtJn5AWZvd4VN7d57w3+wGRMPTzoQ==
"@budibase/string-templates@^1.0.58-alpha.1", "@budibase/string-templates@^1.0.62":
version "1.0.62"
resolved "https://registry.yarnpkg.com/@budibase/string-templates/-/string-templates-1.0.62.tgz#f78ddde139a3f67e538c58b7e866244d1dbedfe8"
integrity sha512-0ujwPgJ6y54Wxyx6PH6qvg7ufioo+YtWtncrSDZ1bXdFX2uFHxrrHDYIQEG8c4e61ub/tvNESNAB/4Gb3IN4uA==
dependencies:
"@budibase/handlebars-helpers" "^0.11.7"
dayjs "^1.10.4"
@ -5864,9 +5873,9 @@ fn.name@1.x.x:
integrity sha512-GRnmB5gPyJpAhTQdSZTSp9uaPSvl09KoYcMQtsB9rQoOmzs9dH6ffeccH+Z+cv6P68Hu5bC6JjRh4Ah/mHSNRw==
follow-redirects@^1.14.0, follow-redirects@^1.14.4:
version "1.14.5"
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.14.5.tgz#f09a5848981d3c772b5392309778523f8d85c381"
integrity sha512-wtphSXy7d4/OR+MvIFbCVBDzZ5520qV8XfPklSN5QtxuMUJZ+b0Wnst1e1lCDocfzuCkHqj8k0FpZqO+UIaKNA==
version "1.14.8"
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.14.8.tgz#016996fb9a11a100566398b1c6839337d7bfa8fc"
integrity sha512-1x0S9UVJHsQprFcEC/qnNzBLcIxsjAV905f/UkQxbclCsoTWlacCNOpQa/anodLl2uaEKFhfWOvM2Qg77+15zA==
for-each@^0.3.3:
version "0.3.3"
@ -12074,6 +12083,11 @@ svelte@^3.38.2:
resolved "https://registry.yarnpkg.com/svelte/-/svelte-3.44.1.tgz#5cc772a8340f4519a4ecd1ac1a842325466b1a63"
integrity sha512-4DrCEJoBvdR689efHNSxIQn2pnFwB7E7j2yLEJtHE/P8hxwZWIphCtJ8are7bjl/iVMlcEf5uh5pJ68IwR09vQ==
svelte@^3.46.2:
version "3.46.4"
resolved "https://registry.yarnpkg.com/svelte/-/svelte-3.46.4.tgz#0c46bc4a3e20a2617a1b7dc43a722f9d6c084a38"
integrity sha512-qKJzw6DpA33CIa+C/rGp4AUdSfii0DOTCzj/2YpSKKayw5WGSS624Et9L1nU1k2OVRS9vaENQXp2CVZNU+xvIg==
svg.draggable.js@^2.2.2:
version "2.2.2"
resolved "https://registry.yarnpkg.com/svg.draggable.js/-/svg.draggable.js-2.2.2.tgz#c514a2f1405efb6f0263e7958f5b68fce50603ba"

View File

@ -1,6 +1,6 @@
{
"name": "@budibase/string-templates",
"version": "1.0.58-alpha.2",
"version": "1.0.58-alpha.4",
"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.58-alpha.2",
"version": "1.0.58-alpha.4",
"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.58-alpha.2",
"@budibase/string-templates": "^1.0.58-alpha.2",
"@budibase/backend-core": "^1.0.58-alpha.4",
"@budibase/string-templates": "^1.0.58-alpha.4",
"@koa/router": "^8.0.0",
"@sentry/node": "^6.0.0",
"@techpass/passport-openidconnect": "^0.3.0",