Merge remote-tracking branch 'origin/master' into feat/automation-ux
This commit is contained in:
commit
ec88e14b75
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"version": "2.14.4",
|
"version": "2.14.5",
|
||||||
"npmClient": "yarn",
|
"npmClient": "yarn",
|
||||||
"packages": [
|
"packages": [
|
||||||
"packages/*",
|
"packages/*",
|
||||||
|
|
|
@ -85,7 +85,6 @@ const INITIAL_FRONTEND_STATE = {
|
||||||
selectedScreenId: null,
|
selectedScreenId: null,
|
||||||
selectedComponentId: null,
|
selectedComponentId: null,
|
||||||
selectedLayoutId: null,
|
selectedLayoutId: null,
|
||||||
hoverComponentId: null,
|
|
||||||
|
|
||||||
// Client state
|
// Client state
|
||||||
selectedComponentInstance: null,
|
selectedComponentInstance: null,
|
||||||
|
@ -93,6 +92,9 @@ const INITIAL_FRONTEND_STATE = {
|
||||||
// Onboarding
|
// Onboarding
|
||||||
onboarding: false,
|
onboarding: false,
|
||||||
tourNodes: null,
|
tourNodes: null,
|
||||||
|
|
||||||
|
// UI state
|
||||||
|
hoveredComponentId: null,
|
||||||
}
|
}
|
||||||
|
|
||||||
export const getFrontendStore = () => {
|
export const getFrontendStore = () => {
|
||||||
|
@ -1413,6 +1415,18 @@ export const getFrontendStore = () => {
|
||||||
return state
|
return state
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
hover: (componentId, notifyClient = true) => {
|
||||||
|
if (componentId === get(store).hoveredComponentId) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
store.update(state => {
|
||||||
|
state.hoveredComponentId = componentId
|
||||||
|
return state
|
||||||
|
})
|
||||||
|
if (notifyClient) {
|
||||||
|
store.actions.preview.sendEvent("hover-component", componentId)
|
||||||
|
}
|
||||||
|
},
|
||||||
},
|
},
|
||||||
links: {
|
links: {
|
||||||
save: async (url, title) => {
|
save: async (url, title) => {
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
import { Helpers } from "@budibase/bbui"
|
import { Helpers } from "@budibase/bbui"
|
||||||
import { derived, writable } from "svelte/store"
|
import { derived, writable } from "svelte/store"
|
||||||
import { Utils } from "@budibase/frontend-core"
|
import { Utils } from "@budibase/frontend-core"
|
||||||
import { cloneDeep } from "lodash"
|
import { cloneDeep, isEqual } from "lodash"
|
||||||
|
|
||||||
export let componentInstance
|
export let componentInstance
|
||||||
export let componentBindings
|
export let componentBindings
|
||||||
|
@ -21,21 +21,32 @@
|
||||||
const currentStep = derived(multiStepStore, state => state.currentStep)
|
const currentStep = derived(multiStepStore, state => state.currentStep)
|
||||||
const componentType = "@budibase/standard-components/multistepformblockstep"
|
const componentType = "@budibase/standard-components/multistepformblockstep"
|
||||||
|
|
||||||
|
let cachedValue
|
||||||
|
let cachedInstance = {}
|
||||||
|
|
||||||
|
$: if (!isEqual(cachedValue, value)) {
|
||||||
|
cachedValue = value
|
||||||
|
}
|
||||||
|
|
||||||
|
$: if (!isEqual(componentInstance, cachedInstance)) {
|
||||||
|
cachedInstance = componentInstance
|
||||||
|
}
|
||||||
|
|
||||||
setContext("multi-step-form-block", multiStepStore)
|
setContext("multi-step-form-block", multiStepStore)
|
||||||
|
|
||||||
$: stepCount = value?.length || 0
|
$: stepCount = cachedValue?.length || 0
|
||||||
$: updateStore(stepCount)
|
$: updateStore(stepCount)
|
||||||
$: dataSource = getDatasourceForProvider($currentAsset, componentInstance)
|
$: dataSource = getDatasourceForProvider($currentAsset, cachedInstance)
|
||||||
$: emitCurrentStep($currentStep)
|
$: emitCurrentStep($currentStep)
|
||||||
$: stepLabel = getStepLabel($multiStepStore)
|
$: stepLabel = getStepLabel($multiStepStore)
|
||||||
$: stepDef = getDefinition(stepLabel)
|
$: stepDef = getDefinition(stepLabel)
|
||||||
$: stepSettings = value?.[$currentStep] || {}
|
$: stepSettings = cachedValue?.[$currentStep] || {}
|
||||||
$: defaults = Utils.buildMultiStepFormBlockDefaultProps({
|
$: defaults = Utils.buildMultiStepFormBlockDefaultProps({
|
||||||
_id: componentInstance._id,
|
_id: cachedInstance._id,
|
||||||
stepCount: $multiStepStore.stepCount,
|
stepCount: $multiStepStore.stepCount,
|
||||||
currentStep: $multiStepStore.currentStep,
|
currentStep: $multiStepStore.currentStep,
|
||||||
actionType: componentInstance.actionType,
|
actionType: cachedInstance.actionType,
|
||||||
dataSource: componentInstance.dataSource,
|
dataSource: cachedInstance.dataSource,
|
||||||
})
|
})
|
||||||
$: stepInstance = {
|
$: stepInstance = {
|
||||||
_id: Helpers.uuid(),
|
_id: Helpers.uuid(),
|
||||||
|
|
|
@ -108,6 +108,8 @@
|
||||||
{componentInstance}
|
{componentInstance}
|
||||||
{componentDefinition}
|
{componentDefinition}
|
||||||
{bindings}
|
{bindings}
|
||||||
|
iconTooltip={componentName}
|
||||||
|
componentTitle={title}
|
||||||
/>
|
/>
|
||||||
{/if}
|
{/if}
|
||||||
{#if section == "conditions"}
|
{#if section == "conditions"}
|
||||||
|
|
|
@ -5,6 +5,9 @@
|
||||||
Drawer,
|
Drawer,
|
||||||
Button,
|
Button,
|
||||||
notifications,
|
notifications,
|
||||||
|
AbsTooltip,
|
||||||
|
Icon,
|
||||||
|
Body,
|
||||||
} from "@budibase/bbui"
|
} from "@budibase/bbui"
|
||||||
import { selectedScreen, store } from "builderStore"
|
import { selectedScreen, store } from "builderStore"
|
||||||
import ClientBindingPanel from "components/common/bindings/ClientBindingPanel.svelte"
|
import ClientBindingPanel from "components/common/bindings/ClientBindingPanel.svelte"
|
||||||
|
@ -15,6 +18,9 @@
|
||||||
} from "builderStore/dataBinding"
|
} from "builderStore/dataBinding"
|
||||||
|
|
||||||
export let componentInstance
|
export let componentInstance
|
||||||
|
export let componentDefinition
|
||||||
|
export let iconTooltip
|
||||||
|
export let componentTitle
|
||||||
|
|
||||||
let tempValue
|
let tempValue
|
||||||
let drawer
|
let drawer
|
||||||
|
@ -24,6 +30,8 @@
|
||||||
$store.selectedComponentId
|
$store.selectedComponentId
|
||||||
)
|
)
|
||||||
|
|
||||||
|
$: icon = componentDefinition?.icon
|
||||||
|
|
||||||
const openDrawer = () => {
|
const openDrawer = () => {
|
||||||
tempValue = runtimeToReadableBinding(
|
tempValue = runtimeToReadableBinding(
|
||||||
bindings,
|
bindings,
|
||||||
|
@ -54,7 +62,19 @@
|
||||||
{#key componentInstance?._id}
|
{#key componentInstance?._id}
|
||||||
<Drawer bind:this={drawer} title="Custom CSS">
|
<Drawer bind:this={drawer} title="Custom CSS">
|
||||||
<svelte:fragment slot="description">
|
<svelte:fragment slot="description">
|
||||||
Custom CSS overrides all other component styles.
|
<div class="header">
|
||||||
|
Your CSS will overwrite styles for:
|
||||||
|
{#if icon}
|
||||||
|
<AbsTooltip type="info" text={iconTooltip}>
|
||||||
|
<Icon
|
||||||
|
color={`var(--spectrum-global-color-gray-600)`}
|
||||||
|
size="S"
|
||||||
|
name={icon}
|
||||||
|
/>
|
||||||
|
</AbsTooltip>
|
||||||
|
<Body size="S"><b>{componentTitle || ""}</b></Body>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
</svelte:fragment>
|
</svelte:fragment>
|
||||||
<Button cta slot="buttons" on:click={save}>Save</Button>
|
<Button cta slot="buttons" on:click={save}>Save</Button>
|
||||||
<svelte:component
|
<svelte:component
|
||||||
|
@ -68,3 +88,13 @@
|
||||||
/>
|
/>
|
||||||
</Drawer>
|
</Drawer>
|
||||||
{/key}
|
{/key}
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.header {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
gap: var(--spacing-m);
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
|
@ -36,14 +36,12 @@
|
||||||
|
|
||||||
// Determine selected component ID
|
// Determine selected component ID
|
||||||
$: selectedComponentId = $store.selectedComponentId
|
$: selectedComponentId = $store.selectedComponentId
|
||||||
$: hoverComponentId = $store.hoverComponentId
|
|
||||||
|
|
||||||
$: previewData = {
|
$: previewData = {
|
||||||
appId: $store.appId,
|
appId: $store.appId,
|
||||||
layout,
|
layout,
|
||||||
screen,
|
screen,
|
||||||
selectedComponentId,
|
selectedComponentId,
|
||||||
hoverComponentId,
|
|
||||||
theme: $store.theme,
|
theme: $store.theme,
|
||||||
customTheme: $store.customTheme,
|
customTheme: $store.customTheme,
|
||||||
previewDevice: $store.previewDevice,
|
previewDevice: $store.previewDevice,
|
||||||
|
@ -119,8 +117,8 @@
|
||||||
error = event.error || "An unknown error occurred"
|
error = event.error || "An unknown error occurred"
|
||||||
} else if (type === "select-component" && data.id) {
|
} else if (type === "select-component" && data.id) {
|
||||||
$store.selectedComponentId = data.id
|
$store.selectedComponentId = data.id
|
||||||
} else if (type === "hover-component" && data.id) {
|
} else if (type === "hover-component") {
|
||||||
$store.hoverComponentId = data.id
|
store.actions.components.hover(data.id, false)
|
||||||
} else if (type === "update-prop") {
|
} else if (type === "update-prop") {
|
||||||
await store.actions.components.updateSetting(data.prop, data.value)
|
await store.actions.components.updateSetting(data.prop, data.value)
|
||||||
} else if (type === "update-styles") {
|
} else if (type === "update-styles") {
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
$: definition = store.actions.components.getDefinition(component?._component)
|
$: definition = store.actions.components.getDefinition(component?._component)
|
||||||
$: noPaste = !$store.componentToPaste
|
$: noPaste = !$store.componentToPaste
|
||||||
$: isBlock = definition?.block === true
|
$: isBlock = definition?.block === true
|
||||||
|
$: canEject = !(definition?.ejectable === false)
|
||||||
|
|
||||||
const keyboardEvent = (key, ctrlKey = false) => {
|
const keyboardEvent = (key, ctrlKey = false) => {
|
||||||
document.dispatchEvent(
|
document.dispatchEvent(
|
||||||
|
@ -32,7 +33,7 @@
|
||||||
>
|
>
|
||||||
Delete
|
Delete
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
{#if isBlock}
|
{#if isBlock && canEject}
|
||||||
<MenuItem
|
<MenuItem
|
||||||
icon="Export"
|
icon="Export"
|
||||||
keyBind="Ctrl+E"
|
keyBind="Ctrl+E"
|
||||||
|
|
|
@ -32,8 +32,15 @@
|
||||||
await store.actions.components.paste(component, "below")
|
await store.actions.components.paste(component, "below")
|
||||||
},
|
},
|
||||||
["Ctrl+e"]: component => {
|
["Ctrl+e"]: component => {
|
||||||
componentToEject = component
|
const definition = store.actions.components.getDefinition(
|
||||||
confirmEjectDialog.show()
|
component._component
|
||||||
|
)
|
||||||
|
const isBlock = definition?.block === true
|
||||||
|
const canEject = !(definition?.ejectable === false)
|
||||||
|
if (isBlock && canEject) {
|
||||||
|
componentToEject = component
|
||||||
|
confirmEjectDialog.show()
|
||||||
|
}
|
||||||
},
|
},
|
||||||
["Ctrl+Enter"]: () => {
|
["Ctrl+Enter"]: () => {
|
||||||
$goto(`./:componentId/new`)
|
$goto(`./:componentId/new`)
|
||||||
|
|
|
@ -90,16 +90,7 @@
|
||||||
return findComponentPath($selectedComponent, component._id)?.length > 0
|
return findComponentPath($selectedComponent, component._id)?.length > 0
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleMouseover = componentId => {
|
const hover = store.actions.components.hover
|
||||||
if ($store.hoverComponentId !== componentId) {
|
|
||||||
$store.hoverComponentId = componentId
|
|
||||||
}
|
|
||||||
}
|
|
||||||
const handleMouseout = componentId => {
|
|
||||||
if ($store.hoverComponentId === componentId) {
|
|
||||||
$store.hoverComponentId = null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
|
@ -120,9 +111,9 @@
|
||||||
on:dragover={dragover(component, index)}
|
on:dragover={dragover(component, index)}
|
||||||
on:iconClick={() => toggleNodeOpen(component._id)}
|
on:iconClick={() => toggleNodeOpen(component._id)}
|
||||||
on:drop={onDrop}
|
on:drop={onDrop}
|
||||||
hovering={$store.hoverComponentId === component._id}
|
hovering={$store.hoveredComponentId === component._id}
|
||||||
on:mouseenter={() => handleMouseover(component._id)}
|
on:mouseenter={() => hover(component._id)}
|
||||||
on:mouseleave={() => handleMouseout(component._id)}
|
on:mouseleave={() => hover(null)}
|
||||||
text={getComponentText(component)}
|
text={getComponentText(component)}
|
||||||
icon={getComponentIcon(component)}
|
icon={getComponentIcon(component)}
|
||||||
iconTooltip={getComponentName(component)}
|
iconTooltip={getComponentName(component)}
|
||||||
|
|
|
@ -12,6 +12,9 @@
|
||||||
|
|
||||||
let scrolling = false
|
let scrolling = false
|
||||||
|
|
||||||
|
$: screenComponentId = `${$store.selectedScreenId}-screen`
|
||||||
|
$: navComponentId = `${$store.selectedScreenId}-navigation`
|
||||||
|
|
||||||
const toNewComponentRoute = () => {
|
const toNewComponentRoute = () => {
|
||||||
if ($isActive(`./:componentId/new`)) {
|
if ($isActive(`./:componentId/new`)) {
|
||||||
$goto(`./:componentId`)
|
$goto(`./:componentId`)
|
||||||
|
@ -33,16 +36,7 @@
|
||||||
scrolling = e.target.scrollTop !== 0
|
scrolling = e.target.scrollTop !== 0
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleMouseover = componentId => {
|
const hover = store.actions.components.hover
|
||||||
if ($store.hoverComponentId !== componentId) {
|
|
||||||
$store.hoverComponentId = componentId
|
|
||||||
}
|
|
||||||
}
|
|
||||||
const handleMouseout = componentId => {
|
|
||||||
if ($store.hoverComponentId === componentId) {
|
|
||||||
$store.hoverComponentId = null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="components">
|
<div class="components">
|
||||||
|
@ -65,46 +59,31 @@
|
||||||
scrollable
|
scrollable
|
||||||
icon="WebPage"
|
icon="WebPage"
|
||||||
on:drop={onDrop}
|
on:drop={onDrop}
|
||||||
on:click={() => {
|
on:click={() => ($store.selectedComponentId = screenComponentId)}
|
||||||
$store.selectedComponentId = `${$store.selectedScreenId}-screen`
|
hovering={$store.hoveredComponentId === screenComponentId}
|
||||||
}}
|
on:mouseenter={() => hover(screenComponentId)}
|
||||||
hovering={$store.hoverComponentId ===
|
on:mouseleave={() => hover(null)}
|
||||||
`${$store.selectedScreenId}-screen`}
|
id="component-screen"
|
||||||
on:mouseenter={() =>
|
selectedBy={$userSelectedResourceMap[screenComponentId]}
|
||||||
handleMouseover(`${$store.selectedScreenId}-screen`)}
|
|
||||||
on:mouseleave={() =>
|
|
||||||
handleMouseout(`${$store.selectedScreenId}-screen`)}
|
|
||||||
id={`component-screen`}
|
|
||||||
selectedBy={$userSelectedResourceMap[
|
|
||||||
`${$store.selectedScreenId}-screen`
|
|
||||||
]}
|
|
||||||
>
|
>
|
||||||
<ScreenslotDropdownMenu component={$selectedScreen?.props} />
|
<ScreenslotDropdownMenu component={$selectedScreen?.props} />
|
||||||
</NavItem>
|
</NavItem>
|
||||||
<NavItem
|
<NavItem
|
||||||
text="Navigation"
|
text="Navigation"
|
||||||
indentLevel={0}
|
indentLevel={0}
|
||||||
selected={$store.selectedComponentId ===
|
selected={$store.selectedComponentId === navComponentId}
|
||||||
`${$store.selectedScreenId}-navigation`}
|
|
||||||
opened
|
opened
|
||||||
scrollable
|
scrollable
|
||||||
icon={$selectedScreen.showNavigation
|
icon={$selectedScreen.showNavigation
|
||||||
? "Visibility"
|
? "Visibility"
|
||||||
: "VisibilityOff"}
|
: "VisibilityOff"}
|
||||||
on:drop={onDrop}
|
on:drop={onDrop}
|
||||||
on:click={() => {
|
on:click={() => ($store.selectedComponentId = navComponentId)}
|
||||||
$store.selectedComponentId = `${$store.selectedScreenId}-navigation`
|
hovering={$store.hoveredComponentId === navComponentId}
|
||||||
}}
|
on:mouseenter={() => hover(navComponentId)}
|
||||||
hovering={$store.hoverComponentId ===
|
on:mouseleave={() => hover(null)}
|
||||||
`${$store.selectedScreenId}-navigation`}
|
id="component-nav"
|
||||||
on:mouseenter={() =>
|
selectedBy={$userSelectedResourceMap[navComponentId]}
|
||||||
handleMouseover(`${$store.selectedScreenId}-navigation`)}
|
|
||||||
on:mouseleave={() =>
|
|
||||||
handleMouseout(`${$store.selectedScreenId}-navigation`)}
|
|
||||||
id={`component-nav`}
|
|
||||||
selectedBy={$userSelectedResourceMap[
|
|
||||||
`${$store.selectedScreenId}-navigation`
|
|
||||||
]}
|
|
||||||
/>
|
/>
|
||||||
<ComponentTree
|
<ComponentTree
|
||||||
level={0}
|
level={0}
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
<script>
|
<script>
|
||||||
import { onMount, onDestroy } from "svelte"
|
import { onMount, onDestroy } from "svelte"
|
||||||
import IndicatorSet from "./IndicatorSet.svelte"
|
import IndicatorSet from "./IndicatorSet.svelte"
|
||||||
import { builderStore, dndIsDragging } from "stores"
|
import { builderStore, dndIsDragging, hoverStore } from "stores"
|
||||||
|
|
||||||
$: componentId = $builderStore.hoverComponentId
|
$: componentId = $hoverStore.hoveredComponentId
|
||||||
$: zIndex = componentId === $builderStore.selectedComponentId ? 900 : 920
|
$: zIndex = componentId === $builderStore.selectedComponentId ? 900 : 920
|
||||||
|
|
||||||
const onMouseOver = e => {
|
const onMouseOver = e => {
|
||||||
|
@ -23,12 +23,12 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
if (newId !== componentId) {
|
if (newId !== componentId) {
|
||||||
builderStore.actions.hoverComponent(newId)
|
hoverStore.actions.hoverComponent(newId)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const onMouseLeave = () => {
|
const onMouseLeave = () => {
|
||||||
builderStore.actions.hoverComponent(null)
|
hoverStore.actions.hoverComponent(null)
|
||||||
}
|
}
|
||||||
|
|
||||||
onMount(() => {
|
onMount(() => {
|
||||||
|
|
|
@ -8,6 +8,7 @@ import {
|
||||||
environmentStore,
|
environmentStore,
|
||||||
dndStore,
|
dndStore,
|
||||||
eventStore,
|
eventStore,
|
||||||
|
hoverStore,
|
||||||
} from "./stores"
|
} from "./stores"
|
||||||
import loadSpectrumIcons from "@budibase/bbui/spectrum-icons-rollup.js"
|
import loadSpectrumIcons from "@budibase/bbui/spectrum-icons-rollup.js"
|
||||||
import { get } from "svelte/store"
|
import { get } from "svelte/store"
|
||||||
|
@ -33,7 +34,6 @@ const loadBudibase = async () => {
|
||||||
layout: window["##BUDIBASE_PREVIEW_LAYOUT##"],
|
layout: window["##BUDIBASE_PREVIEW_LAYOUT##"],
|
||||||
screen: window["##BUDIBASE_PREVIEW_SCREEN##"],
|
screen: window["##BUDIBASE_PREVIEW_SCREEN##"],
|
||||||
selectedComponentId: window["##BUDIBASE_SELECTED_COMPONENT_ID##"],
|
selectedComponentId: window["##BUDIBASE_SELECTED_COMPONENT_ID##"],
|
||||||
hoverComponentId: window["##BUDIBASE_HOVER_COMPONENT_ID##"],
|
|
||||||
previewId: window["##BUDIBASE_PREVIEW_ID##"],
|
previewId: window["##BUDIBASE_PREVIEW_ID##"],
|
||||||
theme: window["##BUDIBASE_PREVIEW_THEME##"],
|
theme: window["##BUDIBASE_PREVIEW_THEME##"],
|
||||||
customTheme: window["##BUDIBASE_PREVIEW_CUSTOM_THEME##"],
|
customTheme: window["##BUDIBASE_PREVIEW_CUSTOM_THEME##"],
|
||||||
|
@ -84,6 +84,8 @@ const loadBudibase = async () => {
|
||||||
} else {
|
} else {
|
||||||
dndStore.actions.reset()
|
dndStore.actions.reset()
|
||||||
}
|
}
|
||||||
|
} else if (type === "hover-component") {
|
||||||
|
hoverStore.actions.hoverComponent(data)
|
||||||
} else if (type === "builder-meta") {
|
} else if (type === "builder-meta") {
|
||||||
builderStore.actions.setMetadata(data)
|
builderStore.actions.setMetadata(data)
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,6 @@ const createBuilderStore = () => {
|
||||||
inBuilder: false,
|
inBuilder: false,
|
||||||
screen: null,
|
screen: null,
|
||||||
selectedComponentId: null,
|
selectedComponentId: null,
|
||||||
hoverComponentId: null,
|
|
||||||
editMode: false,
|
editMode: false,
|
||||||
previewId: null,
|
previewId: null,
|
||||||
theme: null,
|
theme: null,
|
||||||
|
@ -25,16 +24,6 @@ const createBuilderStore = () => {
|
||||||
}
|
}
|
||||||
const store = writable(initialState)
|
const store = writable(initialState)
|
||||||
const actions = {
|
const actions = {
|
||||||
hoverComponent: id => {
|
|
||||||
if (id === get(store).hoverComponentId) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
store.update(state => ({
|
|
||||||
...state,
|
|
||||||
hoverComponentId: id,
|
|
||||||
}))
|
|
||||||
eventStore.actions.dispatchEvent("hover-component", { id })
|
|
||||||
},
|
|
||||||
selectComponent: id => {
|
selectComponent: id => {
|
||||||
if (id === get(store).selectedComponentId) {
|
if (id === get(store).selectedComponentId) {
|
||||||
return
|
return
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
import { get, writable } from "svelte/store"
|
||||||
|
import { eventStore } from "./events.js"
|
||||||
|
|
||||||
|
const createHoverStore = () => {
|
||||||
|
const store = writable({
|
||||||
|
hoveredComponentId: null,
|
||||||
|
})
|
||||||
|
|
||||||
|
const hoverComponent = id => {
|
||||||
|
if (id === get(store).hoveredComponentId) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
store.set({ hoveredComponentId: id })
|
||||||
|
eventStore.actions.dispatchEvent("hover-component", { id })
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
...store,
|
||||||
|
actions: {
|
||||||
|
hoverComponent,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export const hoverStore = createHoverStore()
|
|
@ -27,6 +27,7 @@ export {
|
||||||
dndIsDragging,
|
dndIsDragging,
|
||||||
} from "./dnd"
|
} from "./dnd"
|
||||||
export { sidePanelStore } from "./sidePanel"
|
export { sidePanelStore } from "./sidePanel"
|
||||||
|
export { hoverStore } from "./hover"
|
||||||
|
|
||||||
// Context stores are layered and duplicated, so it is not a singleton
|
// Context stores are layered and duplicated, so it is not a singleton
|
||||||
export { createContextStore } from "./context"
|
export { createContextStore } from "./context"
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit b1c10c2daf808d103724c324256cbff67f33fb46
|
Subproject commit 8c466d6ef2a0c09b843ef63276793ab5af2e96f7
|
|
@ -63,7 +63,6 @@
|
||||||
// Extract data from message
|
// Extract data from message
|
||||||
const {
|
const {
|
||||||
selectedComponentId,
|
selectedComponentId,
|
||||||
hoverComponentId,
|
|
||||||
layout,
|
layout,
|
||||||
screen,
|
screen,
|
||||||
appId,
|
appId,
|
||||||
|
@ -82,7 +81,6 @@
|
||||||
window["##BUDIBASE_PREVIEW_LAYOUT##"] = layout
|
window["##BUDIBASE_PREVIEW_LAYOUT##"] = layout
|
||||||
window["##BUDIBASE_PREVIEW_SCREEN##"] = screen
|
window["##BUDIBASE_PREVIEW_SCREEN##"] = screen
|
||||||
window["##BUDIBASE_SELECTED_COMPONENT_ID##"] = selectedComponentId
|
window["##BUDIBASE_SELECTED_COMPONENT_ID##"] = selectedComponentId
|
||||||
window["##BUDIBASE_HOVER_COMPONENT_ID##"] = hoverComponentId
|
|
||||||
window["##BUDIBASE_PREVIEW_ID##"] = Math.random()
|
window["##BUDIBASE_PREVIEW_ID##"] = Math.random()
|
||||||
window["##BUDIBASE_PREVIEW_THEME##"] = theme
|
window["##BUDIBASE_PREVIEW_THEME##"] = theme
|
||||||
window["##BUDIBASE_PREVIEW_CUSTOM_THEME##"] = customTheme
|
window["##BUDIBASE_PREVIEW_CUSTOM_THEME##"] = customTheme
|
||||||
|
|
|
@ -149,8 +149,6 @@ class PostgresIntegration extends Sql implements DatasourcePlus {
|
||||||
private index: number = 1
|
private index: number = 1
|
||||||
private open: boolean
|
private open: boolean
|
||||||
|
|
||||||
COLUMNS_SQL!: string
|
|
||||||
|
|
||||||
PRIMARY_KEYS_SQL = () => `
|
PRIMARY_KEYS_SQL = () => `
|
||||||
SELECT pg_namespace.nspname table_schema
|
SELECT pg_namespace.nspname table_schema
|
||||||
, pg_class.relname table_name
|
, pg_class.relname table_name
|
||||||
|
@ -171,6 +169,11 @@ class PostgresIntegration extends Sql implements DatasourcePlus {
|
||||||
JOIN pg_catalog.pg_namespace n ON n.oid = t.typnamespace;
|
JOIN pg_catalog.pg_namespace n ON n.oid = t.typnamespace;
|
||||||
`
|
`
|
||||||
|
|
||||||
|
COLUMNS_SQL = () => `
|
||||||
|
select * from information_schema.columns where table_schema = ANY(current_schemas(false))
|
||||||
|
AND pg_table_is_visible(to_regclass(format('%I.%I', table_schema, table_name)));
|
||||||
|
`
|
||||||
|
|
||||||
constructor(config: PostgresConfig) {
|
constructor(config: PostgresConfig) {
|
||||||
super(SqlClient.POSTGRES)
|
super(SqlClient.POSTGRES)
|
||||||
this.config = config
|
this.config = config
|
||||||
|
@ -224,8 +227,6 @@ class PostgresIntegration extends Sql implements DatasourcePlus {
|
||||||
.split(",")
|
.split(",")
|
||||||
.map(item => `"${item.trim()}"`)
|
.map(item => `"${item.trim()}"`)
|
||||||
await this.client.query(`SET search_path TO ${search_path.join(",")};`)
|
await this.client.query(`SET search_path TO ${search_path.join(",")};`)
|
||||||
this.COLUMNS_SQL = `select * from information_schema.columns where table_schema = ANY(current_schemas(false))
|
|
||||||
AND pg_table_is_visible(to_regclass(table_schema || '.' || table_name));`
|
|
||||||
this.open = true
|
this.open = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -312,7 +313,7 @@ class PostgresIntegration extends Sql implements DatasourcePlus {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const columnsResponse: { rows: PostgresColumn[] } =
|
const columnsResponse: { rows: PostgresColumn[] } =
|
||||||
await this.client.query(this.COLUMNS_SQL)
|
await this.client.query(this.COLUMNS_SQL())
|
||||||
|
|
||||||
const tables: { [key: string]: Table } = {}
|
const tables: { [key: string]: Table } = {}
|
||||||
|
|
||||||
|
@ -382,7 +383,7 @@ class PostgresIntegration extends Sql implements DatasourcePlus {
|
||||||
try {
|
try {
|
||||||
await this.openConnection()
|
await this.openConnection()
|
||||||
const columnsResponse: { rows: PostgresColumn[] } =
|
const columnsResponse: { rows: PostgresColumn[] } =
|
||||||
await this.client.query(this.COLUMNS_SQL)
|
await this.client.query(this.COLUMNS_SQL())
|
||||||
const names = columnsResponse.rows.map(row => row.table_name)
|
const names = columnsResponse.rows.map(row => row.table_name)
|
||||||
return [...new Set(names)]
|
return [...new Set(names)]
|
||||||
} finally {
|
} finally {
|
||||||
|
|
|
@ -12,51 +12,49 @@ export function init() {
|
||||||
const perRequestLimit = env.JS_PER_REQUEST_TIME_LIMIT_MS
|
const perRequestLimit = env.JS_PER_REQUEST_TIME_LIMIT_MS
|
||||||
let track: TrackerFn = f => f()
|
let track: TrackerFn = f => f()
|
||||||
if (perRequestLimit) {
|
if (perRequestLimit) {
|
||||||
tracer.trace<any>("runJS.setupTracker", {}, span => {
|
const bbCtx = tracer.trace("runJS.getCurrentContext", {}, span =>
|
||||||
const bbCtx = context.getCurrentContext()
|
context.getCurrentContext()
|
||||||
if (bbCtx) {
|
)
|
||||||
if (!bbCtx.jsExecutionTracker) {
|
if (bbCtx) {
|
||||||
span?.addTags({
|
if (!bbCtx.jsExecutionTracker) {
|
||||||
createdExecutionTracker: true,
|
|
||||||
})
|
|
||||||
bbCtx.jsExecutionTracker =
|
|
||||||
timers.ExecutionTimeTracker.withLimit(perRequestLimit)
|
|
||||||
}
|
|
||||||
span?.addTags({
|
span?.addTags({
|
||||||
js: {
|
createdExecutionTracker: true,
|
||||||
limitMS: bbCtx.jsExecutionTracker.limitMs,
|
|
||||||
elapsedMS: bbCtx.jsExecutionTracker.elapsedMS,
|
|
||||||
},
|
|
||||||
})
|
})
|
||||||
// We call checkLimit() here to prevent paying the cost of creating
|
bbCtx.jsExecutionTracker = tracer.trace(
|
||||||
// a new VM context below when we don't need to.
|
"runJS.createExecutionTimeTracker",
|
||||||
bbCtx.jsExecutionTracker.checkLimit()
|
{},
|
||||||
track = bbCtx.jsExecutionTracker.track.bind(
|
span => timers.ExecutionTimeTracker.withLimit(perRequestLimit)
|
||||||
bbCtx.jsExecutionTracker
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
})
|
span?.addTags({
|
||||||
|
js: {
|
||||||
|
limitMS: bbCtx.jsExecutionTracker.limitMs,
|
||||||
|
elapsedMS: bbCtx.jsExecutionTracker.elapsedMS,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
// We call checkLimit() here to prevent paying the cost of creating
|
||||||
|
// a new VM context below when we don't need to.
|
||||||
|
tracer.trace("runJS.checkLimitAndBind", {}, span => {
|
||||||
|
bbCtx.jsExecutionTracker!.checkLimit()
|
||||||
|
track = bbCtx.jsExecutionTracker!.track.bind(
|
||||||
|
bbCtx.jsExecutionTracker
|
||||||
|
)
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx = tracer.trace("runJS.ctxClone", {}, span => {
|
ctx = {
|
||||||
return {
|
...ctx,
|
||||||
...ctx,
|
alert: undefined,
|
||||||
alert: undefined,
|
setInterval: undefined,
|
||||||
setInterval: undefined,
|
setTimeout: undefined,
|
||||||
setTimeout: undefined,
|
}
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
tracer.trace("runJS.vm.createContext", {}, span => {
|
|
||||||
vm.createContext(ctx)
|
|
||||||
})
|
|
||||||
|
|
||||||
|
vm.createContext(ctx)
|
||||||
return track(() =>
|
return track(() =>
|
||||||
tracer.trace("runJS.vm.runInNewContext", {}, span =>
|
vm.runInNewContext(js, ctx, {
|
||||||
vm.runInNewContext(js, ctx, {
|
timeout: env.JS_PER_EXECUTION_TIME_LIMIT_MS,
|
||||||
timeout: env.JS_PER_EXECUTION_TIME_LIMIT_MS,
|
})
|
||||||
})
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
|
@ -39,10 +39,10 @@ describe("license management", () => {
|
||||||
let premiumPriceId = null
|
let premiumPriceId = null
|
||||||
let businessPriceId = ""
|
let businessPriceId = ""
|
||||||
for (const plan of planBody) {
|
for (const plan of planBody) {
|
||||||
if (plan.type === PlanType.PREMIUM) {
|
if (plan.type === PlanType.PREMIUM_PLUS) {
|
||||||
premiumPriceId = plan.prices[0].priceId
|
premiumPriceId = plan.prices[0].priceId
|
||||||
}
|
}
|
||||||
if (plan.type === PlanType.BUSINESS) {
|
if (plan.type === PlanType.ENTERPRISE_BASIC) {
|
||||||
businessPriceId = plan.prices[0].priceId
|
businessPriceId = plan.prices[0].priceId
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -97,7 +97,7 @@ describe("license management", () => {
|
||||||
await config.loginAsAccount(createAccountRequest)
|
await config.loginAsAccount(createAccountRequest)
|
||||||
await config.api.stripe.linkStripeCustomer(account.accountId, customer.id)
|
await config.api.stripe.linkStripeCustomer(account.accountId, customer.id)
|
||||||
const [_, selfBodyPremium] = await config.api.accounts.self()
|
const [_, selfBodyPremium] = await config.api.accounts.self()
|
||||||
expect(selfBodyPremium.license.plan.type).toBe(PlanType.PREMIUM)
|
expect(selfBodyPremium.license.plan.type).toBe(PlanType.PREMIUM_PLUS)
|
||||||
|
|
||||||
// Create portal session - Check URL
|
// Create portal session - Check URL
|
||||||
const [portalRes, portalSessionBody] =
|
const [portalRes, portalSessionBody] =
|
||||||
|
@ -109,7 +109,7 @@ describe("license management", () => {
|
||||||
|
|
||||||
// License updated to Business
|
// License updated to Business
|
||||||
const [selfRes, selfBodyBusiness] = await config.api.accounts.self()
|
const [selfRes, selfBodyBusiness] = await config.api.accounts.self()
|
||||||
expect(selfBodyBusiness.license.plan.type).toBe(PlanType.BUSINESS)
|
expect(selfBodyBusiness.license.plan.type).toBe(PlanType.ENTERPRISE_BASIC)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue