toggleNodeOpen(component._id)}
- on:drop={dragDropStore.actions.drop}
+ on:drop={onDrop}
text={getComponentText(component)}
withArrow
indentLevel={level + 1}
@@ -105,7 +114,7 @@
{#if $dragDropStore?.targetComponent === component && ($dragDropStore.dropPosition === DropPosition.INSIDE || $dragDropStore.dropPosition === DropPosition.BELOW)}
{
try {
await store.actions.layouts.delete(layout)
- notifications.success(`Layout ${layout.name} deleted successfully.`)
+ notifications.success("Layout deleted successfully")
} catch (err) {
- notifications.error(`Error deleting layout: ${err.message}`)
+ notifications.error("Error deleting layout")
}
}
@@ -32,9 +32,9 @@
const layoutToSave = cloneDeep(layout)
layoutToSave.name = name
await store.actions.layouts.save(layoutToSave)
- notifications.success(`Layout saved successfully.`)
+ notifications.success("Layout saved successfully")
} catch (err) {
- notifications.error(`Error saving layout: ${err.message}`)
+ notifications.error("Error saving layout")
}
}
diff --git a/packages/builder/src/components/design/NavigationPanel/ComponentNavigationTree/ScreenDropdownMenu.svelte b/packages/builder/src/components/design/NavigationPanel/ComponentNavigationTree/ScreenDropdownMenu.svelte
index b2161e35d7..38ed79649e 100644
--- a/packages/builder/src/components/design/NavigationPanel/ComponentNavigationTree/ScreenDropdownMenu.svelte
+++ b/packages/builder/src/components/design/NavigationPanel/ComponentNavigationTree/ScreenDropdownMenu.svelte
@@ -13,7 +13,6 @@
const deleteScreen = async () => {
try {
await store.actions.screens.delete(screen)
- await store.actions.routing.fetch()
$goto("../")
notifications.success("Deleted screen successfully.")
} catch (err) {
diff --git a/packages/builder/src/components/design/NavigationPanel/ComponentNavigationTree/dragDropStore.js b/packages/builder/src/components/design/NavigationPanel/ComponentNavigationTree/dragDropStore.js
index aa5cd230e7..d965a2456d 100644
--- a/packages/builder/src/components/design/NavigationPanel/ComponentNavigationTree/dragDropStore.js
+++ b/packages/builder/src/components/design/NavigationPanel/ComponentNavigationTree/dragDropStore.js
@@ -72,7 +72,7 @@ export default function () {
return state
})
},
- drop: () => {
+ drop: async () => {
const state = get(store)
// Stop if the target and source are the same
@@ -92,7 +92,7 @@ export default function () {
// Cut and paste the component
frontendStore.actions.components.copy(state.dragged, true)
- frontendStore.actions.components.paste(
+ await frontendStore.actions.components.paste(
state.targetComponent,
state.dropPosition
)
diff --git a/packages/builder/src/components/design/NavigationPanel/FrontendNavigatePane.svelte b/packages/builder/src/components/design/NavigationPanel/FrontendNavigatePane.svelte
index ea9ebbf2c5..a5045d8e9f 100644
--- a/packages/builder/src/components/design/NavigationPanel/FrontendNavigatePane.svelte
+++ b/packages/builder/src/components/design/NavigationPanel/FrontendNavigatePane.svelte
@@ -11,7 +11,15 @@
import ComponentNavigationTree from "components/design/NavigationPanel/ComponentNavigationTree/index.svelte"
import Layout from "components/design/NavigationPanel/Layout.svelte"
import NewLayoutModal from "components/design/NavigationPanel/NewLayoutModal.svelte"
- import { Icon, Modal, Select, Search, Tabs, Tab } from "@budibase/bbui"
+ import {
+ Icon,
+ Modal,
+ Select,
+ Search,
+ Tabs,
+ Tab,
+ notifications,
+ } from "@budibase/bbui"
export let showModal
@@ -58,8 +66,12 @@
selectedAccessRole.set(role)
}
- onMount(() => {
- store.actions.routing.fetch()
+ onMount(async () => {
+ try {
+ await store.actions.routing.fetch()
+ } catch (error) {
+ notifications.error("Error fetching routes")
+ }
})
diff --git a/packages/builder/src/components/design/NavigationPanel/NewLayoutModal.svelte b/packages/builder/src/components/design/NavigationPanel/NewLayoutModal.svelte
index 0ed9014eac..d7288fbe23 100644
--- a/packages/builder/src/components/design/NavigationPanel/NewLayoutModal.svelte
+++ b/packages/builder/src/components/design/NavigationPanel/NewLayoutModal.svelte
@@ -9,8 +9,8 @@
try {
await store.actions.layouts.save({ name })
notifications.success(`Layout ${name} created successfully`)
- } catch (err) {
- notifications.error(`Error creating layout ${name}.`)
+ } catch (error) {
+ notifications.error("Error creating layout")
}
}
diff --git a/packages/builder/src/components/design/NavigationPanel/ScreenWizard.svelte b/packages/builder/src/components/design/NavigationPanel/ScreenWizard.svelte
index 99dbcb6026..a9fea4a45b 100644
--- a/packages/builder/src/components/design/NavigationPanel/ScreenWizard.svelte
+++ b/packages/builder/src/components/design/NavigationPanel/ScreenWizard.svelte
@@ -2,7 +2,7 @@
import ScreenDetailsModal from "components/design/NavigationPanel/ScreenDetailsModal.svelte"
import NewScreenModal from "components/design/NavigationPanel/NewScreenModal.svelte"
import sanitizeUrl from "builderStore/store/screenTemplates/utils/sanitizeUrl"
- import { Modal } from "@budibase/bbui"
+ import { Modal, notifications } from "@budibase/bbui"
import { store, selectedAccessRole, allScreens } from "builderStore"
import analytics, { Events } from "analytics"
@@ -29,15 +29,19 @@
const save = async () => {
showProgressCircle = true
- await createScreens()
- for (let screen of createdScreens) {
- await saveScreens(screen)
+ try {
+ await createScreens()
+ for (let screen of createdScreens) {
+ await saveScreens(screen)
+ }
+ await store.actions.routing.fetch()
+ selectedScreens = []
+ createdScreens = []
+ screenName = ""
+ url = ""
+ } catch (error) {
+ notifications.error("Error creating screens")
}
- await store.actions.routing.fetch()
- selectedScreens = []
- createdScreens = []
- screenName = ""
- url = ""
showProgressCircle = false
}
@@ -71,12 +75,16 @@
draftScreen.routing.route = route
- await store.actions.screens.create(draftScreen)
+ await store.actions.screens.save(draftScreen)
if (draftScreen.props._instanceName.endsWith("List")) {
- await store.actions.components.links.save(
- draftScreen.routing.route,
- draftScreen.routing.route.split("/")[1]
- )
+ try {
+ await store.actions.components.links.save(
+ draftScreen.routing.route,
+ draftScreen.routing.route.split("/")[1]
+ )
+ } catch (error) {
+ notifications.error("Error creating link to screen")
+ }
}
}
}
diff --git a/packages/builder/src/components/design/PropertiesPanel/ComponentSettingsSection.svelte b/packages/builder/src/components/design/PropertiesPanel/ComponentSettingsSection.svelte
index 47df3dbf74..f9fa56f739 100644
--- a/packages/builder/src/components/design/PropertiesPanel/ComponentSettingsSection.svelte
+++ b/packages/builder/src/components/design/PropertiesPanel/ComponentSettingsSection.svelte
@@ -1,6 +1,6 @@
diff --git a/packages/builder/src/components/design/PropertiesPanel/CustomStylesSection.svelte b/packages/builder/src/components/design/PropertiesPanel/CustomStylesSection.svelte
index 4ff10c64c7..187d9ff760 100644
--- a/packages/builder/src/components/design/PropertiesPanel/CustomStylesSection.svelte
+++ b/packages/builder/src/components/design/PropertiesPanel/CustomStylesSection.svelte
@@ -8,6 +8,7 @@
Layout,
Body,
Button,
+ notifications,
} from "@budibase/bbui"
import { store } from "builderStore"
@@ -21,8 +22,12 @@
drawer.show()
}
- const save = () => {
- store.actions.components.updateCustomStyle(tempValue)
+ const save = async () => {
+ try {
+ await store.actions.components.updateCustomStyle(tempValue)
+ } catch (error) {
+ notifications.error("Error updating custom style")
+ }
drawer.hide()
}
diff --git a/packages/builder/src/components/design/PropertiesPanel/PropertyControls/ButtonActionEditor/ButtonActionEditor.svelte b/packages/builder/src/components/design/PropertiesPanel/PropertyControls/ButtonActionEditor/ButtonActionEditor.svelte
index 840efca8eb..6a0e94cd4c 100644
--- a/packages/builder/src/components/design/PropertiesPanel/PropertyControls/ButtonActionEditor/ButtonActionEditor.svelte
+++ b/packages/builder/src/components/design/PropertiesPanel/PropertyControls/ButtonActionEditor/ButtonActionEditor.svelte
@@ -36,28 +36,37 @@
// called by the parent modal when actions are saved
const createAutomation = async parameters => {
- if (parameters.automationId || !parameters.newAutomationName) return
- await automationStore.actions.create({ name: parameters.newAutomationName })
- const appActionDefinition = $automationStore.blockDefinitions.TRIGGER.APP
- const newBlock = $automationStore.selectedAutomation.constructBlock(
- "TRIGGER",
- "APP",
- appActionDefinition
- )
-
- newBlock.inputs = {
- fields: Object.keys(parameters.fields).reduce((fields, key) => {
- fields[key] = "string"
- return fields
- }, {}),
+ if (parameters.automationId || !parameters.newAutomationName) {
+ return
}
+ try {
+ await automationStore.actions.create({
+ name: parameters.newAutomationName,
+ })
+ const appActionDefinition = $automationStore.blockDefinitions.TRIGGER.APP
+ const newBlock = $automationStore.selectedAutomation.constructBlock(
+ "TRIGGER",
+ "APP",
+ appActionDefinition
+ )
- automationStore.actions.addBlockToAutomation(newBlock)
- await automationStore.actions.save(
- $automationStore.selectedAutomation?.automation
- )
- parameters.automationId = $automationStore.selectedAutomation.automation._id
- delete parameters.newAutomationName
+ newBlock.inputs = {
+ fields: Object.keys(parameters.fields).reduce((fields, key) => {
+ fields[key] = "string"
+ return fields
+ }, {}),
+ }
+
+ automationStore.actions.addBlockToAutomation(newBlock)
+ await automationStore.actions.save(
+ $automationStore.selectedAutomation?.automation
+ )
+ parameters.automationId =
+ $automationStore.selectedAutomation.automation._id
+ delete parameters.newAutomationName
+ } catch (error) {
+ notifications.error("Error creating automation")
+ }
}
diff --git a/packages/builder/src/components/design/PropertiesPanel/PropertyControls/ButtonActionEditor/actions/ExecuteQuery.svelte b/packages/builder/src/components/design/PropertiesPanel/PropertyControls/ButtonActionEditor/actions/ExecuteQuery.svelte
index 8c438e4b22..462ee71cbe 100644
--- a/packages/builder/src/components/design/PropertiesPanel/PropertyControls/ButtonActionEditor/actions/ExecuteQuery.svelte
+++ b/packages/builder/src/components/design/PropertiesPanel/PropertyControls/ButtonActionEditor/actions/ExecuteQuery.svelte
@@ -52,7 +52,7 @@
{/if}
{#if query?.parameters?.length > 0}
-
+
+
+
diff --git a/packages/builder/src/components/design/PropertiesPanel/PropertyControls/ColumnEditor/ColumnDrawer.svelte b/packages/builder/src/components/design/PropertiesPanel/PropertyControls/ColumnEditor/ColumnDrawer.svelte
new file mode 100644
index 0000000000..ef4726751b
--- /dev/null
+++ b/packages/builder/src/components/design/PropertiesPanel/PropertyControls/ColumnEditor/ColumnDrawer.svelte
@@ -0,0 +1,178 @@
+
+
+
+
+
+ {#if columns?.length}
+
+
+
+ {#each columns as column (column.id)}
+
+
(dragDisabled = false)}
+ >
+
+
+
+ {/each}
+
+
+ {:else}
+
+
+ Add the first column to your table.
+
+ {/if}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/packages/builder/src/components/design/PropertiesPanel/PropertyControls/ColumnEditor/ColumnEditor.svelte b/packages/builder/src/components/design/PropertiesPanel/PropertyControls/ColumnEditor/ColumnEditor.svelte
new file mode 100644
index 0000000000..8cebf5a657
--- /dev/null
+++ b/packages/builder/src/components/design/PropertiesPanel/PropertyControls/ColumnEditor/ColumnEditor.svelte
@@ -0,0 +1,64 @@
+
+
+Configure columns
+
+
+ Configure the columns in your table.
+
+
+
+
diff --git a/packages/builder/src/components/design/PropertiesPanel/PropertyControls/ConditionalUIDrawer.svelte b/packages/builder/src/components/design/PropertiesPanel/PropertyControls/ConditionalUIDrawer.svelte
index e303729d0b..11d19edf7c 100644
--- a/packages/builder/src/components/design/PropertiesPanel/PropertyControls/ConditionalUIDrawer.svelte
+++ b/packages/builder/src/components/design/PropertiesPanel/PropertyControls/ConditionalUIDrawer.svelte
@@ -12,7 +12,7 @@
import { dndzone } from "svelte-dnd-action"
import { generate } from "shortid"
import DrawerBindableInput from "components/common/bindings/DrawerBindableInput.svelte"
- import { OperatorOptions, getValidOperatorsForType } from "constants/lucene"
+ import { LuceneUtils, Constants } from "@budibase/frontend-core"
import { selectedComponent } from "builderStore"
import { getComponentForSettingType } from "./componentSettings"
import PropertyControl from "./PropertyControl.svelte"
@@ -83,7 +83,7 @@
valueType: "string",
id: generate(),
action: "hide",
- operator: OperatorOptions.Equals.value,
+ operator: Constants.OperatorOptions.Equals.value,
},
]
}
@@ -108,13 +108,13 @@
}
const getOperatorOptions = condition => {
- return getValidOperatorsForType(condition.valueType)
+ return LuceneUtils.getValidOperatorsForType(condition.valueType)
}
const onOperatorChange = (condition, newOperator) => {
const noValueOptions = [
- OperatorOptions.Empty.value,
- OperatorOptions.NotEmpty.value,
+ Constants.OperatorOptions.Empty.value,
+ Constants.OperatorOptions.NotEmpty.value,
]
condition.noValue = noValueOptions.includes(newOperator)
if (condition.noValue) {
@@ -127,9 +127,12 @@
condition.referenceValue = null
// Ensure a valid operator is set
- const validOperators = getValidOperatorsForType(newType).map(x => x.value)
+ const validOperators = LuceneUtils.getValidOperatorsForType(newType).map(
+ x => x.value
+ )
if (!validOperators.includes(condition.operator)) {
- condition.operator = validOperators[0] ?? OperatorOptions.Equals.value
+ condition.operator =
+ validOperators[0] ?? Constants.OperatorOptions.Equals.value
onOperatorChange(condition, condition.operator)
}
}
diff --git a/packages/builder/src/components/design/PropertiesPanel/PropertyControls/FilterEditor/FilterDrawer.svelte b/packages/builder/src/components/design/PropertiesPanel/PropertyControls/FilterEditor/FilterDrawer.svelte
index ac97bf6065..ef56c610bd 100644
--- a/packages/builder/src/components/design/PropertiesPanel/PropertyControls/FilterEditor/FilterDrawer.svelte
+++ b/packages/builder/src/components/design/PropertiesPanel/PropertyControls/FilterEditor/FilterDrawer.svelte
@@ -13,7 +13,7 @@
import DrawerBindableInput from "components/common/bindings/DrawerBindableInput.svelte"
import ClientBindingPanel from "components/common/bindings/ClientBindingPanel.svelte"
import { generate } from "shortid"
- import { getValidOperatorsForType, OperatorOptions } from "constants/lucene"
+ import { LuceneUtils, Constants } from "@budibase/frontend-core"
import { getFields } from "helpers/searchFields"
export let schemaFields
@@ -32,7 +32,7 @@
{
id: generate(),
field: null,
- operator: OperatorOptions.Equals.value,
+ operator: Constants.OperatorOptions.Equals.value,
value: null,
valueType: "Value",
},
@@ -54,11 +54,12 @@
expression.type = enrichedSchemaFields.find(x => x.name === field)?.type
// Ensure a valid operator is set
- const validOperators = getValidOperatorsForType(expression.type).map(
- x => x.value
- )
+ const validOperators = LuceneUtils.getValidOperatorsForType(
+ expression.type
+ ).map(x => x.value)
if (!validOperators.includes(expression.operator)) {
- expression.operator = validOperators[0] ?? OperatorOptions.Equals.value
+ expression.operator =
+ validOperators[0] ?? Constants.OperatorOptions.Equals.value
onOperatorChange(expression, expression.operator)
}
@@ -73,8 +74,8 @@
const onOperatorChange = (expression, operator) => {
const noValueOptions = [
- OperatorOptions.Empty.value,
- OperatorOptions.NotEmpty.value,
+ Constants.OperatorOptions.Empty.value,
+ Constants.OperatorOptions.NotEmpty.value,
]
expression.noValue = noValueOptions.includes(operator)
if (expression.noValue) {
@@ -110,7 +111,7 @@
/>
{/if}
diff --git a/packages/builder/src/pages/builder/apps/index.svelte b/packages/builder/src/pages/builder/apps/index.svelte
index c98e749e45..39cc780ac7 100644
--- a/packages/builder/src/pages/builder/apps/index.svelte
+++ b/packages/builder/src/pages/builder/apps/index.svelte
@@ -10,6 +10,7 @@
Icon,
Body,
Modal,
+ notifications,
} from "@budibase/bbui"
import { onMount } from "svelte"
import { apps, organisation, auth } from "stores/portal"
@@ -26,8 +27,12 @@
let changePasswordModal
onMount(async () => {
- await organisation.init()
- await apps.load()
+ try {
+ await organisation.init()
+ await apps.load()
+ } catch (error) {
+ notifications.error("Error loading apps")
+ }
loaded = true
})
@@ -47,6 +52,14 @@
return `/${app.prodId}`
}
}
+
+ const logout = async () => {
+ try {
+ await auth.logout()
+ } catch (error) {
+ // Swallow error and do nothing
+ }
+ }
{#if $auth.user && loaded}
@@ -82,7 +95,7 @@
Open developer mode
{/if}
-
+
diff --git a/packages/builder/src/pages/builder/auth/_components/OIDCButton.svelte b/packages/builder/src/pages/builder/auth/_components/OIDCButton.svelte
index bae68b6548..27f5bde186 100644
--- a/packages/builder/src/pages/builder/auth/_components/OIDCButton.svelte
+++ b/packages/builder/src/pages/builder/auth/_components/OIDCButton.svelte
@@ -1,5 +1,5 @@
diff --git a/packages/builder/src/pages/builder/auth/index.svelte b/packages/builder/src/pages/builder/auth/index.svelte
index a2a02e65c1..72b3a8c7cf 100644
--- a/packages/builder/src/pages/builder/auth/index.svelte
+++ b/packages/builder/src/pages/builder/auth/index.svelte
@@ -2,6 +2,7 @@
import { redirect } from "@roxi/routify"
import { auth, admin } from "stores/portal"
import { onMount } from "svelte"
+ import { notifications } from "@budibase/bbui"
$: tenantSet = $auth.tenantSet
$: multiTenancyEnabled = $admin.multiTenancy
@@ -17,8 +18,12 @@
}
onMount(async () => {
- await admin.init()
- await auth.checkQueryString()
+ try {
+ await admin.init()
+ await auth.checkQueryString()
+ } catch (error) {
+ notifications.error("Error getting checklist")
+ }
loaded = true
})
diff --git a/packages/builder/src/pages/builder/auth/login.svelte b/packages/builder/src/pages/builder/auth/login.svelte
index 7a13164c51..d9151b4342 100644
--- a/packages/builder/src/pages/builder/auth/login.svelte
+++ b/packages/builder/src/pages/builder/auth/login.svelte
@@ -31,7 +31,6 @@
username,
password,
})
-
if ($auth?.user?.forceResetPassword) {
$goto("./reset")
} else {
@@ -39,8 +38,7 @@
$goto("../portal")
}
} catch (err) {
- console.error(err)
- notifications.error(err.message ? err.message : "Invalid Credentials")
+ notifications.error(err.message ? err.message : "Invalid credentials")
}
}
@@ -49,7 +47,11 @@
}
onMount(async () => {
- await organisation.init()
+ try {
+ await organisation.init()
+ } catch (error) {
+ notifications.error("Error getting org config")
+ }
loaded = true
})
diff --git a/packages/builder/src/pages/builder/auth/org.svelte b/packages/builder/src/pages/builder/auth/org.svelte
index 5a484b6c93..8fd94463d9 100644
--- a/packages/builder/src/pages/builder/auth/org.svelte
+++ b/packages/builder/src/pages/builder/auth/org.svelte
@@ -1,5 +1,13 @@
diff --git a/packages/builder/src/pages/builder/invite/index.svelte b/packages/builder/src/pages/builder/invite/index.svelte
index ddf888ad73..c4745d8737 100644
--- a/packages/builder/src/pages/builder/invite/index.svelte
+++ b/packages/builder/src/pages/builder/invite/index.svelte
@@ -10,14 +10,11 @@
async function acceptInvite() {
try {
- const res = await users.acceptInvite(inviteCode, password)
- if (!res) {
- throw new Error(res.message)
- }
- notifications.success(`User created.`)
+ await users.acceptInvite(inviteCode, password)
+ notifications.success("Invitation accepted successfully")
$goto("../auth/login")
- } catch (err) {
- notifications.error(err)
+ } catch (error) {
+ notifications.error("Error accepting invitation")
}
}
diff --git a/packages/builder/src/pages/builder/portal/_layout.svelte b/packages/builder/src/pages/builder/portal/_layout.svelte
index 8fca18d29d..f4679647ff 100644
--- a/packages/builder/src/pages/builder/portal/_layout.svelte
+++ b/packages/builder/src/pages/builder/portal/_layout.svelte
@@ -10,6 +10,7 @@
MenuItem,
Modal,
clickOutside,
+ notifications,
} from "@budibase/bbui"
import ConfigChecklist from "components/common/ConfigChecklist.svelte"
import { organisation, auth } from "stores/portal"
@@ -78,6 +79,14 @@
return menu
}
+ const logout = async () => {
+ try {
+ await auth.logout()
+ } catch (error) {
+ // Swallow error and do nothing
+ }
+ }
+
const showMobileMenu = () => (mobileMenuVisible = true)
const hideMobileMenu = () => (mobileMenuVisible = false)
@@ -87,7 +96,11 @@
if (!$auth.user?.builder?.global) {
$redirect("../")
} else {
- await organisation.init()
+ try {
+ await organisation.init()
+ } catch (error) {
+ notifications.error("Error getting org config")
+ }
loaded = true
}
}
@@ -158,7 +171,7 @@
-
+