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",
"packages": [
"packages/*"

View File

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

View File

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

View File

@ -28,25 +28,13 @@
let userInfoModal
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 =>
group.users.find(user => user._id === $auth.user?._id)
)
$: publishedApps = $apps.filter(publishedAppsOnly)
$: userApps = getUserApps($auth.user)
$: publishedApps = $apps.filter(app => app.status === AppStatus.DEPLOYED)
$: userApps = getUserApps(publishedApps, userGroups, $auth.user)
function getUserApps(user) {
function getUserApps(publishedApps, userGroups, user) {
if (sdk.users.isAdmin(user)) {
return publishedApps
}
@ -84,6 +72,17 @@
// 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>
{#if $auth.user && loaded}

View File

@ -26,9 +26,9 @@
$: parentId = $component?.id
$: inBuilder = $builderStore.inBuilder
$: instance = {
_component: `@budibase/standard-components/${type}`,
_component: getComponent(type),
_id: id,
_instanceName: name || type[0].toUpperCase() + type.slice(1),
_instanceName: getInstanceName(name, type),
_styles: {
...styles,
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(() => {
if (inBuilder) {
block.unregisterComponent(id, parentId)

View File

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