@@ -65,46 +59,31 @@
scrollable
icon="WebPage"
on:drop={onDrop}
- on:click={() => {
- $store.selectedComponentId = `${$store.selectedScreenId}-screen`
- }}
- hovering={$store.hoverComponentId ===
- `${$store.selectedScreenId}-screen`}
- on:mouseenter={() =>
- handleMouseover(`${$store.selectedScreenId}-screen`)}
- on:mouseleave={() =>
- handleMouseout(`${$store.selectedScreenId}-screen`)}
- id={`component-screen`}
- selectedBy={$userSelectedResourceMap[
- `${$store.selectedScreenId}-screen`
- ]}
+ on:click={() => ($store.selectedComponentId = screenComponentId)}
+ hovering={$store.hoveredComponentId === screenComponentId}
+ on:mouseenter={() => hover(screenComponentId)}
+ on:mouseleave={() => hover(null)}
+ id="component-screen"
+ selectedBy={$userSelectedResourceMap[screenComponentId]}
>
{
- $store.selectedComponentId = `${$store.selectedScreenId}-navigation`
- }}
- hovering={$store.hoverComponentId ===
- `${$store.selectedScreenId}-navigation`}
- on:mouseenter={() =>
- handleMouseover(`${$store.selectedScreenId}-navigation`)}
- on:mouseleave={() =>
- handleMouseout(`${$store.selectedScreenId}-navigation`)}
- id={`component-nav`}
- selectedBy={$userSelectedResourceMap[
- `${$store.selectedScreenId}-navigation`
- ]}
+ on:click={() => ($store.selectedComponentId = navComponentId)}
+ hovering={$store.hoveredComponentId === navComponentId}
+ on:mouseenter={() => hover(navComponentId)}
+ on:mouseleave={() => hover(null)}
+ id="component-nav"
+ selectedBy={$userSelectedResourceMap[navComponentId]}
/>
import { onMount, onDestroy } from "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
const onMouseOver = e => {
@@ -23,12 +23,12 @@
}
if (newId !== componentId) {
- builderStore.actions.hoverComponent(newId)
+ hoverStore.actions.hoverComponent(newId)
}
}
const onMouseLeave = () => {
- builderStore.actions.hoverComponent(null)
+ hoverStore.actions.hoverComponent(null)
}
onMount(() => {
diff --git a/packages/client/src/index.js b/packages/client/src/index.js
index f6ed23b2a9..2c8d310619 100644
--- a/packages/client/src/index.js
+++ b/packages/client/src/index.js
@@ -8,6 +8,7 @@ import {
environmentStore,
dndStore,
eventStore,
+ hoverStore,
} from "./stores"
import loadSpectrumIcons from "@budibase/bbui/spectrum-icons-rollup.js"
import { get } from "svelte/store"
@@ -33,7 +34,6 @@ const loadBudibase = async () => {
layout: window["##BUDIBASE_PREVIEW_LAYOUT##"],
screen: window["##BUDIBASE_PREVIEW_SCREEN##"],
selectedComponentId: window["##BUDIBASE_SELECTED_COMPONENT_ID##"],
- hoverComponentId: window["##BUDIBASE_HOVER_COMPONENT_ID##"],
previewId: window["##BUDIBASE_PREVIEW_ID##"],
theme: window["##BUDIBASE_PREVIEW_THEME##"],
customTheme: window["##BUDIBASE_PREVIEW_CUSTOM_THEME##"],
@@ -84,6 +84,8 @@ const loadBudibase = async () => {
} else {
dndStore.actions.reset()
}
+ } else if (type === "hover-component") {
+ hoverStore.actions.hoverComponent(data)
} else if (type === "builder-meta") {
builderStore.actions.setMetadata(data)
}
diff --git a/packages/client/src/stores/builder.js b/packages/client/src/stores/builder.js
index 4a9eaa8d2f..2e745885b5 100644
--- a/packages/client/src/stores/builder.js
+++ b/packages/client/src/stores/builder.js
@@ -8,7 +8,6 @@ const createBuilderStore = () => {
inBuilder: false,
screen: null,
selectedComponentId: null,
- hoverComponentId: null,
editMode: false,
previewId: null,
theme: null,
@@ -25,16 +24,6 @@ const createBuilderStore = () => {
}
const store = writable(initialState)
const actions = {
- hoverComponent: id => {
- if (id === get(store).hoverComponentId) {
- return
- }
- store.update(state => ({
- ...state,
- hoverComponentId: id,
- }))
- eventStore.actions.dispatchEvent("hover-component", { id })
- },
selectComponent: id => {
if (id === get(store).selectedComponentId) {
return
diff --git a/packages/client/src/stores/hover.js b/packages/client/src/stores/hover.js
new file mode 100644
index 0000000000..24f315a126
--- /dev/null
+++ b/packages/client/src/stores/hover.js
@@ -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()
diff --git a/packages/client/src/stores/index.js b/packages/client/src/stores/index.js
index 1b1b9d46bc..60034553c7 100644
--- a/packages/client/src/stores/index.js
+++ b/packages/client/src/stores/index.js
@@ -27,6 +27,7 @@ export {
dndIsDragging,
} from "./dnd"
export { sidePanelStore } from "./sidePanel"
+export { hoverStore } from "./hover"
// Context stores are layered and duplicated, so it is not a singleton
export { createContextStore } from "./context"
diff --git a/packages/pro b/packages/pro
index b1c10c2daf..8c466d6ef2 160000
--- a/packages/pro
+++ b/packages/pro
@@ -1 +1 @@
-Subproject commit b1c10c2daf808d103724c324256cbff67f33fb46
+Subproject commit 8c466d6ef2a0c09b843ef63276793ab5af2e96f7
diff --git a/packages/server/src/api/controllers/static/templates/preview.hbs b/packages/server/src/api/controllers/static/templates/preview.hbs
index e5b97afd66..63c61baa9f 100644
--- a/packages/server/src/api/controllers/static/templates/preview.hbs
+++ b/packages/server/src/api/controllers/static/templates/preview.hbs
@@ -63,7 +63,6 @@
// Extract data from message
const {
selectedComponentId,
- hoverComponentId,
layout,
screen,
appId,
@@ -82,7 +81,6 @@
window["##BUDIBASE_PREVIEW_LAYOUT##"] = layout
window["##BUDIBASE_PREVIEW_SCREEN##"] = screen
window["##BUDIBASE_SELECTED_COMPONENT_ID##"] = selectedComponentId
- window["##BUDIBASE_HOVER_COMPONENT_ID##"] = hoverComponentId
window["##BUDIBASE_PREVIEW_ID##"] = Math.random()
window["##BUDIBASE_PREVIEW_THEME##"] = theme
window["##BUDIBASE_PREVIEW_CUSTOM_THEME##"] = customTheme
diff --git a/packages/server/src/integrations/postgres.ts b/packages/server/src/integrations/postgres.ts
index ddc6e82f6d..78955c06dc 100644
--- a/packages/server/src/integrations/postgres.ts
+++ b/packages/server/src/integrations/postgres.ts
@@ -149,8 +149,6 @@ class PostgresIntegration extends Sql implements DatasourcePlus {
private index: number = 1
private open: boolean
- COLUMNS_SQL!: string
-
PRIMARY_KEYS_SQL = () => `
SELECT pg_namespace.nspname table_schema
, 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;
`
+ 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) {
super(SqlClient.POSTGRES)
this.config = config
@@ -224,8 +227,6 @@ class PostgresIntegration extends Sql implements DatasourcePlus {
.split(",")
.map(item => `"${item.trim()}"`)
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
}
@@ -312,7 +313,7 @@ class PostgresIntegration extends Sql implements DatasourcePlus {
try {
const columnsResponse: { rows: PostgresColumn[] } =
- await this.client.query(this.COLUMNS_SQL)
+ await this.client.query(this.COLUMNS_SQL())
const tables: { [key: string]: Table } = {}
@@ -382,7 +383,7 @@ class PostgresIntegration extends Sql implements DatasourcePlus {
try {
await this.openConnection()
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)
return [...new Set(names)]
} finally {
diff --git a/packages/server/src/jsRunner.ts b/packages/server/src/jsRunner.ts
index 6fde3ab82a..9594ffaf65 100644
--- a/packages/server/src/jsRunner.ts
+++ b/packages/server/src/jsRunner.ts
@@ -12,51 +12,49 @@ export function init() {
const perRequestLimit = env.JS_PER_REQUEST_TIME_LIMIT_MS
let track: TrackerFn = f => f()
if (perRequestLimit) {
- tracer.trace("runJS.setupTracker", {}, span => {
- const bbCtx = context.getCurrentContext()
- if (bbCtx) {
- if (!bbCtx.jsExecutionTracker) {
- span?.addTags({
- createdExecutionTracker: true,
- })
- bbCtx.jsExecutionTracker =
- timers.ExecutionTimeTracker.withLimit(perRequestLimit)
- }
+ const bbCtx = tracer.trace("runJS.getCurrentContext", {}, span =>
+ context.getCurrentContext()
+ )
+ if (bbCtx) {
+ if (!bbCtx.jsExecutionTracker) {
span?.addTags({
- js: {
- limitMS: bbCtx.jsExecutionTracker.limitMs,
- elapsedMS: bbCtx.jsExecutionTracker.elapsedMS,
- },
+ createdExecutionTracker: true,
})
- // We call checkLimit() here to prevent paying the cost of creating
- // a new VM context below when we don't need to.
- bbCtx.jsExecutionTracker.checkLimit()
- track = bbCtx.jsExecutionTracker.track.bind(
- bbCtx.jsExecutionTracker
+ bbCtx.jsExecutionTracker = tracer.trace(
+ "runJS.createExecutionTimeTracker",
+ {},
+ span => timers.ExecutionTimeTracker.withLimit(perRequestLimit)
)
}
- })
+ 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 => {
- return {
- ...ctx,
- alert: undefined,
- setInterval: undefined,
- setTimeout: undefined,
- }
- })
-
- tracer.trace("runJS.vm.createContext", {}, span => {
- vm.createContext(ctx)
- })
+ ctx = {
+ ...ctx,
+ alert: undefined,
+ setInterval: undefined,
+ setTimeout: undefined,
+ }
+ vm.createContext(ctx)
return track(() =>
- tracer.trace("runJS.vm.runInNewContext", {}, span =>
- vm.runInNewContext(js, ctx, {
- timeout: env.JS_PER_EXECUTION_TIME_LIMIT_MS,
- })
- )
+ vm.runInNewContext(js, ctx, {
+ timeout: env.JS_PER_EXECUTION_TIME_LIMIT_MS,
+ })
)
})
})
diff --git a/qa-core/src/account-api/tests/licensing/license.manage.spec.ts b/qa-core/src/account-api/tests/licensing/license.manage.spec.ts
index bda0476c2b..9a8662ea3b 100644
--- a/qa-core/src/account-api/tests/licensing/license.manage.spec.ts
+++ b/qa-core/src/account-api/tests/licensing/license.manage.spec.ts
@@ -39,10 +39,10 @@ describe("license management", () => {
let premiumPriceId = null
let businessPriceId = ""
for (const plan of planBody) {
- if (plan.type === PlanType.PREMIUM) {
+ if (plan.type === PlanType.PREMIUM_PLUS) {
premiumPriceId = plan.prices[0].priceId
}
- if (plan.type === PlanType.BUSINESS) {
+ if (plan.type === PlanType.ENTERPRISE_BASIC) {
businessPriceId = plan.prices[0].priceId
}
}
@@ -97,7 +97,7 @@ describe("license management", () => {
await config.loginAsAccount(createAccountRequest)
await config.api.stripe.linkStripeCustomer(account.accountId, customer.id)
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
const [portalRes, portalSessionBody] =
@@ -109,7 +109,7 @@ describe("license management", () => {
// License updated to Business
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)
})
})
})