fixing tests
This commit is contained in:
parent
db69673a9d
commit
2ebe5580d5
|
@ -1,5 +1,5 @@
|
|||
import { filter, cloneDeep, values } from "lodash/fp"
|
||||
import { pipe } from "components/common/core"
|
||||
import { cloneDeep, values } from "lodash/fp"
|
||||
import { backendUiStore } from "builderStore";
|
||||
import * as backendStoreActions from "./backend"
|
||||
import { writable, get } from "svelte/store"
|
||||
import api from "../api"
|
||||
|
@ -197,9 +197,8 @@ const setCurrentScreen = store => screenName => {
|
|||
|
||||
const deleteScreen = store => name => {
|
||||
store.update(s => {
|
||||
const components = pipe(s.components, [filter(c => c.name !== name)])
|
||||
|
||||
const screens = pipe(s.screens, [filter(c => c.name !== name)])
|
||||
const components = s.components.filter(c => c.name !== name)
|
||||
const screens = s.screens.filter(c => c.name !== name);
|
||||
|
||||
s.components = components
|
||||
s.screens = screens
|
||||
|
@ -255,14 +254,14 @@ const renameScreen = store => (oldname, newname) => {
|
|||
}
|
||||
|
||||
const savePage = store => async page => {
|
||||
store.update(s => {
|
||||
store.update(state => {
|
||||
if (s.currentFrontEndType !== "page" || !s.currentPageName) {
|
||||
return s
|
||||
return state
|
||||
}
|
||||
|
||||
s.pages[s.currentPageName] = page
|
||||
_savePage(s)
|
||||
return s
|
||||
return state
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -330,7 +329,6 @@ const setCurrentPage = store => pageName => {
|
|||
* @param {string} presetName - name of the component preset if defined
|
||||
*/
|
||||
const addChildComponent = store => (componentToAdd, presetName) => {
|
||||
// componentToAdd looks like: @budibase/standard-components/container
|
||||
store.update(state => {
|
||||
function findSlot(component_array) {
|
||||
for (let i = 0; i < component_array.length; i += 1) {
|
||||
|
@ -356,7 +354,13 @@ const addChildComponent = store => (componentToAdd, presetName) => {
|
|||
: state.components[componentToAdd]
|
||||
|
||||
const presetProps = presetName ? component.presets[presetName] : {}
|
||||
const newComponent = createProps(component, presetProps, state)
|
||||
|
||||
const instanceId = get(backendUiStore).selectedDatabase.id;
|
||||
|
||||
const newComponent = createProps(component, {
|
||||
...presetProps,
|
||||
instanceId
|
||||
}, state)
|
||||
|
||||
state.currentComponentInfo._children = state.currentComponentInfo._children.concat(
|
||||
newComponent.props
|
||||
|
|
|
@ -25,8 +25,7 @@ export const createProps = (componentDefinition, derivedFromProps) => {
|
|||
_id: uuid(),
|
||||
_component: componentDefinition._component,
|
||||
_styles: { position: {}, layout: {} },
|
||||
_code: "",
|
||||
_instanceId: "dev-1" // TODO fix
|
||||
_code: ""
|
||||
}
|
||||
|
||||
const errors = []
|
||||
|
|
|
@ -12,29 +12,12 @@ export const loadBudibase = async opts => {
|
|||
const frontendDefinition = _window["##BUDIBASE_FRONTEND_DEFINITION##"]
|
||||
const uiFunctions = _window["##BUDIBASE_FRONTEND_FUNCTIONS##"]
|
||||
|
||||
// TODO: Update
|
||||
// TODO: update
|
||||
const user = {}
|
||||
|
||||
// const userFromStorage = _localStorage.getItem("budibase:user")
|
||||
|
||||
// const user = userFromStorage
|
||||
// ? JSON.parse(userFromStorage)
|
||||
// : {
|
||||
// name: "annonymous",
|
||||
// permissions: [],
|
||||
// isUser: false,
|
||||
// temp: false,
|
||||
// }
|
||||
|
||||
// let { appRootPath } = frontendDefinition;
|
||||
// appRootPath = appRootPath === "" ? "" : "/" + trimSlash(appRootPatl)
|
||||
|
||||
const componentLibraryModules = opts && opts.componentLibraries || {}
|
||||
|
||||
const libraries = frontendDefinition.libraries || [
|
||||
"@budibase/materialdesign-components",
|
||||
"@budibase/standard-components"
|
||||
]
|
||||
const libraries = frontendDefinition.libraries || []
|
||||
|
||||
for (let library of libraries) {
|
||||
// fetch the JavaScript for the component libraries from the server
|
||||
|
|
|
@ -93,6 +93,10 @@ const buildFrontendAppDefinition = async (config, appname, pageName, pkg) => {
|
|||
appRootPath: appRootPath,
|
||||
page: pkg.page,
|
||||
screens: pkg.screens,
|
||||
libraries: [
|
||||
"@budibase/materialdesign-components",
|
||||
"@budibase/standard-components"
|
||||
]
|
||||
})
|
||||
|
||||
await writeFile(
|
||||
|
|
Loading…
Reference in New Issue