Remove static definition from store and properly handle custom components from API
This commit is contained in:
parent
a38373a939
commit
019b2181e8
|
@ -90,36 +90,14 @@ export const getFrontendStore = () => {
|
||||||
|
|
||||||
// Fetch component definitions.
|
// Fetch component definitions.
|
||||||
// Allow errors to propagate.
|
// Allow errors to propagate.
|
||||||
let components = await API.fetchComponentLibDefinitions(application.appId)
|
const components = await API.fetchComponentLibDefinitions(
|
||||||
|
application.appId
|
||||||
// Extend definitions with custom components
|
)
|
||||||
components["test"] = {
|
|
||||||
component: "test",
|
|
||||||
name: "Super cool component",
|
|
||||||
icon: "Text",
|
|
||||||
description: "A custom component",
|
|
||||||
showSettingsBar: false,
|
|
||||||
hasChildren: true,
|
|
||||||
settings: [
|
|
||||||
{
|
|
||||||
type: "text",
|
|
||||||
key: "text",
|
|
||||||
label: "Text",
|
|
||||||
},
|
|
||||||
],
|
|
||||||
context: {
|
|
||||||
type: "static",
|
|
||||||
values: [
|
|
||||||
{
|
|
||||||
label: "Text prop",
|
|
||||||
key: "text",
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
// Filter out custom component keys so we can flag them
|
// Filter out custom component keys so we can flag them
|
||||||
let customComponents = ["test"]
|
const customComponents = Object.keys(components).filter(name =>
|
||||||
|
name.startsWith("plugin/")
|
||||||
|
)
|
||||||
|
|
||||||
// Reset store state
|
// Reset store state
|
||||||
store.update(state => ({
|
store.update(state => ({
|
||||||
|
@ -146,6 +124,7 @@ export const getFrontendStore = () => {
|
||||||
version: application.version,
|
version: application.version,
|
||||||
revertableVersion: application.revertableVersion,
|
revertableVersion: application.revertableVersion,
|
||||||
navigation: application.navigation || {},
|
navigation: application.navigation || {},
|
||||||
|
usedPlugins: application.usedPlugins || [],
|
||||||
}))
|
}))
|
||||||
|
|
||||||
// Initialise backend stores
|
// Initialise backend stores
|
||||||
|
|
Loading…
Reference in New Issue