Merge branch 'develop' of github.com:Budibase/budibase into views-v2-frontend

This commit is contained in:
Andrew Kingston 2023-08-04 11:16:46 +01:00
commit c4bd025011
6 changed files with 47 additions and 22 deletions

View File

@ -1,5 +1,5 @@
{ {
"version": "2.8.29-alpha.14", "version": "2.8.29-alpha.17",
"npmClient": "yarn", "npmClient": "yarn",
"packages": [ "packages": [
"packages/*" "packages/*"

View File

@ -108,10 +108,7 @@
/****************************************************/ /****************************************************/
const getInputData = (testData, blockInputs) => { const getInputData = (testData, blockInputs) => {
let newInputData = testData || blockInputs let newInputData = cloneDeep(testData || blockInputs)
if (block.event === "app:trigger" && !newInputData?.fields) {
newInputData = cloneDeep(blockInputs)
}
/** /**
* TODO - Remove after November 2023 * TODO - Remove after November 2023

View File

@ -50,6 +50,7 @@
type="string" type="string"
{bindings} {bindings}
fillWidth={true} fillWidth={true}
updateOnChange={false}
/> />
{/each} {/each}
</div> </div>

View File

@ -28,25 +28,13 @@
let userInfoModal let userInfoModal
let changePasswordModal let changePasswordModal
onMount(async () => {
try {
await organisation.init()
await apps.load()
await groups.actions.init()
} catch (error) {
notifications.error("Error loading apps")
}
loaded = true
})
const publishedAppsOnly = app => app.status === AppStatus.DEPLOYED
$: userGroups = $groups.filter(group => $: userGroups = $groups.filter(group =>
group.users.find(user => user._id === $auth.user?._id) group.users.find(user => user._id === $auth.user?._id)
) )
$: publishedApps = $apps.filter(publishedAppsOnly) $: publishedApps = $apps.filter(app => app.status === AppStatus.DEPLOYED)
$: userApps = getUserApps($auth.user) $: userApps = getUserApps(publishedApps, userGroups, $auth.user)
function getUserApps(user) { function getUserApps(publishedApps, userGroups, user) {
if (sdk.users.isAdmin(user)) { if (sdk.users.isAdmin(user)) {
return publishedApps return publishedApps
} }
@ -84,6 +72,17 @@
// Swallow error and do nothing // Swallow error and do nothing
} }
} }
onMount(async () => {
try {
await organisation.init()
await apps.load()
await groups.actions.init()
} catch (error) {
notifications.error("Error loading apps")
}
loaded = true
})
</script> </script>
{#if $auth.user && loaded} {#if $auth.user && loaded}

View File

@ -26,9 +26,9 @@
$: parentId = $component?.id $: parentId = $component?.id
$: inBuilder = $builderStore.inBuilder $: inBuilder = $builderStore.inBuilder
$: instance = { $: instance = {
_component: `@budibase/standard-components/${type}`, _component: getComponent(type),
_id: id, _id: id,
_instanceName: name || type[0].toUpperCase() + type.slice(1), _instanceName: getInstanceName(name, type),
_styles: { _styles: {
...styles, ...styles,
normal: styles?.normal || {}, normal: styles?.normal || {},
@ -45,6 +45,30 @@
} }
} }
const getComponent = type => {
if (!type) {
return null
}
if (type.startsWith("plugin/")) {
return type
} else {
return `@budibase/standard-components/${type}`
}
}
const getInstanceName = (name, type) => {
if (name) {
return name
}
if (!type) {
return "New component"
}
if (type.startsWith("plugin/")) {
type = type.split("plugin/")[1]
}
return type[0].toUpperCase() + type.slice(1)
}
onDestroy(() => { onDestroy(() => {
if (inBuilder) { if (inBuilder) {
block.unregisterComponent(id, parentId) block.unregisterComponent(id, parentId)

View File

@ -18,6 +18,8 @@ import { styleable } from "utils/styleable"
import { linkable } from "utils/linkable" import { linkable } from "utils/linkable"
import { getAction } from "utils/getAction" import { getAction } from "utils/getAction"
import Provider from "components/context/Provider.svelte" import Provider from "components/context/Provider.svelte"
import Block from "components/Block.svelte"
import BlockComponent from "components/BlockComponent.svelte"
import { ActionTypes } from "./constants" import { ActionTypes } from "./constants"
import { fetchDatasourceSchema } from "./utils/schema.js" import { fetchDatasourceSchema } from "./utils/schema.js"
import { getAPIKey } from "./utils/api.js" import { getAPIKey } from "./utils/api.js"
@ -44,4 +46,6 @@ export default {
Provider, Provider,
ActionTypes, ActionTypes,
getAPIKey, getAPIKey,
Block,
BlockComponent,
} }