Merge branch 'master' of github.com:Budibase/budibase into labday/sqs

This commit is contained in:
mike12345567 2024-04-09 10:20:08 +01:00
commit 01385309f8
13 changed files with 243 additions and 17 deletions

View File

@ -37,6 +37,7 @@
"svg", "svg",
"bmp", "bmp",
"jfif", "jfif",
"webp",
] ]
const fieldId = id || uuid() const fieldId = id || uuid()

View File

@ -1,4 +1,6 @@
import { Checkbox, Select, RadioGroup, Stepper, Input } from "@budibase/bbui" import { Checkbox, Select, RadioGroup, Stepper, Input } from "@budibase/bbui"
import { licensing } from "stores/portal"
import { get } from "svelte/store"
import DataSourceSelect from "./controls/DataSourceSelect/DataSourceSelect.svelte" import DataSourceSelect from "./controls/DataSourceSelect/DataSourceSelect.svelte"
import S3DataSourceSelect from "./controls/S3DataSourceSelect.svelte" import S3DataSourceSelect from "./controls/S3DataSourceSelect.svelte"
import DataProviderSelect from "./controls/DataProviderSelect.svelte" import DataProviderSelect from "./controls/DataProviderSelect.svelte"
@ -26,7 +28,8 @@ import FieldConfiguration from "./controls/FieldConfiguration/FieldConfiguration
import ButtonConfiguration from "./controls/ButtonConfiguration/ButtonConfiguration.svelte" import ButtonConfiguration from "./controls/ButtonConfiguration/ButtonConfiguration.svelte"
import RelationshipFilterEditor from "./controls/RelationshipFilterEditor.svelte" import RelationshipFilterEditor from "./controls/RelationshipFilterEditor.svelte"
import FormStepConfiguration from "./controls/FormStepConfiguration.svelte" import FormStepConfiguration from "./controls/FormStepConfiguration.svelte"
import FormStepControls from "components/design/settings/controls/FormStepControls.svelte" import FormStepControls from "./controls/FormStepControls.svelte"
import PaywalledSetting from "./controls/PaywalledSetting.svelte"
const componentMap = { const componentMap = {
text: DrawerBindableInput, text: DrawerBindableInput,
@ -86,11 +89,16 @@ const componentMap = {
} }
export const getComponentForSetting = setting => { export const getComponentForSetting = setting => {
const { type, showInBar, barStyle } = setting || {} const { type, showInBar, barStyle, license } = setting || {}
if (!type) { if (!type) {
return null return null
} }
// Check for paywalled settings
if (license && get(licensing).isFreePlan) {
return PaywalledSetting
}
// We can show a clone of the bar settings for certain select settings // We can show a clone of the bar settings for certain select settings
if (showInBar && type === "select" && barStyle === "buttons") { if (showInBar && type === "select" && barStyle === "buttons") {
return BarButtonList return BarButtonList

View File

@ -0,0 +1,23 @@
<script>
import { Tag, Tags } from "@budibase/bbui"
import { getFormattedPlanName } from "helpers/planTitle"
export let license
$: title = getFormattedPlanName(license)
</script>
<div>
<Tags>
<Tag icon="LockClosed">{title}</Tag>
</Tags>
</div>
<style>
div {
height: 32px;
display: flex;
flex-direction: column;
justify-content: center;
}
</style>

View File

@ -183,6 +183,7 @@
props={{ props={{
// Generic settings // Generic settings
placeholder: setting.placeholder || null, placeholder: setting.placeholder || null,
license: setting.license,
// Select settings // Select settings
options: setting.options || [], options: setting.options || [],

View File

@ -4610,6 +4610,35 @@
"key": "dataSource", "key": "dataSource",
"required": true "required": true
}, },
{
"type": "select",
"label": "Auto-refresh",
"key": "autoRefresh",
"license": "premium",
"placeholder": "Never",
"options": [
{
"label": "10 seconds",
"value": 10
},
{
"label": "30 seconds",
"value": 30
},
{
"label": "1 minute",
"value": 60
},
{
"label": "5 minutes",
"value": 300
},
{
"label": "10 minutes",
"value": 600
}
]
},
{ {
"type": "filter", "type": "filter",
"label": "Filtering", "label": "Filtering",
@ -4977,6 +5006,35 @@
"key": "dataSource", "key": "dataSource",
"required": true "required": true
}, },
{
"type": "select",
"label": "Auto-refresh",
"key": "autoRefresh",
"license": "premium",
"placeholder": "Never",
"options": [
{
"label": "10 seconds",
"value": 10
},
{
"label": "30 seconds",
"value": 30
},
{
"label": "1 minute",
"value": 60
},
{
"label": "5 minutes",
"value": 300
},
{
"label": "10 minutes",
"value": 600
}
]
},
{ {
"type": "text", "type": "text",
"label": "Title", "label": "Title",
@ -5445,6 +5503,35 @@
"key": "dataSource", "key": "dataSource",
"required": true "required": true
}, },
{
"type": "select",
"label": "Auto-refresh",
"key": "autoRefresh",
"license": "premium",
"placeholder": "Never",
"options": [
{
"label": "10 seconds",
"value": 10
},
{
"label": "30 seconds",
"value": 30
},
{
"label": "1 minute",
"value": 60
},
{
"label": "5 minutes",
"value": 300
},
{
"label": "10 minutes",
"value": 600
}
]
},
{ {
"type": "columns", "type": "columns",
"label": "Columns", "label": "Columns",
@ -5731,6 +5818,35 @@
"key": "dataSource", "key": "dataSource",
"required": true "required": true
}, },
{
"type": "select",
"label": "Auto-refresh",
"key": "autoRefresh",
"license": "premium",
"placeholder": "Never",
"options": [
{
"label": "10 seconds",
"value": 10
},
{
"label": "30 seconds",
"value": 30
},
{
"label": "1 minute",
"value": 60
},
{
"label": "5 minutes",
"value": 300
},
{
"label": "10 minutes",
"value": 600
}
]
},
{ {
"type": "searchfield", "type": "searchfield",
"label": "Search columns", "label": "Search columns",
@ -5908,6 +6024,35 @@
"key": "dataSource", "key": "dataSource",
"required": true "required": true
}, },
{
"type": "select",
"label": "Auto-refresh",
"key": "autoRefresh",
"license": "premium",
"placeholder": "Never",
"options": [
{
"label": "10 seconds",
"value": 10
},
{
"label": "30 seconds",
"value": 30
},
{
"label": "1 minute",
"value": 60
},
{
"label": "5 minutes",
"value": 300
},
{
"label": "10 minutes",
"value": 600
}
]
},
{ {
"type": "filter", "type": "filter",
"label": "Filtering", "label": "Filtering",
@ -6504,6 +6649,35 @@
"key": "dataSource", "key": "dataSource",
"required": true "required": true
}, },
{
"type": "select",
"label": "Auto-refresh",
"key": "autoRefresh",
"license": "premium",
"placeholder": "Never",
"options": [
{
"label": "10 seconds",
"value": 10
},
{
"label": "30 seconds",
"value": 30
},
{
"label": "1 minute",
"value": 60
},
{
"label": "5 minutes",
"value": 300
},
{
"label": "10 minutes",
"value": 600
}
]
},
{ {
"type": "text", "type": "text",
"label": "Height", "label": "Height",

View File

@ -9,17 +9,18 @@
export let sortOrder export let sortOrder
export let limit export let limit
export let paginate export let paginate
export let autoRefresh
const { styleable, Provider, ActionTypes, API } = getContext("sdk") const { styleable, Provider, ActionTypes, API } = getContext("sdk")
const component = getContext("component") const component = getContext("component")
let interval
let queryExtensions = {}
// We need to manage our lucene query manually as we want to allow components // We need to manage our lucene query manually as we want to allow components
// to extend it // to extend it
let queryExtensions = {}
$: defaultQuery = LuceneUtils.buildLuceneQuery(filter) $: defaultQuery = LuceneUtils.buildLuceneQuery(filter)
$: query = extendQuery(defaultQuery, queryExtensions) $: query = extendQuery(defaultQuery, queryExtensions)
// Fetch data and refresh when needed
$: fetch = createFetch(dataSource) $: fetch = createFetch(dataSource)
$: fetch.update({ $: fetch.update({
query, query,
@ -28,11 +29,8 @@
limit, limit,
paginate, paginate,
}) })
// Sanitize schema to remove hidden fields
$: schema = sanitizeSchema($fetch.schema) $: schema = sanitizeSchema($fetch.schema)
$: setUpAutoRefresh(autoRefresh)
// Build our action context
$: actions = [ $: actions = [
{ {
type: ActionTypes.RefreshDatasource, type: ActionTypes.RefreshDatasource,
@ -63,8 +61,6 @@
}, },
}, },
] ]
// Build our data context
$: dataContext = { $: dataContext = {
rows: $fetch.rows, rows: $fetch.rows,
info: $fetch.info, info: $fetch.info,
@ -140,6 +136,13 @@
}) })
return extendedQuery return extendedQuery
} }
const setUpAutoRefresh = autoRefresh => {
clearInterval(interval)
if (autoRefresh) {
interval = setInterval(fetch.refresh, Math.max(10000, autoRefresh * 1000))
}
}
</script> </script>
<div use:styleable={$component.styles} class="container"> <div use:styleable={$component.styles} class="container">

View File

@ -18,6 +18,7 @@
export let columns = null export let columns = null
export let onRowClick = null export let onRowClick = null
export let buttons = null export let buttons = null
export let repeat = null
const context = getContext("context") const context = getContext("context")
const component = getContext("component") const component = getContext("component")
@ -122,6 +123,7 @@
{fixedRowHeight} {fixedRowHeight}
{columnWhitelist} {columnWhitelist}
{schemaOverrides} {schemaOverrides}
{repeat}
canAddRows={allowAddRows} canAddRows={allowAddRows}
canEditRows={allowEditRows} canEditRows={allowEditRows}
canDeleteRows={allowDeleteRows} canDeleteRows={allowDeleteRows}

View File

@ -10,13 +10,11 @@
const { const {
routeStore, routeStore,
roleStore, roleStore,
styleable,
linkable, linkable,
builderStore, builderStore,
sidePanelStore, sidePanelStore,
appStore, appStore,
} = sdk } = sdk
const component = getContext("component")
const context = getContext("context") const context = getContext("context")
// Legacy props which must remain unchanged for backwards compatibility // Legacy props which must remain unchanged for backwards compatibility
@ -169,15 +167,14 @@
<!-- svelte-ignore a11y-no-static-element-interactions --> <!-- svelte-ignore a11y-no-static-element-interactions -->
<!-- svelte-ignore a11y-click-events-have-key-events --> <!-- svelte-ignore a11y-click-events-have-key-events -->
<div <div
class="component {screenId} layout layout--{typeClass}" class="component layout layout--{typeClass}"
use:styleable={$component.styles}
class:desktop={!mobile} class:desktop={!mobile}
class:mobile={!!mobile} class:mobile={!!mobile}
data-id={screenId} data-id={screenId}
data-name="Screen" data-name="Screen"
data-icon="WebPage" data-icon="WebPage"
> >
<div class="{screenId}-dom screen-wrapper layout-body"> <div class="screen-wrapper layout-body">
{#if typeClass !== "none"} {#if typeClass !== "none"}
<div <div
class="interactive component {navigationId}" class="interactive component {navigationId}"
@ -282,7 +279,14 @@
</div> </div>
</div> </div>
{/if} {/if}
<div class="main-wrapper"> <div
class="main-wrapper"
on:click={() => {
if ($builderStore.inBuilder) {
builderStore.actions.selectComponent(screenId)
}
}}
>
<div class="main size--{pageWidthClass}"> <div class="main size--{pageWidthClass}">
<slot /> <slot />
</div> </div>

View File

@ -31,6 +31,7 @@
export let cardButtonOnClick export let cardButtonOnClick
export let linkColumn export let linkColumn
export let noRowsMessage export let noRowsMessage
export let autoRefresh
const context = getContext("context") const context = getContext("context")
const { fetchDatasourceSchema, generateGoldenSample } = getContext("sdk") const { fetchDatasourceSchema, generateGoldenSample } = getContext("sdk")
@ -184,6 +185,7 @@
sortOrder, sortOrder,
paginate, paginate,
limit, limit,
autoRefresh,
}} }}
order={1} order={1}
> >

View File

@ -8,6 +8,7 @@
export let sortColumn export let sortColumn
export let sortOrder export let sortOrder
export let limit export let limit
export let autoRefresh
// Block // Block
export let chartTitle export let chartTitle
@ -65,6 +66,7 @@
sortColumn, sortColumn,
sortOrder, sortOrder,
limit, limit,
autoRefresh,
}} }}
> >
{#if dataProviderId && chartType} {#if dataProviderId && chartType}

View File

@ -17,6 +17,7 @@
export let hAlign export let hAlign
export let vAlign export let vAlign
export let gap export let gap
export let autoRefresh
const component = getContext("component") const component = getContext("component")
const context = getContext("context") const context = getContext("context")
@ -47,6 +48,7 @@
sortOrder, sortOrder,
limit, limit,
paginate, paginate,
autoRefresh,
}} }}
> >
{#if $component.empty} {#if $component.empty}

View File

@ -16,6 +16,7 @@
export let detailFields export let detailFields
export let detailTitle export let detailTitle
export let noRowsMessage export let noRowsMessage
export let autoRefresh
const stateKey = generate() const stateKey = generate()
const context = getContext("context") const context = getContext("context")
@ -66,6 +67,7 @@
noValue: false, noValue: false,
}, },
], ],
autoRefresh,
}} }}
styles={{ styles={{
custom: ` custom: `

View File

@ -33,6 +33,7 @@
export let sidePanelSaveLabel export let sidePanelSaveLabel
export let sidePanelDeleteLabel export let sidePanelDeleteLabel
export let notificationOverride export let notificationOverride
export let autoRefresh
const { fetchDatasourceSchema, API, generateGoldenSample } = getContext("sdk") const { fetchDatasourceSchema, API, generateGoldenSample } = getContext("sdk")
const component = getContext("component") const component = getContext("component")
@ -243,6 +244,7 @@
sortOrder, sortOrder,
paginate, paginate,
limit: rowCount, limit: rowCount,
autoRefresh,
}} }}
context="provider" context="provider"
order={1} order={1}