Merge remote-tracking branch 'origin/master' into feature/form-screen-template

This commit is contained in:
Dean 2024-02-14 14:32:15 +00:00
commit 5c5dc4c155
343 changed files with 7105 additions and 3580 deletions

View File

@ -1,5 +1,5 @@
{ {
"version": "2.19.0", "version": "2.19.3",
"npmClient": "yarn", "npmClient": "yarn",
"packages": [ "packages": [
"packages/*", "packages/*",

View File

@ -106,7 +106,6 @@
"axios": "1.6.3", "axios": "1.6.3",
"xml2js": "0.6.2", "xml2js": "0.6.2",
"unset-value": "2.0.1", "unset-value": "2.0.1",
"got": "13.0.0",
"passport": "0.6.0" "passport": "0.6.0"
}, },
"engines": { "engines": {

@ -1 +1 @@
Subproject commit cc12291732ee902dc832bc7d93cf2086ffdf0cff Subproject commit 1ba8414bed14439512153cf851086146a80560f5

View File

@ -23,7 +23,6 @@
"\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/internals/mocks/fileMock.js", "\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/internals/mocks/fileMock.js",
"\\.(css|less|sass|scss)$": "identity-obj-proxy", "\\.(css|less|sass|scss)$": "identity-obj-proxy",
"components(.*)$": "<rootDir>/src/components$1", "components(.*)$": "<rootDir>/src/components$1",
"builderStore(.*)$": "<rootDir>/src/builderStore$1",
"stores(.*)$": "<rootDir>/src/stores$1", "stores(.*)$": "<rootDir>/src/stores$1",
"analytics(.*)$": "<rootDir>/src/analytics$1", "analytics(.*)$": "<rootDir>/src/analytics$1",
"constants/backend": "<rootDir>/src/constants/backend/index.js" "constants/backend": "<rootDir>/src/constants/backend/index.js"

View File

@ -3,14 +3,14 @@ import {
CookieUtils, CookieUtils,
Constants, Constants,
} from "@budibase/frontend-core" } from "@budibase/frontend-core"
import { store } from "./builderStore" import { appStore } from "stores/builder"
import { get } from "svelte/store" import { get } from "svelte/store"
import { auth, navigation } from "./stores/portal" import { auth, navigation } from "./stores/portal"
export const API = createAPIClient({ export const API = createAPIClient({
attachHeaders: headers => { attachHeaders: headers => {
// Attach app ID header from store // Attach app ID header from store
let appId = get(store).appId let appId = get(appStore).appId
if (appId) { if (appId) {
headers["x-budibase-app-id"] = appId headers["x-budibase-app-id"] = appId
} }

View File

@ -1,158 +0,0 @@
import { getFrontendStore } from "./store/frontend"
import { getAutomationStore } from "./store/automation"
import { getTemporalStore } from "./store/temporal"
import { getThemeStore } from "./store/theme"
import { getUserStore } from "./store/users"
import { getDeploymentStore } from "./store/deployments"
import { derived, get } from "svelte/store"
import { findComponent, findComponentPath } from "./componentUtils"
import { RoleUtils } from "@budibase/frontend-core"
import { createHistoryStore } from "builderStore/store/history"
import { cloneDeep } from "lodash/fp"
import { getHoverStore } from "./store/hover"
export const store = getFrontendStore()
export const automationStore = getAutomationStore()
export const themeStore = getThemeStore()
export const temporalStore = getTemporalStore()
export const userStore = getUserStore()
export const deploymentStore = getDeploymentStore()
export const hoverStore = getHoverStore()
// Setup history for screens
export const screenHistoryStore = createHistoryStore({
getDoc: id => get(store).screens?.find(screen => screen._id === id),
selectDoc: store.actions.screens.select,
afterAction: () => {
// Ensure a valid component is selected
if (!get(selectedComponent)) {
store.update(state => ({
...state,
selectedComponentId: get(selectedScreen)?.props._id,
}))
}
},
})
store.actions.screens.save = screenHistoryStore.wrapSaveDoc(
store.actions.screens.save
)
store.actions.screens.delete = screenHistoryStore.wrapDeleteDoc(
store.actions.screens.delete
)
// Setup history for automations
export const automationHistoryStore = createHistoryStore({
getDoc: automationStore.actions.getDefinition,
selectDoc: automationStore.actions.select,
})
automationStore.actions.save = automationHistoryStore.wrapSaveDoc(
automationStore.actions.save
)
automationStore.actions.delete = automationHistoryStore.wrapDeleteDoc(
automationStore.actions.delete
)
export const selectedScreen = derived(store, $store => {
return $store.screens.find(screen => screen._id === $store.selectedScreenId)
})
export const selectedLayout = derived(store, $store => {
return $store.layouts?.find(layout => layout._id === $store.selectedLayoutId)
})
export const selectedComponent = derived(
[store, selectedScreen],
([$store, $selectedScreen]) => {
if (
$selectedScreen &&
$store.selectedComponentId?.startsWith(`${$selectedScreen._id}-`)
) {
return $selectedScreen?.props
}
if (!$selectedScreen || !$store.selectedComponentId) {
return null
}
const selected = findComponent(
$selectedScreen?.props,
$store.selectedComponentId
)
const clone = selected ? cloneDeep(selected) : selected
store.actions.components.migrateSettings(clone)
return clone
}
)
// For legacy compatibility only, but with the new design UI this is just
// the selected screen
export const currentAsset = selectedScreen
export const sortedScreens = derived(store, $store => {
return $store.screens.slice().sort((a, b) => {
// Sort by role first
const roleA = RoleUtils.getRolePriority(a.routing.roleId)
const roleB = RoleUtils.getRolePriority(b.routing.roleId)
if (roleA !== roleB) {
return roleA > roleB ? -1 : 1
}
// Then put home screens first
const homeA = !!a.routing.homeScreen
const homeB = !!b.routing.homeScreen
if (homeA !== homeB) {
return homeA ? -1 : 1
}
// Then sort alphabetically by each URL param
const aParams = a.routing.route.split("/")
const bParams = b.routing.route.split("/")
let minParams = Math.min(aParams.length, bParams.length)
for (let i = 0; i < minParams; i++) {
if (aParams[i] === bParams[i]) {
continue
}
return aParams[i] < bParams[i] ? -1 : 1
}
// Then sort by the fewest amount of URL params
return aParams.length < bParams.length ? -1 : 1
})
})
export const selectedComponentPath = derived(
[store, selectedScreen],
([$store, $selectedScreen]) => {
return findComponentPath(
$selectedScreen?.props,
$store.selectedComponentId
).map(component => component._id)
}
)
// Derived automation state
export const selectedAutomation = derived(automationStore, $automationStore => {
if (!$automationStore.selectedAutomationId) {
return null
}
return $automationStore.automations?.find(
x => x._id === $automationStore.selectedAutomationId
)
})
// Derive map of resource IDs to other users.
// We only ever care about a single user in each resource, so if multiple users
// share the same datasource we can just overwrite them.
export const userSelectedResourceMap = derived(userStore, $userStore => {
let map = {}
$userStore.forEach(user => {
const resource = user.builderMetadata?.selectedResourceId
if (resource) {
if (!map[resource]) {
map[resource] = []
}
map[resource].push(user)
}
})
return map
})
export const isOnlyUser = derived(userStore, $userStore => {
return $userStore.length < 2
})

File diff suppressed because it is too large Load Diff

View File

@ -1,27 +0,0 @@
import { get, writable } from "svelte/store"
import { store as builder } from "builderStore"
export const getHoverStore = () => {
const initialValue = {
componentId: null,
}
const store = writable(initialValue)
const update = (componentId, notifyClient = true) => {
if (componentId === get(store).componentId) {
return
}
store.update(state => {
state.componentId = componentId
return state
})
if (notifyClient) {
builder.actions.preview.sendEvent("hover-component", componentId)
}
}
return {
subscribe: store.subscribe,
actions: { update },
}
}

View File

@ -1,545 +0,0 @@
import { expect, describe, it, vi } from "vitest"
import {
runtimeToReadableBinding,
readableToRuntimeBinding,
updateReferencesInObject,
} from "../dataBinding"
vi.mock("@budibase/frontend-core")
vi.mock("builderStore/componentUtils")
vi.mock("builderStore/store")
vi.mock("builderStore/store/theme")
vi.mock("builderStore/store/temporal")
describe("runtimeToReadableBinding", () => {
const bindableProperties = [
{
category: "Current User",
icon: "User",
providerId: "user",
readableBinding: "Current User.firstName",
runtimeBinding: "[user].[firstName]",
type: "context",
},
{
category: "Bindings",
icon: "Brackets",
readableBinding: "Binding.count",
runtimeBinding: "count",
type: "context",
},
]
it("should convert a runtime binding to a readable one", () => {
const textWithBindings = `Hello {{ [user].[firstName] }}! The count is {{ count }}.`
expect(
runtimeToReadableBinding(
bindableProperties,
textWithBindings,
"readableBinding"
)
).toEqual(
`Hello {{ Current User.firstName }}! The count is {{ Binding.count }}.`
)
})
it("should not convert to readable binding if it is already readable", () => {
const textWithBindings = `Hello {{ [user].[firstName] }}! The count is {{ Binding.count }}.`
expect(
runtimeToReadableBinding(
bindableProperties,
textWithBindings,
"readableBinding"
)
).toEqual(
`Hello {{ Current User.firstName }}! The count is {{ Binding.count }}.`
)
})
})
describe("readableToRuntimeBinding", () => {
const bindableProperties = [
{
category: "Current User",
icon: "User",
providerId: "user",
readableBinding: "Current User.firstName",
runtimeBinding: "[user].[firstName]",
type: "context",
},
{
category: "Bindings",
icon: "Brackets",
readableBinding: "Binding.count",
runtimeBinding: "count",
type: "context",
},
]
it("should convert a readable binding to a runtime one", () => {
const textWithBindings = `Hello {{ Current User.firstName }}! The count is {{ Binding.count }}.`
expect(
readableToRuntimeBinding(
bindableProperties,
textWithBindings,
"runtimeBinding"
)
).toEqual(`Hello {{ [user].[firstName] }}! The count is {{ count }}.`)
})
})
describe("updateReferencesInObject", () => {
it("should increment steps in sequence on 'add'", () => {
let obj = [
{
id: "a0",
parameters: {
text: "Alpha",
},
},
{
id: "a1",
parameters: {
text: "Apple",
},
},
{
id: "b2",
parameters: {
text: "Banana {{ actions.1.row }}",
},
},
{
id: "c3",
parameters: {
text: "Carrot {{ actions.1.row }}",
},
},
{
id: "d4",
parameters: {
text: "Dog {{ actions.3.row }}",
},
},
{
id: "e5",
parameters: {
text: "Eagle {{ actions.4.row }}",
},
},
]
updateReferencesInObject({
obj,
modifiedIndex: 0,
action: "add",
label: "actions",
})
expect(obj).toEqual([
{
id: "a0",
parameters: {
text: "Alpha",
},
},
{
id: "a1",
parameters: {
text: "Apple",
},
},
{
id: "b2",
parameters: {
text: "Banana {{ actions.2.row }}",
},
},
{
id: "c3",
parameters: {
text: "Carrot {{ actions.2.row }}",
},
},
{
id: "d4",
parameters: {
text: "Dog {{ actions.4.row }}",
},
},
{
id: "e5",
parameters: {
text: "Eagle {{ actions.5.row }}",
},
},
])
})
it("should decrement steps in sequence on 'delete'", () => {
let obj = [
{
id: "a1",
parameters: {
text: "Apple",
},
},
{
id: "b2",
parameters: {
text: "Banana {{ actions.1.row }}",
},
},
{
id: "d4",
parameters: {
text: "Dog {{ actions.3.row }}",
},
},
{
id: "e5",
parameters: {
text: "Eagle {{ actions.4.row }}",
},
},
]
updateReferencesInObject({
obj,
modifiedIndex: 2,
action: "delete",
label: "actions",
})
expect(obj).toEqual([
{
id: "a1",
parameters: {
text: "Apple",
},
},
{
id: "b2",
parameters: {
text: "Banana {{ actions.1.row }}",
},
},
{
id: "d4",
parameters: {
text: "Dog {{ actions.2.row }}",
},
},
{
id: "e5",
parameters: {
text: "Eagle {{ actions.3.row }}",
},
},
])
})
it("should handle on 'move' to a lower index", () => {
let obj = [
{
id: "a1",
parameters: {
text: "Apple",
},
},
{
id: "b2",
parameters: {
text: "Banana {{ actions.0.row }}",
},
},
{
id: "e5",
parameters: {
text: "Eagle {{ actions.3.row }}",
},
},
{
id: "c3",
parameters: {
text: "Carrot {{ actions.0.row }}",
},
},
{
id: "d4",
parameters: {
text: "Dog {{ actions.2.row }}",
},
},
]
updateReferencesInObject({
obj,
modifiedIndex: 2,
action: "move",
label: "actions",
originalIndex: 4,
})
expect(obj).toEqual([
{
id: "a1",
parameters: {
text: "Apple",
},
},
{
id: "b2",
parameters: {
text: "Banana {{ actions.0.row }}",
},
},
{
id: "e5",
parameters: {
text: "Eagle {{ actions.4.row }}",
},
},
{
id: "c3",
parameters: {
text: "Carrot {{ actions.0.row }}",
},
},
{
id: "d4",
parameters: {
text: "Dog {{ actions.3.row }}",
},
},
])
})
it("should handle on 'move' to a higher index", () => {
let obj = [
{
id: "b2",
parameters: {
text: "Banana {{ actions.0.row }}",
},
},
{
id: "c3",
parameters: {
text: "Carrot {{ actions.0.row }}",
},
},
{
id: "a1",
parameters: {
text: "Apple",
},
},
{
id: "d4",
parameters: {
text: "Dog {{ actions.2.row }}",
},
},
{
id: "e5",
parameters: {
text: "Eagle {{ actions.3.row }}",
},
},
]
updateReferencesInObject({
obj,
modifiedIndex: 2,
action: "move",
label: "actions",
originalIndex: 0,
})
expect(obj).toEqual([
{
id: "b2",
parameters: {
text: "Banana {{ actions.2.row }}",
},
},
{
id: "c3",
parameters: {
text: "Carrot {{ actions.2.row }}",
},
},
{
id: "a1",
parameters: {
text: "Apple",
},
},
{
id: "d4",
parameters: {
text: "Dog {{ actions.1.row }}",
},
},
{
id: "e5",
parameters: {
text: "Eagle {{ actions.3.row }}",
},
},
])
})
it("should handle on 'move' of action being referenced, dragged to a higher index", () => {
let obj = [
{
"##eventHandlerType": "Validate Form",
id: "cCD0Dwcnq",
},
{
"##eventHandlerType": "Close Screen Modal",
id: "3fbbIOfN0H",
},
{
"##eventHandlerType": "Save Row",
parameters: {
tableId: "ta_bb_employee",
},
id: "aehg5cTmhR",
},
{
"##eventHandlerType": "Close Side Panel",
id: "mzkpf86cxo",
},
{
"##eventHandlerType": "Navigate To",
id: "h0uDFeJa8A",
},
{
parameters: {
autoDismiss: true,
type: "success",
message: "{{ actions.1.row }}",
},
"##eventHandlerType": "Show Notification",
id: "JEI5lAyJZ",
},
]
updateReferencesInObject({
obj,
modifiedIndex: 2,
action: "move",
label: "actions",
originalIndex: 1,
})
expect(obj).toEqual([
{
"##eventHandlerType": "Validate Form",
id: "cCD0Dwcnq",
},
{
"##eventHandlerType": "Close Screen Modal",
id: "3fbbIOfN0H",
},
{
"##eventHandlerType": "Save Row",
parameters: {
tableId: "ta_bb_employee",
},
id: "aehg5cTmhR",
},
{
"##eventHandlerType": "Close Side Panel",
id: "mzkpf86cxo",
},
{
"##eventHandlerType": "Navigate To",
id: "h0uDFeJa8A",
},
{
parameters: {
autoDismiss: true,
type: "success",
message: "{{ actions.2.row }}",
},
"##eventHandlerType": "Show Notification",
id: "JEI5lAyJZ",
},
])
})
it("should handle on 'move' of action being referenced, dragged to a lower index", () => {
let obj = [
{
"##eventHandlerType": "Save Row",
parameters: {
tableId: "ta_bb_employee",
},
id: "aehg5cTmhR",
},
{
"##eventHandlerType": "Validate Form",
id: "cCD0Dwcnq",
},
{
"##eventHandlerType": "Close Screen Modal",
id: "3fbbIOfN0H",
},
{
"##eventHandlerType": "Close Side Panel",
id: "mzkpf86cxo",
},
{
"##eventHandlerType": "Navigate To",
id: "h0uDFeJa8A",
},
{
parameters: {
autoDismiss: true,
type: "success",
message: "{{ actions.4.row }}",
},
"##eventHandlerType": "Show Notification",
id: "JEI5lAyJZ",
},
]
updateReferencesInObject({
obj,
modifiedIndex: 0,
action: "move",
label: "actions",
originalIndex: 4,
})
expect(obj).toEqual([
{
"##eventHandlerType": "Save Row",
parameters: {
tableId: "ta_bb_employee",
},
id: "aehg5cTmhR",
},
{
"##eventHandlerType": "Validate Form",
id: "cCD0Dwcnq",
},
{
"##eventHandlerType": "Close Screen Modal",
id: "3fbbIOfN0H",
},
{
"##eventHandlerType": "Close Side Panel",
id: "mzkpf86cxo",
},
{
"##eventHandlerType": "Navigate To",
id: "h0uDFeJa8A",
},
{
parameters: {
autoDismiss: true,
type: "success",
message: "{{ actions.0.row }}",
},
"##eventHandlerType": "Show Notification",
id: "JEI5lAyJZ",
},
])
})
})

View File

@ -1,5 +1,5 @@
<script> <script>
import { selectedAutomation } from "builderStore" import { selectedAutomation } from "stores/builder"
import Flowchart from "./FlowChart/FlowChart.svelte" import Flowchart from "./FlowChart/FlowChart.svelte"
</script> </script>

View File

@ -9,11 +9,11 @@
Tags, Tags,
Tag, Tag,
} from "@budibase/bbui" } from "@budibase/bbui"
import { automationStore, selectedAutomation } from "builderStore" import { automationStore, selectedAutomation } from "stores/builder"
import { admin, licensing } from "stores/portal" import { admin, licensing } from "stores/portal"
import { externalActions } from "./ExternalActions" import { externalActions } from "./ExternalActions"
import { TriggerStepID, ActionStepID } from "constants/backend/automations" import { TriggerStepID, ActionStepID } from "constants/backend/automations"
import { checkForCollectStep } from "builderStore/utils" import { checkForCollectStep } from "helpers/utils"
export let blockIdx export let blockIdx
export let lastStep export let lastStep

View File

@ -1,7 +1,7 @@
<script> <script>
import { processStringSync } from "@budibase/string-templates" import { processStringSync } from "@budibase/string-templates"
import { get } from "lodash/fp" import { get } from "lodash/fp"
import { tables } from "stores/backend" import { tables } from "stores/builder"
export let block export let block

View File

@ -3,7 +3,7 @@
automationStore, automationStore,
selectedAutomation, selectedAutomation,
automationHistoryStore, automationHistoryStore,
} from "builderStore" } from "stores/builder"
import ConfirmDialog from "components/common/ConfirmDialog.svelte" import ConfirmDialog from "components/common/ConfirmDialog.svelte"
import FlowItem from "./FlowItem.svelte" import FlowItem from "./FlowItem.svelte"
import TestDataModal from "./TestDataModal.svelte" import TestDataModal from "./TestDataModal.svelte"

View File

@ -1,5 +1,9 @@
<script> <script>
import { automationStore, selectedAutomation } from "builderStore" import {
automationStore,
selectedAutomation,
permissions,
} from "stores/builder"
import { import {
Icon, Icon,
Divider, Divider,
@ -17,7 +21,6 @@
import FlowItemHeader from "./FlowItemHeader.svelte" import FlowItemHeader from "./FlowItemHeader.svelte"
import RoleSelect from "components/design/settings/controls/RoleSelect.svelte" import RoleSelect from "components/design/settings/controls/RoleSelect.svelte"
import { ActionStepID, TriggerStepID } from "constants/backend/automations" import { ActionStepID, TriggerStepID } from "constants/backend/automations"
import { permissions } from "stores/backend"
export let block export let block
export let testDataModal export let testDataModal

View File

@ -1,6 +1,6 @@
<script> <script>
import { automationStore, selectedAutomation } from "builderStore" import { automationStore, selectedAutomation } from "stores/builder"
import { Icon, Body, StatusLight, AbsTooltip } from "@budibase/bbui" import { Icon, Body, AbsTooltip, StatusLight } from "@budibase/bbui"
import { externalActions } from "./ExternalActions" import { externalActions } from "./ExternalActions"
import { createEventDispatcher } from "svelte" import { createEventDispatcher } from "svelte"
import { Features } from "constants/backend/automations" import { Features } from "constants/backend/automations"

View File

@ -5,7 +5,7 @@
notifications, notifications,
ActionButton, ActionButton,
} from "@budibase/bbui" } from "@budibase/bbui"
import { automationStore, selectedAutomation } from "builderStore" import { automationStore, selectedAutomation } from "stores/builder"
import AutomationBlockSetup from "../../SetupPanel/AutomationBlockSetup.svelte" import AutomationBlockSetup from "../../SetupPanel/AutomationBlockSetup.svelte"
import { cloneDeep } from "lodash/fp" import { cloneDeep } from "lodash/fp"

View File

@ -1,7 +1,7 @@
<script> <script>
import { Icon, Divider } from "@budibase/bbui" import { Icon, Divider } from "@budibase/bbui"
import TestDisplay from "./TestDisplay.svelte" import TestDisplay from "./TestDisplay.svelte"
import { automationStore } from "builderStore" import { automationStore } from "stores/builder"
export let automation export let automation
</script> </script>

View File

@ -4,7 +4,7 @@
automationStore, automationStore,
selectedAutomation, selectedAutomation,
userSelectedResourceMap, userSelectedResourceMap,
} from "builderStore" } from "stores/builder"
import NavItem from "components/common/NavItem.svelte" import NavItem from "components/common/NavItem.svelte"
import EditAutomationPopover from "./EditAutomationPopover.svelte" import EditAutomationPopover from "./EditAutomationPopover.svelte"
import { notifications } from "@budibase/bbui" import { notifications } from "@budibase/bbui"

View File

@ -7,7 +7,7 @@
automationStore, automationStore,
selectedAutomation, selectedAutomation,
userSelectedResourceMap, userSelectedResourceMap,
} from "builderStore" } from "stores/builder"
import NavItem from "components/common/NavItem.svelte" import NavItem from "components/common/NavItem.svelte"
import EditAutomationPopover from "./EditAutomationPopover.svelte" import EditAutomationPopover from "./EditAutomationPopover.svelte"

View File

@ -1,5 +1,5 @@
<script> <script>
import { automationStore } from "builderStore" import { automationStore } from "stores/builder"
import { import {
notifications, notifications,
Input, Input,

View File

@ -1,5 +1,5 @@
<script> <script>
import { automationStore } from "builderStore" import { automationStore } from "stores/builder"
import { ActionMenu, MenuItem, notifications, Icon } from "@budibase/bbui" import { ActionMenu, MenuItem, notifications, Icon } from "@budibase/bbui"
import ConfirmDialog from "components/common/ConfirmDialog.svelte" import ConfirmDialog from "components/common/ConfirmDialog.svelte"
import UpdateAutomationModal from "components/automation/AutomationPanel/UpdateAutomationModal.svelte" import UpdateAutomationModal from "components/automation/AutomationPanel/UpdateAutomationModal.svelte"

View File

@ -1,5 +1,5 @@
<script> <script>
import { automationStore } from "builderStore" import { automationStore } from "stores/builder"
import { import {
notifications, notifications,
Icon, Icon,

View File

@ -17,8 +17,7 @@
DatePicker, DatePicker,
} from "@budibase/bbui" } from "@budibase/bbui"
import CreateWebhookModal from "components/automation/Shared/CreateWebhookModal.svelte" import CreateWebhookModal from "components/automation/Shared/CreateWebhookModal.svelte"
import { automationStore, selectedAutomation } from "builderStore" import { automationStore, selectedAutomation, tables } from "stores/builder"
import { tables } from "stores/backend"
import { environment, licensing } from "stores/portal" import { environment, licensing } from "stores/portal"
import WebhookDisplay from "../Shared/WebhookDisplay.svelte" import WebhookDisplay from "../Shared/WebhookDisplay.svelte"
import DrawerBindableInput from "../../common/bindings/DrawerBindableInput.svelte" import DrawerBindableInput from "../../common/bindings/DrawerBindableInput.svelte"
@ -44,7 +43,7 @@
import { import {
getSchemaForDatasourcePlus, getSchemaForDatasourcePlus,
getEnvironmentBindings, getEnvironmentBindings,
} from "builderStore/dataBinding" } from "dataBinding"
import { TriggerStepID, ActionStepID } from "constants/backend/automations" import { TriggerStepID, ActionStepID } from "constants/backend/automations"
import { onMount } from "svelte" import { onMount } from "svelte"
import { cloneDeep } from "lodash/fp" import { cloneDeep } from "lodash/fp"

View File

@ -1,7 +1,7 @@
<script> <script>
import { Select, Label } from "@budibase/bbui" import { Select, Label } from "@budibase/bbui"
import { createEventDispatcher } from "svelte" import { createEventDispatcher } from "svelte"
import { automationStore, selectedAutomation } from "builderStore" import { automationStore, selectedAutomation } from "stores/builder"
import { TriggerStepID } from "constants/backend/automations" import { TriggerStepID } from "constants/backend/automations"
import DrawerBindableInput from "../../common/bindings/DrawerBindableInput.svelte" import DrawerBindableInput from "../../common/bindings/DrawerBindableInput.svelte"
import AutomationBindingPanel from "../../common/bindings/ServerBindingPanel.svelte" import AutomationBindingPanel from "../../common/bindings/ServerBindingPanel.svelte"

View File

@ -1,16 +1,35 @@
<script> <script>
import { Button, Select, Input, Label } from "@budibase/bbui" import { Button, Select, Input, Label } from "@budibase/bbui"
import { onMount, createEventDispatcher } from "svelte" import { onMount, createEventDispatcher } from "svelte"
import { flags } from "stores/backend" import { flags } from "stores/builder"
import { helpers, REBOOT_CRON } from "@budibase/shared-core"
const dispatch = createEventDispatcher() const dispatch = createEventDispatcher()
export let value export let value
let error
$: {
const exists = CRON_EXPRESSIONS.some(cron => cron.value === value)
const customIndex = CRON_EXPRESSIONS.findIndex(
cron => cron.label === "Custom"
)
if (!exists && customIndex === -1) {
CRON_EXPRESSIONS[0] = { label: "Custom", value: value }
} else if (exists && customIndex !== -1) {
CRON_EXPRESSIONS.splice(customIndex, 1)
}
}
const onChange = e => { const onChange = e => {
if (e.detail === value) { if (value !== REBOOT_CRON) {
error = helpers.cron.validate(e.detail).err
}
if (e.detail === value || error) {
return return
} }
value = e.detail value = e.detail
dispatch("change", e.detail) dispatch("change", e.detail)
} }
@ -41,7 +60,7 @@
if (!$flags.cloud) { if (!$flags.cloud) {
CRON_EXPRESSIONS.push({ CRON_EXPRESSIONS.push({
label: "Every Budibase Reboot", label: "Every Budibase Reboot",
value: "@reboot", value: REBOOT_CRON,
}) })
} }
}) })
@ -49,6 +68,7 @@
<div class="block-field"> <div class="block-field">
<Input <Input
{error}
on:change={onChange} on:change={onChange}
{value} {value}
on:blur={() => (touched = true)} on:blur={() => (touched = true)}
@ -64,7 +84,7 @@
{#if presets} {#if presets}
<Select <Select
on:change={onChange} on:change={onChange}
{value} value={value || "Custom"}
secondary secondary
extraThin extraThin
label="Presets" label="Presets"

View File

@ -1,6 +1,6 @@
<script> <script>
import { createEventDispatcher } from "svelte" import { createEventDispatcher } from "svelte"
import { queries } from "stores/backend" import { queries } from "stores/builder"
import { Select, Label } from "@budibase/bbui" import { Select, Label } from "@budibase/bbui"
import DrawerBindableInput from "../../common/bindings/DrawerBindableInput.svelte" import DrawerBindableInput from "../../common/bindings/DrawerBindableInput.svelte"
import AutomationBindingPanel from "../../common/bindings/ServerBindingPanel.svelte" import AutomationBindingPanel from "../../common/bindings/ServerBindingPanel.svelte"

View File

@ -1,5 +1,5 @@
<script> <script>
import { queries } from "stores/backend" import { queries } from "stores/builder"
import { Select } from "@budibase/bbui" import { Select } from "@budibase/bbui"
export let value export let value

View File

@ -1,5 +1,5 @@
<script> <script>
import { tables } from "stores/backend" import { tables } from "stores/builder"
import { Select, Checkbox, Label } from "@budibase/bbui" import { Select, Checkbox, Label } from "@budibase/bbui"
import { createEventDispatcher } from "svelte" import { createEventDispatcher } from "svelte"
import RowSelectorTypes from "./RowSelectorTypes.svelte" import RowSelectorTypes from "./RowSelectorTypes.svelte"

View File

@ -1,5 +1,5 @@
<script> <script>
import { tables } from "stores/backend" import { tables } from "stores/builder"
import { Select } from "@budibase/bbui" import { Select } from "@budibase/bbui"
import { createEventDispatcher } from "svelte" import { createEventDispatcher } from "svelte"
import { TableNames } from "constants" import { TableNames } from "constants"

View File

@ -1,6 +1,6 @@
<script> <script>
import { Icon, notifications, ModalContent } from "@budibase/bbui" import { Icon, notifications, ModalContent } from "@budibase/bbui"
import { automationStore, selectedAutomation } from "builderStore" import { automationStore, selectedAutomation } from "stores/builder"
import WebhookDisplay from "./WebhookDisplay.svelte" import WebhookDisplay from "./WebhookDisplay.svelte"
import { onMount, onDestroy } from "svelte" import { onMount, onDestroy } from "svelte"

View File

@ -1,7 +1,7 @@
<script> <script>
import { API } from "api" import { API } from "api"
import Table from "./Table.svelte" import Table from "./Table.svelte"
import { tables } from "stores/backend" import { tables } from "stores/builder"
import { notifications } from "@budibase/bbui" import { notifications } from "@budibase/bbui"
export let tableId export let tableId

View File

@ -1,10 +1,9 @@
<script> <script>
import { datasources, tables, integrations } from "stores/backend" import { datasources, tables, integrations, appStore } from "stores/builder"
import EditRolesButton from "./buttons/EditRolesButton.svelte" import EditRolesButton from "./buttons/EditRolesButton.svelte"
import { TableNames } from "constants" import { TableNames } from "constants"
import { Grid } from "@budibase/frontend-core" import { Grid } from "@budibase/frontend-core"
import { API } from "api" import { API } from "api"
import { store } from "builderStore"
import GridAddColumnModal from "components/backend/DataTable/modals/grid/GridCreateColumnModal.svelte" import GridAddColumnModal from "components/backend/DataTable/modals/grid/GridCreateColumnModal.svelte"
import GridCreateEditRowModal from "components/backend/DataTable/modals/grid/GridCreateEditRowModal.svelte" import GridCreateEditRowModal from "components/backend/DataTable/modals/grid/GridCreateEditRowModal.svelte"
import GridEditUserModal from "components/backend/DataTable/modals/grid/GridEditUserModal.svelte" import GridEditUserModal from "components/backend/DataTable/modals/grid/GridEditUserModal.svelte"
@ -59,14 +58,14 @@
datasource={gridDatasource} datasource={gridDatasource}
canAddRows={!isUsersTable} canAddRows={!isUsersTable}
canDeleteRows={!isUsersTable} canDeleteRows={!isUsersTable}
canEditRows={!isUsersTable || !$store.features.disableUserMetadata} canEditRows={!isUsersTable || !$appStore.features.disableUserMetadata}
canEditColumns={!isUsersTable || !$store.features.disableUserMetadata} canEditColumns={!isUsersTable || !$appStore.features.disableUserMetadata}
schemaOverrides={isUsersTable ? userSchemaOverrides : null} schemaOverrides={isUsersTable ? userSchemaOverrides : null}
showAvatars={false} showAvatars={false}
on:updatedatasource={handleGridTableUpdate} on:updatedatasource={handleGridTableUpdate}
> >
<svelte:fragment slot="filter"> <svelte:fragment slot="filter">
{#if isUsersTable && $store.features.disableUserMetadata} {#if isUsersTable && $appStore.features.disableUserMetadata}
<GridUsersTableButton /> <GridUsersTableButton />
{/if} {/if}
<GridFilterButton /> <GridFilterButton />

View File

@ -1,6 +1,6 @@
<script> <script>
import { API } from "api" import { API } from "api"
import { tables } from "stores/backend" import { tables } from "stores/builder"
import Table from "./Table.svelte" import Table from "./Table.svelte"
import CalculateButton from "./buttons/CalculateButton.svelte" import CalculateButton from "./buttons/CalculateButton.svelte"

View File

@ -1,5 +1,5 @@
<script> <script>
import { viewsV2 } from "stores/backend" import { viewsV2 } from "stores/builder"
import { Grid } from "@budibase/frontend-core" import { Grid } from "@budibase/frontend-core"
import { API } from "api" import { API } from "api"
import GridCreateEditRowModal from "components/backend/DataTable/modals/grid/GridCreateEditRowModal.svelte" import GridCreateEditRowModal from "components/backend/DataTable/modals/grid/GridCreateEditRowModal.svelte"

View File

@ -1,10 +1,8 @@
<script> <script>
import { ActionButton, notifications } from "@budibase/bbui" import { ActionButton, notifications } from "@budibase/bbui"
import CreateEditRelationshipModal from "../../Datasources/CreateEditRelationshipModal.svelte" import CreateEditRelationshipModal from "../../Datasources/CreateEditRelationshipModal.svelte"
import {
datasources, import { datasources, tables as tablesStore } from "stores/builder"
tables as tablesStore,
} from "../../../../stores/backend"
import { createEventDispatcher } from "svelte" import { createEventDispatcher } from "svelte"
export let table export let table

View File

@ -1,6 +1,6 @@
<script> <script>
import { ActionButton, Modal } from "@budibase/bbui" import { ActionButton, Modal } from "@budibase/bbui"
import { permissions } from "stores/backend" import { permissions } from "stores/builder"
import ManageAccessModal from "../modals/ManageAccessModal.svelte" import ManageAccessModal from "../modals/ManageAccessModal.svelte"
export let resourceId export let resourceId

View File

@ -1,5 +1,5 @@
<script> <script>
import { roles } from "stores/backend" import { roles } from "stores/builder"
export let value export let value

View File

@ -1,5 +1,5 @@
import { FIELDS } from "constants/backend" import { FIELDS } from "constants/backend"
import { tables } from "stores/backend" import { tables } from "stores/builder"
import { get as svelteGet } from "svelte/store" import { get as svelteGet } from "svelte/store"
// currently supported level of relationship depth (server side) // currently supported level of relationship depth (server side)

View File

@ -1,6 +1,6 @@
<script> <script>
import { Select, Label, notifications, ModalContent } from "@budibase/bbui" import { Select, Label, notifications, ModalContent } from "@budibase/bbui"
import { tables, views } from "stores/backend" import { tables, views } from "stores/builder"
import { FIELDS } from "constants/backend" import { FIELDS } from "constants/backend"
const CALCULATIONS = [ const CALCULATIONS = [

View File

@ -15,7 +15,7 @@
} from "@budibase/bbui" } from "@budibase/bbui"
import { createEventDispatcher, getContext, onMount } from "svelte" import { createEventDispatcher, getContext, onMount } from "svelte"
import { cloneDeep } from "lodash/fp" import { cloneDeep } from "lodash/fp"
import { tables, datasources } from "stores/backend" import { tables, datasources } from "stores/builder"
import { TableNames, UNEDITABLE_USER_FIELDS } from "constants" import { TableNames, UNEDITABLE_USER_FIELDS } from "constants"
import { import {
FIELDS, FIELDS,
@ -28,7 +28,7 @@
PrettyRelationshipDefinitions, PrettyRelationshipDefinitions,
DB_TYPE_EXTERNAL, DB_TYPE_EXTERNAL,
} from "constants/backend" } from "constants/backend"
import { getAutoColumnInformation, buildAutoColumn } from "builderStore/utils" import { getAutoColumnInformation, buildAutoColumn } from "helpers/utils"
import ConfirmDialog from "components/common/ConfirmDialog.svelte" import ConfirmDialog from "components/common/ConfirmDialog.svelte"
import ModalBindableInput from "components/common/bindings/ModalBindableInput.svelte" import ModalBindableInput from "components/common/bindings/ModalBindableInput.svelte"
import { getBindings } from "components/backend/DataTable/formula" import { getBindings } from "components/backend/DataTable/formula"

View File

@ -1,6 +1,6 @@
<script> <script>
import { createEventDispatcher } from "svelte" import { createEventDispatcher } from "svelte"
import { tables } from "stores/backend" import { tables } from "stores/builder"
import { ModalContent, keepOpen, notifications } from "@budibase/bbui" import { ModalContent, keepOpen, notifications } from "@budibase/bbui"
import RowFieldControl from "../RowFieldControl.svelte" import RowFieldControl from "../RowFieldControl.svelte"
import { API } from "api" import { API } from "api"

View File

@ -1,6 +1,6 @@
<script> <script>
import { createEventDispatcher } from "svelte" import { createEventDispatcher } from "svelte"
import { tables, roles } from "stores/backend" import { tables, roles } from "stores/builder"
import { import {
notifications, notifications,
keepOpen, keepOpen,

View File

@ -10,7 +10,7 @@
import { onMount } from "svelte" import { onMount } from "svelte"
import { API } from "api" import { API } from "api"
import ErrorsBox from "components/common/ErrorsBox.svelte" import ErrorsBox from "components/common/ErrorsBox.svelte"
import { roles } from "stores/backend" import { roles } from "stores/builder"
const BASE_ROLE = { _id: "", inherits: "BASIC", permissionId: "write" } const BASE_ROLE = { _id: "", inherits: "BASIC", permissionId: "write" }

View File

@ -10,7 +10,7 @@
notifications, notifications,
Icon, Icon,
} from "@budibase/bbui" } from "@budibase/bbui"
import { tables, views } from "stores/backend" import { tables, views } from "stores/builder"
const CONDITIONS = [ const CONDITIONS = [
{ {

View File

@ -1,6 +1,6 @@
<script> <script>
import { Select, ModalContent, notifications } from "@budibase/bbui" import { Select, ModalContent, notifications } from "@budibase/bbui"
import { tables, views } from "stores/backend" import { tables, views } from "stores/builder"
import { FIELDS } from "constants/backend" import { FIELDS } from "constants/backend"
export let view = {} export let view = {}

View File

@ -13,7 +13,7 @@
} from "@budibase/bbui" } from "@budibase/bbui"
import { onMount, createEventDispatcher } from "svelte" import { onMount, createEventDispatcher } from "svelte"
import { FIELDS } from "constants/backend" import { FIELDS } from "constants/backend"
import { generate } from "builderStore/schemaGenerator" import { generate } from "helpers/schemaGenerator"
export let schema = {} export let schema = {}
export let json export let json

View File

@ -1,6 +1,6 @@
<script> <script>
import { PermissionSource } from "@budibase/types" import { PermissionSource } from "@budibase/types"
import { roles, permissions as permissionsStore } from "stores/backend" import { roles, permissions as permissionsStore } from "stores/builder"
import { import {
Label, Label,
Input, Input,

View File

@ -2,7 +2,7 @@
import { getContext } from "svelte" import { getContext } from "svelte"
import { Input, notifications, ModalContent } from "@budibase/bbui" import { Input, notifications, ModalContent } from "@budibase/bbui"
import { goto } from "@roxi/routify" import { goto } from "@roxi/routify"
import { viewsV2 } from "stores/backend" import { viewsV2 } from "stores/builder"
const { filter, sort, definition } = getContext("grid") const { filter, sort, definition } = getContext("grid")

View File

@ -1,15 +1,12 @@
<script> <script>
import { ActionButton, Popover, Heading, Body, Button } from "@budibase/bbui" import { ActionButton, Popover, Heading, Body, Button } from "@budibase/bbui"
import { store } from "builderStore" import { builderStore } from "stores/builder"
let anchor let anchor
let open = false let open = false
const openSidePanel = () => { const openSidePanel = () => {
store.update(state => ({ builderStore.showBuilderSidePanel()
...state,
builderSidePanel: true,
}))
open = false open = false
} }
</script> </script>

View File

@ -3,13 +3,13 @@
import { Layout } from "@budibase/bbui" import { Layout } from "@budibase/bbui"
import { BUDIBASE_INTERNAL_DB_ID } from "constants/backend" import { BUDIBASE_INTERNAL_DB_ID } from "constants/backend"
import { import {
database,
datasources, datasources,
queries, queries,
tables, tables,
views, views,
viewsV2, viewsV2,
} from "stores/backend" userSelectedResourceMap,
} from "stores/builder"
import EditDatasourcePopover from "./popovers/EditDatasourcePopover.svelte" import EditDatasourcePopover from "./popovers/EditDatasourcePopover.svelte"
import EditQueryPopover from "./popovers/EditQueryPopover.svelte" import EditQueryPopover from "./popovers/EditQueryPopover.svelte"
import NavItem from "components/common/NavItem.svelte" import NavItem from "components/common/NavItem.svelte"
@ -21,7 +21,6 @@
} from "helpers/data/utils" } from "helpers/data/utils"
import IntegrationIcon from "./IntegrationIcon.svelte" import IntegrationIcon from "./IntegrationIcon.svelte"
import { TableNames } from "constants" import { TableNames } from "constants"
import { userSelectedResourceMap } from "builderStore"
import { enrichDatasources } from "./datasourceUtils" import { enrichDatasources } from "./datasourceUtils"
import { onMount } from "svelte" import { onMount } from "svelte"
@ -75,69 +74,67 @@
searchTerm && !showAppUsersTable && !enrichedDataSources.find(ds => ds.show) searchTerm && !showAppUsersTable && !enrichedDataSources.find(ds => ds.show)
</script> </script>
{#if $database?._id} <div class="hierarchy-items-container">
<div class="hierarchy-items-container"> {#if showAppUsersTable}
{#if showAppUsersTable} <NavItem
<NavItem icon="UserGroup"
icon="UserGroup" text={appUsersTableName}
text={appUsersTableName} selected={$isActive("./table/:tableId") &&
selected={$isActive("./table/:tableId") && $tables.selected?._id === TableNames.USERS}
$tables.selected?._id === TableNames.USERS} on:click={() => selectTable(TableNames.USERS)}
on:click={() => selectTable(TableNames.USERS)} selectedBy={$userSelectedResourceMap[TableNames.USERS]}
selectedBy={$userSelectedResourceMap[TableNames.USERS]} />
/> {/if}
{/if} {#each enrichedDataSources.filter(ds => ds.show) as datasource}
{#each enrichedDataSources.filter(ds => ds.show) as datasource} <NavItem
<NavItem border
border text={datasource.name}
text={datasource.name} opened={datasource.open}
opened={datasource.open} selected={$isActive("./datasource") && datasource.selected}
selected={$isActive("./datasource") && datasource.selected} withArrow={true}
withArrow={true} on:click={() => selectDatasource(datasource)}
on:click={() => selectDatasource(datasource)} on:iconClick={() => toggleNode(datasource)}
on:iconClick={() => toggleNode(datasource)} selectedBy={$userSelectedResourceMap[datasource._id]}
selectedBy={$userSelectedResourceMap[datasource._id]} >
> <div class="datasource-icon" slot="icon">
<div class="datasource-icon" slot="icon"> <IntegrationIcon
<IntegrationIcon integrationType={datasource.source}
integrationType={datasource.source} schema={datasource.schema}
schema={datasource.schema} size="18"
size="18" />
/> </div>
</div> {#if datasource._id !== BUDIBASE_INTERNAL_DB_ID}
{#if datasource._id !== BUDIBASE_INTERNAL_DB_ID} <EditDatasourcePopover {datasource} />
<EditDatasourcePopover {datasource} />
{/if}
</NavItem>
{#if datasource.open}
<TableNavigator tables={datasource.tables} {selectTable} />
{#each datasource.queries as query}
<NavItem
indentLevel={1}
icon="SQLQuery"
iconText={customQueryIconText(datasource, query)}
iconColor={customQueryIconColor(datasource, query)}
text={customQueryText(datasource, query)}
selected={$isActive("./query/:queryId") &&
$queries.selectedQueryId === query._id}
on:click={() => $goto(`./query/${query._id}`)}
selectedBy={$userSelectedResourceMap[query._id]}
>
<EditQueryPopover {query} />
</NavItem>
{/each}
{/if} {/if}
{/each} </NavItem>
{#if showNoResults}
<Layout paddingY="none" paddingX="L"> {#if datasource.open}
<div class="no-results"> <TableNavigator tables={datasource.tables} {selectTable} />
There aren't any datasources matching that name {#each datasource.queries as query}
</div> <NavItem
</Layout> indentLevel={1}
icon="SQLQuery"
iconText={customQueryIconText(datasource, query)}
iconColor={customQueryIconColor(datasource, query)}
text={customQueryText(datasource, query)}
selected={$isActive("./query/:queryId") &&
$queries.selectedQueryId === query._id}
on:click={() => $goto(`./query/${query._id}`)}
selectedBy={$userSelectedResourceMap[query._id]}
>
<EditQueryPopover {query} />
</NavItem>
{/each}
{/if} {/if}
</div> {/each}
{/if} {#if showNoResults}
<Layout paddingY="none" paddingX="L">
<div class="no-results">
There aren't any datasources matching that name
</div>
</Layout>
{/if}
</div>
<style> <style>
.hierarchy-items-container { .hierarchy-items-container {

View File

@ -16,7 +16,7 @@ import Firebase from "./Firebase.svelte"
import Redis from "./Redis.svelte" import Redis from "./Redis.svelte"
import Snowflake from "./Snowflake.svelte" import Snowflake from "./Snowflake.svelte"
import Custom from "./Custom.svelte" import Custom from "./Custom.svelte"
import { integrations } from "stores/backend" import { integrations } from "stores/builder"
import { get } from "svelte/store" import { get } from "svelte/store"
const ICONS = { const ICONS = {

View File

@ -12,7 +12,7 @@
TextArea, TextArea,
Dropzone, Dropzone,
} from "@budibase/bbui" } from "@budibase/bbui"
import { datasources, queries } from "stores/backend" import { datasources, queries } from "stores/builder"
import { writable } from "svelte/store" import { writable } from "svelte/store"
export let navigateDatasource = false export let navigateDatasource = false

View File

@ -1,6 +1,6 @@
<script> <script>
import { get } from "svelte/store" import { get } from "svelte/store"
import { datasources, integrations } from "stores/backend" import { datasources, integrations } from "stores/builder"
import { notifications, Input, ModalContent, Modal } from "@budibase/bbui" import { notifications, Input, ModalContent, Modal } from "@budibase/bbui"
import { integrationForDatasource } from "stores/selectors" import { integrationForDatasource } from "stores/selectors"

View File

@ -1,6 +1,6 @@
<script> <script>
import { goto } from "@roxi/routify" import { goto } from "@roxi/routify"
import { datasources } from "stores/backend" import { datasources } from "stores/builder"
import { notifications, ActionMenu, MenuItem, Icon } from "@budibase/bbui" import { notifications, ActionMenu, MenuItem, Icon } from "@budibase/bbui"
import ConfirmDialog from "components/common/ConfirmDialog.svelte" import ConfirmDialog from "components/common/ConfirmDialog.svelte"
import UpdateDatasourceModal from "components/backend/DatasourceNavigator/modals/UpdateDatasourceModal.svelte" import UpdateDatasourceModal from "components/backend/DatasourceNavigator/modals/UpdateDatasourceModal.svelte"

View File

@ -2,7 +2,7 @@
import { goto } from "@roxi/routify" import { goto } from "@roxi/routify"
import { ActionMenu, MenuItem, Icon, notifications } from "@budibase/bbui" import { ActionMenu, MenuItem, Icon, notifications } from "@budibase/bbui"
import ConfirmDialog from "components/common/ConfirmDialog.svelte" import ConfirmDialog from "components/common/ConfirmDialog.svelte"
import { datasources, queries } from "stores/backend" import { datasources, queries } from "stores/builder"
export let query export let query

View File

@ -13,7 +13,7 @@
Body, Body,
Helpers, Helpers,
} from "@budibase/bbui" } from "@budibase/bbui"
import { tables } from "stores/backend" import { tables } from "stores/builder"
import { RelationshipErrorChecker } from "./relationshipErrors" import { RelationshipErrorChecker } from "./relationshipErrors"
import { onMount } from "svelte" import { onMount } from "svelte"
import RelationshipSelector from "components/common/RelationshipSelector.svelte" import RelationshipSelector from "components/common/RelationshipSelector.svelte"

View File

@ -2,7 +2,7 @@
import { Modal } from "@budibase/bbui" import { Modal } from "@budibase/bbui"
import { get } from "svelte/store" import { get } from "svelte/store"
import CreateEditRelationship from "./CreateEditRelationship.svelte" import CreateEditRelationship from "./CreateEditRelationship.svelte"
import { integrations, datasources } from "stores/backend" import { integrations, datasources } from "stores/builder"
import { integrationForDatasource } from "stores/selectors" import { integrationForDatasource } from "stores/selectors"
export let datasource export let datasource

View File

@ -1,6 +1,6 @@
import { derived, writable, get } from "svelte/store" import { derived, writable, get } from "svelte/store"
import { keepOpen, notifications } from "@budibase/bbui" import { keepOpen, notifications } from "@budibase/bbui"
import { datasources, tables } from "stores/backend" import { datasources, tables } from "stores/builder"
export const createTableSelectionStore = (integration, datasource) => { export const createTableSelectionStore = (integration, datasource) => {
const tableNamesStore = writable([]) const tableNamesStore = writable([])

View File

@ -3,14 +3,13 @@
tables as tablesStore, tables as tablesStore,
views, views,
viewsV2, viewsV2,
database, userSelectedResourceMap,
} from "stores/backend" } from "stores/builder"
import { TableNames } from "constants" import { TableNames } from "constants"
import EditTablePopover from "./popovers/EditTablePopover.svelte" import EditTablePopover from "./popovers/EditTablePopover.svelte"
import EditViewPopover from "./popovers/EditViewPopover.svelte" import EditViewPopover from "./popovers/EditViewPopover.svelte"
import NavItem from "components/common/NavItem.svelte" import NavItem from "components/common/NavItem.svelte"
import { goto, isActive } from "@roxi/routify" import { goto, isActive } from "@roxi/routify"
import { userSelectedResourceMap } from "builderStore"
export let tables export let tables
export let selectTable export let selectTable
@ -29,42 +28,40 @@
} }
</script> </script>
{#if $database?._id} <div class="hierarchy-items-container">
<div class="hierarchy-items-container"> {#each sortedTables as table, idx}
{#each sortedTables as table, idx} <NavItem
indentLevel={1}
border={idx > 0}
icon={table._id === TableNames.USERS ? "UserGroup" : "Table"}
text={table.name}
selected={$isActive("./table/:tableId") &&
$tablesStore.selected?._id === table._id}
on:click={() => selectTable(table._id)}
selectedBy={$userSelectedResourceMap[table._id]}
>
{#if table._id !== TableNames.USERS}
<EditTablePopover {table} />
{/if}
</NavItem>
{#each [...Object.entries(table.views || {})].sort() as [name, view], idx (idx)}
<NavItem <NavItem
indentLevel={1} indentLevel={2}
border={idx > 0} icon="Remove"
icon={table._id === TableNames.USERS ? "UserGroup" : "Table"} text={name}
text={table.name} selected={isViewActive(view, $isActive, $views, $viewsV2)}
selected={$isActive("./table/:tableId") && on:click={() => {
$tablesStore.selected?._id === table._id} if (view.version === 2) {
on:click={() => selectTable(table._id)} $goto(`./view/v2/${encodeURIComponent(view.id)}`)
selectedBy={$userSelectedResourceMap[table._id]} } else {
$goto(`./view/v1/${encodeURIComponent(name)}`)
}
}}
selectedBy={$userSelectedResourceMap[name] ||
$userSelectedResourceMap[view.id]}
> >
{#if table._id !== TableNames.USERS} <EditViewPopover {view} />
<EditTablePopover {table} />
{/if}
</NavItem> </NavItem>
{#each [...Object.entries(table.views || {})].sort() as [name, view], idx (idx)}
<NavItem
indentLevel={2}
icon="Remove"
text={name}
selected={isViewActive(view, $isActive, $views, $viewsV2)}
on:click={() => {
if (view.version === 2) {
$goto(`./view/v2/${encodeURIComponent(view.id)}`)
} else {
$goto(`./view/v1/${encodeURIComponent(name)}`)
}
}}
selectedBy={$userSelectedResourceMap[name] ||
$userSelectedResourceMap[view.id]}
>
<EditViewPopover {view} />
</NavItem>
{/each}
{/each} {/each}
</div> {/each}
{/if} </div>

View File

@ -1,6 +1,6 @@
<script> <script>
import { goto, url } from "@roxi/routify" import { goto, url } from "@roxi/routify"
import { tables, datasources } from "stores/backend" import { tables, datasources } from "stores/builder"
import { import {
notifications, notifications,
Input, Input,

View File

@ -1,8 +1,7 @@
<script> <script>
import { goto, params } from "@roxi/routify" import { goto, params } from "@roxi/routify"
import { store } from "builderStore"
import { cloneDeep } from "lodash/fp" import { cloneDeep } from "lodash/fp"
import { tables, datasources } from "stores/backend" import { tables, datasources, screenStore } from "stores/builder"
import { import {
ActionMenu, ActionMenu,
Icon, Icon,
@ -32,7 +31,7 @@
$: allowDeletion = !externalTable || table?.created $: allowDeletion = !externalTable || table?.created
function showDeleteModal() { function showDeleteModal() {
templateScreens = $store.screens.filter( templateScreens = $screenStore.screens.filter(
screen => screen.autoTableId === table._id screen => screen.autoTableId === table._id
) )
willBeDeleted = ["All table data"].concat( willBeDeleted = ["All table data"].concat(
@ -47,7 +46,7 @@
await tables.delete(table) await tables.delete(table)
// Screens need deleted one at a time because of undo/redo // Screens need deleted one at a time because of undo/redo
for (let screen of templateScreens) { for (let screen of templateScreens) {
await store.actions.screens.delete(screen) await screenStore.delete(screen)
} }
if (table.sourceType === DB_TYPE_EXTERNAL) { if (table.sourceType === DB_TYPE_EXTERNAL) {
await datasources.fetch() await datasources.fetch()

View File

@ -1,5 +1,5 @@
<script> <script>
import { views, viewsV2 } from "stores/backend" import { views, viewsV2 } from "stores/builder"
import { cloneDeep } from "lodash/fp" import { cloneDeep } from "lodash/fp"
import ConfirmDialog from "components/common/ConfirmDialog.svelte" import ConfirmDialog from "components/common/ConfirmDialog.svelte"
import { import {

View File

@ -10,12 +10,17 @@
import { API } from "api" import { API } from "api"
import { goto } from "@roxi/routify" import { goto } from "@roxi/routify"
import { import {
store,
sortedScreens,
automationStore, automationStore,
themeStore, previewStore,
} from "builderStore" builderStore,
import { datasources, queries, tables, views } from "stores/backend" sortedScreens,
appStore,
datasources,
queries,
tables,
views,
} from "stores/builder"
import { themeStore } from "stores/portal"
import { getContext } from "svelte" import { getContext } from "svelte"
import { Constants } from "@budibase/frontend-core" import { Constants } from "@budibase/frontend-core"
@ -26,8 +31,7 @@
name: "Invite users and manage app access", name: "Invite users and manage app access",
description: "", description: "",
icon: "User", icon: "User",
action: () => action: () => builderStore.showBuilderSidePanel(),
store.update(state => ({ ...state, builderSidePanel: true })),
}, },
{ {
type: "Navigate", type: "Navigate",
@ -69,13 +73,13 @@
name: "App", name: "App",
description: "", description: "",
icon: "Play", icon: "Play",
action: () => store.update(state => ({ ...state, showPreview: true })), action: () => previewStore.showPreview(true),
}, },
{ {
type: "Preview", type: "Preview",
name: "Published App", name: "Published App",
icon: "Play", icon: "Play",
action: () => window.open(`/app${$store.url}`), action: () => window.open(`/app${$appStore.url}`),
}, },
{ {
type: "Support", type: "Support",
@ -216,7 +220,7 @@
async function deployApp() { async function deployApp() {
try { try {
await API.publishAppChanges($store.appId) await API.publishAppChanges($appStore.appId)
notifications.success("App published successfully") notifications.success("App published successfully")
} catch (error) { } catch (error) {
notifications.error("Error publishing app") notifications.error("Error publishing app")

View File

@ -43,7 +43,7 @@
import { Compartment } from "@codemirror/state" import { Compartment } from "@codemirror/state"
import { javascript } from "@codemirror/lang-javascript" import { javascript } from "@codemirror/lang-javascript"
import { EditorModes, getDefaultTheme } from "./" import { EditorModes, getDefaultTheme } from "./"
import { themeStore } from "builderStore" import { themeStore } from "stores/portal"
export let label export let label
export let completions = [] export let completions = []

View File

@ -27,7 +27,7 @@
<script> <script>
import { Label } from "@budibase/bbui" import { Label } from "@budibase/bbui"
import CodeMirror from "components/integration/codemirror" import CodeMirror from "components/integration/codemirror"
import { themeStore } from "builderStore" import { themeStore } from "stores/portal"
import { createEventDispatcher, onMount } from "svelte" import { createEventDispatcher, onMount } from "svelte"
export let mode = EditorModes.JS export let mode = EditorModes.JS

View File

@ -1,8 +1,8 @@
<script> <script>
import { tables } from "stores/backend" import { tables } from "stores/builder"
import { API } from "api" import { API } from "api"
import { Select, Label, Multiselect } from "@budibase/bbui" import { Select, Label, Multiselect } from "@budibase/bbui"
import { capitalise } from "../../helpers" import { capitalise } from "helpers"
import { createEventDispatcher } from "svelte" import { createEventDispatcher } from "svelte"
export let schema export let schema

View File

@ -1,6 +1,6 @@
<script> <script>
import { Select, FancySelect } from "@budibase/bbui" import { Select, FancySelect } from "@budibase/bbui"
import { roles } from "stores/backend" import { roles } from "stores/builder"
import { licensing } from "stores/portal" import { licensing } from "stores/portal"
import { Constants, RoleUtils } from "@budibase/frontend-core" import { Constants, RoleUtils } from "@budibase/frontend-core"

View File

@ -3,7 +3,7 @@
import { import {
readableToRuntimeBinding, readableToRuntimeBinding,
runtimeToReadableBinding, runtimeToReadableBinding,
} from "builderStore/dataBinding" } from "dataBinding"
import { createEventDispatcher } from "svelte" import { createEventDispatcher } from "svelte"
import { isJSBinding } from "@budibase/string-templates" import { isJSBinding } from "@budibase/string-templates"

View File

@ -19,7 +19,7 @@
import { import {
readableToRuntimeBinding, readableToRuntimeBinding,
runtimeToReadableBinding, runtimeToReadableBinding,
} from "builderStore/dataBinding" } from "dataBinding"
import { admin } from "stores/portal" import { admin } from "stores/portal"
import CodeEditor from "../CodeEditor/CodeEditor.svelte" import CodeEditor from "../CodeEditor/CodeEditor.svelte"

View File

@ -3,7 +3,7 @@
import { import {
readableToRuntimeBinding, readableToRuntimeBinding,
runtimeToReadableBinding, runtimeToReadableBinding,
} from "builderStore/dataBinding" } from "dataBinding"
import ClientBindingPanel from "components/common/bindings/ClientBindingPanel.svelte" import ClientBindingPanel from "components/common/bindings/ClientBindingPanel.svelte"
import { createEventDispatcher, setContext } from "svelte" import { createEventDispatcher, setContext } from "svelte"
import { isJSBinding } from "@budibase/string-templates" import { isJSBinding } from "@budibase/string-templates"

View File

@ -3,11 +3,12 @@
import { import {
readableToRuntimeBinding, readableToRuntimeBinding,
runtimeToReadableBinding, runtimeToReadableBinding,
} from "builderStore/dataBinding" } from "dataBinding"
import ClientBindingPanel from "components/common/bindings/ClientBindingPanel.svelte" import ClientBindingPanel from "components/common/bindings/ClientBindingPanel.svelte"
import { createEventDispatcher, setContext } from "svelte" import { createEventDispatcher, setContext } from "svelte"
import { isJSBinding } from "@budibase/string-templates" import { isJSBinding } from "@budibase/string-templates"
import { builderStore } from "stores/builder"
export let panel = ClientBindingPanel export let panel = ClientBindingPanel
export let value = "" export let value = ""
@ -21,6 +22,7 @@
export let allowHelpers = true export let allowHelpers = true
export let updateOnChange = true export let updateOnChange = true
export let drawerLeft export let drawerLeft
export let key
export let disableBindings = false export let disableBindings = false
const dispatch = createEventDispatcher() const dispatch = createEventDispatcher()
@ -35,6 +37,7 @@
const saveBinding = () => { const saveBinding = () => {
onChange(tempValue) onChange(tempValue)
onBlur() onBlur()
builderStore.propertyFocus()
bindingDrawer.hide() bindingDrawer.hide()
} }
@ -50,6 +53,11 @@
const onBlur = () => { const onBlur = () => {
dispatch("blur", currentVal) dispatch("blur", currentVal)
} }
const onDrawerHide = e => {
builderStore.propertyFocus()
dispatch("drawerHide", e.detail)
}
</script> </script>
<div class="control" class:disabled> <div class="control" class:disabled>
@ -67,6 +75,7 @@
<div <div
class="icon" class="icon"
on:click={() => { on:click={() => {
builderStore.propertyFocus(key)
bindingDrawer.show() bindingDrawer.show()
}} }}
> >
@ -75,7 +84,7 @@
{/if} {/if}
</div> </div>
<Drawer <Drawer
on:drawerHide on:drawerHide={onDrawerHide}
on:drawerShow on:drawerShow
{fillWidth} {fillWidth}
bind:this={bindingDrawer} bind:this={bindingDrawer}

View File

@ -3,7 +3,7 @@
import { import {
readableToRuntimeBinding, readableToRuntimeBinding,
runtimeToReadableBinding, runtimeToReadableBinding,
} from "builderStore/dataBinding" } from "dataBinding"
import ClientBindingPanel from "components/common/bindings/ClientBindingPanel.svelte" import ClientBindingPanel from "components/common/bindings/ClientBindingPanel.svelte"
import { createEventDispatcher, setContext } from "svelte" import { createEventDispatcher, setContext } from "svelte"

View File

@ -3,7 +3,7 @@
import { import {
readableToRuntimeBinding, readableToRuntimeBinding,
runtimeToReadableBinding, runtimeToReadableBinding,
} from "builderStore/dataBinding" } from "dataBinding"
import ServerBindingPanel from "components/common/bindings/ServerBindingPanel.svelte" import ServerBindingPanel from "components/common/bindings/ServerBindingPanel.svelte"
import { createEventDispatcher } from "svelte" import { createEventDispatcher } from "svelte"
import { isJSBinding } from "@budibase/string-templates" import { isJSBinding } from "@budibase/string-templates"

View File

@ -1,9 +1,6 @@
<script> <script>
import { Layout, Input } from "@budibase/bbui" import { Layout, Input } from "@budibase/bbui"
import { import { createValidationStore, requiredValidator } from "helpers/validation"
createValidationStore,
requiredValidator,
} from "../../../helpers/validation"
export let password export let password
export let error export let error

View File

@ -21,11 +21,14 @@
import { API } from "api" import { API } from "api"
import { apps } from "stores/portal" import { apps } from "stores/portal"
import { import {
deploymentStore, previewStore,
store, builderStore,
isOnlyUser, isOnlyUser,
appStore,
deploymentStore,
initialise,
sortedScreens, sortedScreens,
} from "builderStore" } from "stores/builder"
import TourWrap from "components/portal/onboarding/TourWrap.svelte" import TourWrap from "components/portal/onboarding/TourWrap.svelte"
import { TOUR_STEP_KEYS } from "components/portal/onboarding/tours.js" import { TOUR_STEP_KEYS } from "components/portal/onboarding/tours.js"
import { goto } from "@roxi/routify" import { goto } from "@roxi/routify"
@ -50,15 +53,15 @@
$: isPublished = $: isPublished =
selectedApp?.status === "published" && latestDeployments?.length > 0 selectedApp?.status === "published" && latestDeployments?.length > 0
$: updateAvailable = $: updateAvailable =
$store.upgradableVersion && $appStore.upgradableVersion &&
$store.version && $appStore.version &&
$store.upgradableVersion !== $store.version $appStore.upgradableVersion !== $appStore.version
$: canPublish = !publishing && loaded && $sortedScreens.length > 0 $: canPublish = !publishing && loaded && $sortedScreens.length > 0
$: lastDeployed = getLastDeployedString($deploymentStore) $: lastDeployed = getLastDeployedString($deploymentStore)
const initialiseApp = async () => { const initialiseApp = async () => {
const applicationPkg = await API.fetchAppPackage($store.devId) const applicationPkg = await API.fetchAppPackage($appStore.devId)
await store.actions.initialise(applicationPkg) await initialise(applicationPkg)
} }
const getLastDeployedString = deployments => { const getLastDeployedString = deployments => {
@ -71,10 +74,7 @@
} }
const previewApp = () => { const previewApp = () => {
store.update(state => ({ previewStore.showPreview(true)
...state,
showPreview: true,
}))
} }
const viewApp = () => { const viewApp = () => {
@ -92,7 +92,7 @@
async function publishApp() { async function publishApp() {
try { try {
publishing = true publishing = true
await API.publishAppChanges($store.appId) await API.publishAppChanges($appStore.appId)
notifications.send("App published successfully", { notifications.send("App published successfully", {
type: "success", type: "success",
icon: "GlobeCheck", icon: "GlobeCheck",
@ -101,7 +101,13 @@
} catch (error) { } catch (error) {
console.error(error) console.error(error)
analytics.captureException(error) analytics.captureException(error)
notifications.error("Error publishing app") const baseMsg = "Error publishing app"
const message = error.message
if (message) {
notifications.error(`${baseMsg} - ${message}`)
} else {
notifications.error(baseMsg)
}
} }
publishing = false publishing = false
} }
@ -136,7 +142,7 @@
const completePublish = async () => { const completePublish = async () => {
try { try {
await apps.load() await apps.load()
await deploymentStore.actions.load() await deploymentStore.load()
} catch (err) { } catch (err) {
notifications.error("Error refreshing app") notifications.error("Error refreshing app")
} }
@ -167,10 +173,7 @@
quiet quiet
icon="UserGroup" icon="UserGroup"
on:click={() => { on:click={() => {
store.update(state => { builderStore.showBuilderSidePanel()
state.builderSidePanel = true
return state
})
}} }}
> >
Users Users
@ -243,7 +246,7 @@
} }
}} }}
> >
{$store.url} {$appStore.url}
{#if isPublished} {#if isPublished}
<Icon size="S" name="LinkOut" /> <Icon size="S" name="LinkOut" />
{:else} {:else}
@ -324,10 +327,10 @@
<Modal bind:this={updateAppModal} padding={false} width="600px"> <Modal bind:this={updateAppModal} padding={false} width="600px">
<UpdateAppModal <UpdateAppModal
app={{ app={{
name: $store.name, name: $appStore.name,
url: $store.url, url: $appStore.url,
icon: $store.icon, icon: $appStore.icon,
appId: $store.appId, appId: $appStore.appId,
}} }}
onUpdateComplete={async () => { onUpdateComplete={async () => {
await initialiseApp() await initialiseApp()

View File

@ -1,5 +1,5 @@
<script> <script>
import { automationStore } from "builderStore" import { automationStore } from "stores/builder"
import { ModalContent } from "@budibase/bbui" import { ModalContent } from "@budibase/bbui"
import { onMount } from "svelte" import { onMount } from "svelte"
import WebhookDisplay from "../automation/Shared/WebhookDisplay.svelte" import WebhookDisplay from "../automation/Shared/WebhookDisplay.svelte"

View File

@ -1,9 +1,9 @@
<script> <script>
import { Input, notifications } from "@budibase/bbui" import { Input, notifications } from "@budibase/bbui"
import { goto } from "@roxi/routify" import { goto } from "@roxi/routify"
import { store } from "builderStore"
import ConfirmDialog from "components/common/ConfirmDialog.svelte" import ConfirmDialog from "components/common/ConfirmDialog.svelte"
import { apps } from "stores/portal" import { apps } from "stores/portal"
import { appStore } from "stores/builder"
import { API } from "api" import { API } from "api"
export const show = () => { export const show = () => {
@ -19,7 +19,7 @@
const deleteApp = async () => { const deleteApp = async () => {
try { try {
await API.deleteApp($store.appId) await API.deleteApp($appStore.appId)
apps.load() apps.load()
notifications.success("App deleted successfully") notifications.success("App deleted successfully")
$goto("/builder") $goto("/builder")
@ -35,11 +35,14 @@
okText="Delete" okText="Delete"
onOk={deleteApp} onOk={deleteApp}
onCancel={() => (deletionConfirmationAppName = null)} onCancel={() => (deletionConfirmationAppName = null)}
disabled={deletionConfirmationAppName !== $store.name} disabled={deletionConfirmationAppName !== $appStore.name}
> >
Are you sure you want to delete <b>{$store.name}</b>? Are you sure you want to delete <b>{$appStore.name}</b>?
<br /> <br />
Please enter the app name below to confirm. Please enter the app name below to confirm.
<br /><br /> <br /><br />
<Input bind:value={deletionConfirmationAppName} placeholder={$store.name} /> <Input
bind:value={deletionConfirmationAppName}
placeholder={$appStore.name}
/>
</ConfirmDialog> </ConfirmDialog>

View File

@ -1,6 +1,6 @@
<script> <script>
import { Input, Modal, notifications, ModalContent } from "@budibase/bbui" import { Input, Modal, notifications, ModalContent } from "@budibase/bbui"
import { store } from "builderStore" import { appStore, initialise } from "stores/builder"
import { API } from "api" import { API } from "api"
export let onComplete = () => {} export let onComplete = () => {}
@ -8,7 +8,7 @@
let revertModal let revertModal
let appName let appName
$: appId = $store.appId $: appId = $appStore.appId
const revert = async () => { const revert = async () => {
try { try {
@ -16,7 +16,7 @@
// Reset frontend state after revert // Reset frontend state after revert
const applicationPkg = await API.fetchAppPackage(appId) const applicationPkg = await API.fetchAppPackage(appId)
await store.actions.initialise(applicationPkg) await initialise(applicationPkg)
notifications.info("Changes reverted successfully") notifications.info("Changes reverted successfully")
onComplete() onComplete()
} catch (error) { } catch (error) {
@ -38,7 +38,7 @@
title="Revert Changes" title="Revert Changes"
confirmText="Revert" confirmText="Revert"
onConfirm={revert} onConfirm={revert}
disabled={appName !== $store.name} disabled={appName !== $appStore.name}
> >
<span <span
>The changes you have made will be deleted and the application reverted >The changes you have made will be deleted and the application reverted

View File

@ -7,7 +7,7 @@
Button, Button,
StatusLight, StatusLight,
} from "@budibase/bbui" } from "@budibase/bbui"
import { store } from "builderStore" import { appStore, initialise } from "stores/builder"
import { API } from "api" import { API } from "api"
export function show() { export function show() {
@ -23,17 +23,17 @@
let updateModal let updateModal
$: appId = $store.appId $: appId = $appStore.appId
$: updateAvailable = $: updateAvailable =
$store.upgradableVersion && $appStore.upgradableVersion &&
$store.version && $appStore.version &&
$store.upgradableVersion !== $store.version $appStore.upgradableVersion !== $appStore.version
$: revertAvailable = $store.revertableVersion != null $: revertAvailable = $appStore.revertableVersion != null
const refreshAppPackage = async () => { const refreshAppPackage = async () => {
try { try {
const pkg = await API.fetchAppPackage(appId) const pkg = await API.fetchAppPackage(appId)
await store.actions.initialise(pkg) await initialise(pkg)
} catch (error) { } catch (error) {
notifications.error("Error fetching app package") notifications.error("Error fetching app package")
} }
@ -46,7 +46,7 @@
// Don't wait for the async refresh, since this causes modal flashing // Don't wait for the async refresh, since this causes modal flashing
refreshAppPackage() refreshAppPackage()
notifications.success( notifications.success(
`App updated successfully to version ${$store.upgradableVersion}` `App updated successfully to version ${$appStore.upgradableVersion}`
) )
onComplete() onComplete()
} catch (err) { } catch (err) {
@ -62,7 +62,7 @@
// Don't wait for the async refresh, since this causes modal flashing // Don't wait for the async refresh, since this causes modal flashing
refreshAppPackage() refreshAppPackage()
notifications.success( notifications.success(
`App reverted successfully to version ${$store.revertableVersion}` `App reverted successfully to version ${$appStore.revertableVersion}`
) )
} catch (err) { } catch (err) {
notifications.error(`Error reverting app: ${err}`) notifications.error(`Error reverting app: ${err}`)
@ -89,20 +89,21 @@
</div> </div>
{#if updateAvailable} {#if updateAvailable}
<Body size="S"> <Body size="S">
This app is currently using version <b>{$store.version}</b>, but version This app is currently using version <b>{$appStore.version}</b>, but
<b>{$store.upgradableVersion}</b> is available. Updates can contain new features, version
performance improvements and bug fixes. <b>{$appStore.upgradableVersion}</b> is available. Updates can contain new
features, performance improvements and bug fixes.
</Body> </Body>
{:else} {:else}
<Body size="S"> <Body size="S">
This app is currently using version <b>{$store.version}</b> which is the This app is currently using version <b>{$appStore.version}</b> which is the
latest version available. latest version available.
</Body> </Body>
{/if} {/if}
{#if revertAvailable} {#if revertAvailable}
<Body size="S"> <Body size="S">
You can revert this app to version You can revert this app to version
<b>{$store.revertableVersion}</b> <b>{$appStore.revertableVersion}</b>
if you're experiencing issues with the current version. if you're experiencing issues with the current version.
</Body> </Body>
{/if} {/if}

View File

@ -1,8 +1,8 @@
<script> <script>
import { ModalContent, Input } from "@budibase/bbui" import { ModalContent, Input } from "@budibase/bbui"
import sanitizeUrl from "builderStore/store/screenTemplates/utils/sanitizeUrl" import sanitizeUrl from "helpers/sanitizeUrl"
import { get } from "svelte/store" import { get } from "svelte/store"
import { store } from "builderStore" import { screenStore } from "stores/builder"
export let onConfirm export let onConfirm
export let onCancel export let onCancel
@ -36,7 +36,7 @@
if (!screenRole) { if (!screenRole) {
return false return false
} }
return get(store).screens.some( return get(screenStore).screens.some(
screen => screen =>
screen.routing.route.toLowerCase() === url.toLowerCase() && screen.routing.route.toLowerCase() === url.toLowerCase() &&
screen.routing.roleId === screenRole screen.routing.roleId === screenRole

View File

@ -16,7 +16,7 @@
getActionBindings, getActionBindings,
makeStateBinding, makeStateBinding,
updateReferencesInObject, updateReferencesInObject,
} from "builderStore/dataBinding" } from "dataBinding"
import { cloneDeep } from "lodash/fp" import { cloneDeep } from "lodash/fp"
const flipDurationMs = 150 const flipDurationMs = 150

View File

@ -1,7 +1,7 @@
<script> <script>
import { Select, Label } from "@budibase/bbui" import { Select, Label } from "@budibase/bbui"
import { currentAsset, store } from "builderStore" import { selectedScreen, componentStore } from "stores/builder"
import { getActionProviders } from "builderStore/dataBinding" import { getActionProviders } from "dataBinding"
import { onMount } from "svelte" import { onMount } from "svelte"
import DrawerBindableInput from "components/common/bindings/DrawerBindableInput.svelte" import DrawerBindableInput from "components/common/bindings/DrawerBindableInput.svelte"
@ -10,8 +10,8 @@
export let nested export let nested
$: actionProviders = getActionProviders( $: actionProviders = getActionProviders(
$currentAsset, $selectedScreen,
$store.selectedComponentId, $componentStore.selectedComponentId,
"ChangeFormStep", "ChangeFormStep",
{ includeSelf: nested } { includeSelf: nested }
) )

View File

@ -1,14 +1,14 @@
<script> <script>
import { Select, Label } from "@budibase/bbui" import { Select, Label } from "@budibase/bbui"
import { currentAsset, store } from "builderStore" import { selectedScreen, componentStore } from "stores/builder"
import { getActionProviders } from "builderStore/dataBinding" import { getActionProviders } from "dataBinding"
export let parameters export let parameters
export let nested export let nested
$: actionProviders = getActionProviders( $: actionProviders = getActionProviders(
$currentAsset, $selectedScreen,
$store.selectedComponentId, $componentStore.selectedComponentId,
"ClearForm", "ClearForm",
{ includeSelf: nested } { includeSelf: nested }
) )

View File

@ -0,0 +1,55 @@
<script>
import { Label, Select, Body } from "@budibase/bbui"
import { findAllMatchingComponents } from "helpers/components"
import { selectedScreen } from "stores/builder"
export let parameters
$: tables = findAllMatchingComponents($selectedScreen?.props, component =>
component._component.endsWith("table")
).map(table => ({
label: table._instanceName,
value: table._id,
}))
$: tableBlocks = findAllMatchingComponents(
$selectedScreen?.props,
component => component._component.endsWith("tableblock")
).map(block => ({
label: block._instanceName,
value: `${block._id}-table`,
}))
$: componentOptions = tables.concat(tableBlocks)
</script>
<div class="root">
<Body size="S">Clear the row selection from the selected table.</Body>
<div class="params">
<Label small>Table</Label>
<Select bind:value={parameters.componentId} options={componentOptions} />
</div>
</div>
<style>
.root {
width: 100%;
max-width: 500px;
margin: 0 auto;
display: flex;
flex-direction: column;
justify-content: flex-start;
align-items: stretch;
gap: var(--spacing-xl);
}
.root :global(p) {
line-height: 1.5;
}
.params {
display: grid;
column-gap: var(--spacing-xs);
row-gap: var(--spacing-s);
grid-template-columns: 90px 1fr;
align-items: center;
}
</style>

View File

@ -1,6 +1,6 @@
<script> <script>
import { Select, Label, Checkbox, Input, Body } from "@budibase/bbui" import { Select, Label, Checkbox, Input, Body } from "@budibase/bbui"
import { tables, viewsV2 } from "stores/backend" import { tables, viewsV2 } from "stores/builder"
import DrawerBindableInput from "components/common/bindings/DrawerBindableInput.svelte" import DrawerBindableInput from "components/common/bindings/DrawerBindableInput.svelte"
export let parameters export let parameters

View File

@ -1,8 +1,12 @@
<script> <script>
import { Select, Label, Body, Checkbox, Input } from "@budibase/bbui" import { Select, Label, Body, Checkbox, Input } from "@budibase/bbui"
import { store, currentAsset } from "builderStore" import {
import { tables, viewsV2 } from "stores/backend" selectedScreen,
import { getSchemaForDatasourcePlus } from "builderStore/dataBinding" componentStore,
tables,
viewsV2,
} from "stores/builder"
import { getSchemaForDatasourcePlus } from "dataBinding"
import SaveFields from "./SaveFields.svelte" import SaveFields from "./SaveFields.svelte"
import { getDatasourceLikeProviders } from "components/design/settings/controls/ButtonActionEditor/actions/utils" import { getDatasourceLikeProviders } from "components/design/settings/controls/ButtonActionEditor/actions/utils"
@ -11,8 +15,8 @@
export let nested export let nested
$: providerOptions = getDatasourceLikeProviders({ $: providerOptions = getDatasourceLikeProviders({
asset: $currentAsset, asset: $selectedScreen,
componentId: $store.selectedComponentId, componentId: $componentStore.selectedComponentId,
nested, nested,
}) })
$: schemaFields = getSchemaFields(parameters?.tableId) $: schemaFields = getSchemaFields(parameters?.tableId)

View File

@ -1,6 +1,6 @@
<script> <script>
import { Select, Layout, Input, Checkbox } from "@budibase/bbui" import { Select, Layout, Input, Checkbox } from "@budibase/bbui"
import { datasources, integrations, queries } from "stores/backend" import { datasources, integrations, queries } from "stores/builder"
import BindingBuilder from "components/integration/QueryBindingBuilder.svelte" import BindingBuilder from "components/integration/QueryBindingBuilder.svelte"
import IntegrationQueryEditor from "components/integration/index.svelte" import IntegrationQueryEditor from "components/integration/index.svelte"
import { import {

View File

@ -1,15 +1,9 @@
<script> <script>
import { Label, Select, Body, Multiselect } from "@budibase/bbui" import { Label, Select, Body, Multiselect } from "@budibase/bbui"
import { import { findAllMatchingComponents, findComponent } from "helpers/components"
findAllMatchingComponents, import { selectedScreen } from "stores/builder"
findComponent,
} from "builderStore/componentUtils"
import { currentAsset } from "builderStore"
import { onMount } from "svelte" import { onMount } from "svelte"
import { import { getDatasourceForProvider, getSchemaForDatasource } from "dataBinding"
getDatasourceForProvider,
getSchemaForDatasource,
} from "builderStore/dataBinding"
export let parameters export let parameters
@ -24,14 +18,15 @@
}, },
] ]
$: tables = findAllMatchingComponents($currentAsset?.props, component => $: tables = findAllMatchingComponents($selectedScreen?.props, component =>
component._component.endsWith("table") component._component.endsWith("table")
).map(table => ({ ).map(table => ({
label: table._instanceName, label: table._instanceName,
value: table._id, value: table._id,
})) }))
$: tableBlocks = findAllMatchingComponents($currentAsset?.props, component => $: tableBlocks = findAllMatchingComponents(
component._component.endsWith("tableblock") $selectedScreen?.props,
component => component._component.endsWith("tableblock")
).map(block => ({ ).map(block => ({
label: block._instanceName, label: block._instanceName,
value: `${block._id}-table`, value: `${block._id}-table`,
@ -44,9 +39,9 @@
if (tableId?.includes("-")) { if (tableId?.includes("-")) {
tableId = tableId.split("-")[0] tableId = tableId.split("-")[0]
} }
const selectedTable = findComponent($currentAsset?.props, tableId) const selectedTable = findComponent($selectedScreen?.props, tableId)
const datasource = getDatasourceForProvider($currentAsset, selectedTable) const datasource = getDatasourceForProvider($selectedScreen, selectedTable)
const { schema } = getSchemaForDatasource($currentAsset, datasource) const { schema } = getSchemaForDatasource($selectedScreen, datasource)
return Object.keys(schema || {}) return Object.keys(schema || {})
} }

View File

@ -1,6 +1,6 @@
<script> <script>
import { Select, Label } from "@budibase/bbui" import { Select, Label } from "@budibase/bbui"
import { tables, viewsV2 } from "stores/backend" import { tables, viewsV2 } from "stores/builder"
import DrawerBindableInput from "components/common/bindings/DrawerBindableInput.svelte" import DrawerBindableInput from "components/common/bindings/DrawerBindableInput.svelte"
export let parameters export let parameters

View File

@ -1,5 +1,5 @@
<script> <script>
import { store } from "builderStore" import { screenStore } from "stores/builder"
import { onMount } from "svelte" import { onMount } from "svelte"
import { Label, Checkbox, Select } from "@budibase/bbui" import { Label, Checkbox, Select } from "@budibase/bbui"
import DrawerBindableInput from "components/common/bindings/DrawerBindableInput.svelte" import DrawerBindableInput from "components/common/bindings/DrawerBindableInput.svelte"
@ -8,7 +8,7 @@
export let parameters export let parameters
export let bindings = [] export let bindings = []
$: urlOptions = $store.screens $: urlOptions = $screenStore.screens
.map(screen => screen.routing?.route) .map(screen => screen.routing?.route)
.filter(x => x != null) .filter(x => x != null)

View File

@ -1,7 +1,7 @@
<script> <script>
import { Select, Label } from "@budibase/bbui" import { Select, Label } from "@budibase/bbui"
import { selectedScreen } from "builderStore" import { selectedScreen } from "stores/builder"
import { findAllMatchingComponents } from "builderStore/componentUtils" import { findAllMatchingComponents } from "helpers/components"
export let parameters export let parameters

View File

@ -1,14 +1,14 @@
<script> <script>
import { Select, Label } from "@budibase/bbui" import { Select, Label } from "@budibase/bbui"
import { currentAsset, store } from "builderStore" import { selectedScreen, componentStore } from "stores/builder"
import { getActionProviders } from "builderStore/dataBinding" import { getActionProviders } from "dataBinding"
export let parameters export let parameters
export let nested export let nested
$: actionProviders = getActionProviders( $: actionProviders = getActionProviders(
$currentAsset, $selectedScreen,
$store.selectedComponentId, $componentStore.selectedComponentId,
"RefreshDatasource", "RefreshDatasource",
{ includeSelf: nested } { includeSelf: nested }
) )

View File

@ -1,11 +1,11 @@
<script> <script>
import { Select, Label } from "@budibase/bbui" import { Select, Label } from "@budibase/bbui"
import { currentAsset } from "builderStore" import { selectedScreen } from "stores/builder"
import { findAllMatchingComponents } from "builderStore/componentUtils" import { findAllMatchingComponents } from "helpers/components"
export let parameters export let parameters
$: components = findAllMatchingComponents($currentAsset?.props, component => $: components = findAllMatchingComponents($selectedScreen?.props, component =>
component._component.endsWith("s3upload") component._component.endsWith("s3upload")
) )
</script> </script>

View File

@ -1,8 +1,12 @@
<script> <script>
import { Select, Label, Body, Checkbox, Input } from "@budibase/bbui" import { Select, Label, Body, Checkbox, Input } from "@budibase/bbui"
import { store, currentAsset } from "builderStore" import {
import { tables, viewsV2 } from "stores/backend" selectedScreen,
import { getSchemaForDatasourcePlus } from "builderStore/dataBinding" componentStore,
tables,
viewsV2,
} from "stores/builder"
import { getSchemaForDatasourcePlus } from "dataBinding"
import SaveFields from "./SaveFields.svelte" import SaveFields from "./SaveFields.svelte"
import { getDatasourceLikeProviders } from "components/design/settings/controls/ButtonActionEditor/actions/utils" import { getDatasourceLikeProviders } from "components/design/settings/controls/ButtonActionEditor/actions/utils"
@ -11,8 +15,8 @@
export let nested export let nested
$: providerOptions = getDatasourceLikeProviders({ $: providerOptions = getDatasourceLikeProviders({
asset: $currentAsset, asset: $selectedScreen,
componentId: $store.selectedComponentId, componentId: $componentStore.selectedComponentId,
nested, nested,
}) })
$: schemaFields = getSchemaFields(parameters?.tableId) $: schemaFields = getSchemaFields(parameters?.tableId)

View File

@ -1,21 +1,21 @@
<script> <script>
import { currentAsset, store } from "builderStore" import { selectedScreen, componentStore } from "stores/builder"
import { Label, Combobox, Select } from "@budibase/bbui" import { Label, Combobox, Select } from "@budibase/bbui"
import { getActionProviders, buildFormSchema } from "builderStore/dataBinding" import { getActionProviders, buildFormSchema } from "dataBinding"
import { findComponent } from "builderStore/componentUtils" import { findComponent } from "helpers/components"
export let parameters export let parameters
export let nested export let nested
$: formComponent = getFormComponent( $: formComponent = getFormComponent(
$currentAsset.props, $selectedScreen.props,
parameters.componentId parameters.componentId
) )
$: formSchema = buildFormSchema(formComponent) $: formSchema = buildFormSchema(formComponent)
$: fieldOptions = Object.keys(formSchema || {}) $: fieldOptions = Object.keys(formSchema || {})
$: actionProviders = getActionProviders( $: actionProviders = getActionProviders(
$currentAsset, $selectedScreen,
$store.selectedComponentId, $componentStore.selectedComponentId,
"ScrollTo", "ScrollTo",
{ includeSelf: nested } { includeSelf: nested }
) )

View File

@ -1,6 +1,6 @@
<script> <script>
import { Select, Label, Input, Checkbox, Icon, Body } from "@budibase/bbui" import { Select, Label, Input, Checkbox, Icon, Body } from "@budibase/bbui"
import { automationStore } from "builderStore" import { automationStore } from "stores/builder"
import DrawerBindableInput from "components/common/bindings/DrawerBindableInput.svelte" import DrawerBindableInput from "components/common/bindings/DrawerBindableInput.svelte"
import { TriggerStepID, ActionStepID } from "constants/backend/automations" import { TriggerStepID, ActionStepID } from "constants/backend/automations"

View File

@ -2,9 +2,9 @@
import { Select, Label, Combobox } from "@budibase/bbui" import { Select, Label, Combobox } from "@budibase/bbui"
import { onMount } from "svelte" import { onMount } from "svelte"
import DrawerBindableInput from "components/common/bindings/DrawerBindableInput.svelte" import DrawerBindableInput from "components/common/bindings/DrawerBindableInput.svelte"
import { currentAsset, store } from "builderStore" import { selectedScreen, componentStore } from "stores/builder"
import { getActionProviders, buildFormSchema } from "builderStore/dataBinding" import { getActionProviders, buildFormSchema } from "dataBinding"
import { findComponent } from "builderStore/componentUtils" import { findComponent } from "helpers/components"
export let parameters export let parameters
export let bindings = [] export let bindings = []
@ -22,14 +22,14 @@
] ]
$: formComponent = getFormComponent( $: formComponent = getFormComponent(
$currentAsset.props, $selectedScreen.props,
parameters.componentId parameters.componentId
) )
$: formSchema = buildFormSchema(formComponent) $: formSchema = buildFormSchema(formComponent)
$: fieldOptions = Object.keys(formSchema || {}) $: fieldOptions = Object.keys(formSchema || {})
$: actionProviders = getActionProviders( $: actionProviders = getActionProviders(
$currentAsset, $selectedScreen,
$store.selectedComponentId, $componentStore.selectedComponentId,
"ValidateForm", "ValidateForm",
{ includeSelf: nested } { includeSelf: nested }
) )

View File

@ -2,7 +2,7 @@
import { Select, Label, Combobox, Checkbox, Body } from "@budibase/bbui" import { Select, Label, Combobox, Checkbox, Body } from "@budibase/bbui"
import { onMount } from "svelte" import { onMount } from "svelte"
import DrawerBindableInput from "components/common/bindings/DrawerBindableInput.svelte" import DrawerBindableInput from "components/common/bindings/DrawerBindableInput.svelte"
import { getAllStateVariables } from "builderStore/dataBinding" import { getAllStateVariables } from "dataBinding"
export let parameters export let parameters
export let bindings = [] export let bindings = []

View File

@ -1,14 +1,14 @@
<script> <script>
import { Select, Label } from "@budibase/bbui" import { Select, Label } from "@budibase/bbui"
import { currentAsset, store } from "builderStore" import { selectedScreen, componentStore } from "stores/builder"
import { getActionProviders } from "builderStore/dataBinding" import { getActionProviders } from "dataBinding"
export let parameters export let parameters
export let nested export let nested
$: actionProviders = getActionProviders( $: actionProviders = getActionProviders(
$currentAsset, $selectedScreen,
$store.selectedComponentId, $componentStore.selectedComponentId,
"ValidateForm", "ValidateForm",
{ includeSelf: nested } { includeSelf: nested }
) )

View File

@ -21,3 +21,4 @@ export { default as ShowNotification } from "./ShowNotification.svelte"
export { default as PromptUser } from "./PromptUser.svelte" export { default as PromptUser } from "./PromptUser.svelte"
export { default as OpenSidePanel } from "./OpenSidePanel.svelte" export { default as OpenSidePanel } from "./OpenSidePanel.svelte"
export { default as CloseSidePanel } from "./CloseSidePanel.svelte" export { default as CloseSidePanel } from "./CloseSidePanel.svelte"
export { default as ClearRowSelection } from "./ClearRowSelection.svelte"

Some files were not shown because too many files have changed in this diff Show More