mirror of https://github.com/Budibase/budibase.git
Browse Source
* refactoring server for screens & page layout restructure * Disable API calls, UI placeholders. * buildPropsHierarchy is gone & screen has url * Recent changes. * router * router * updated git-ignore to reinclude server/utilities/builder * modified cli - budi new create new file structure * Fix uuid import. * prettier fixes * prettier fixes * prettier fixes * page/screen restructure.. broken tests * all tests passing at last * screen routing tests * Working screen editor and preview. * Render page previews to the screen. * Key input lists to ensure new array references when updating styles. * Ensure the iframe html and body fills the container. * Save screens via the API. * Get all save APIs almost working. * Write pages.json to disk. * Use correct API endpoint for saving styles. * Differentiate between saving properties of screens and pages. * Add required fields to default pages layouts. * Add _css default property to newly created screens. * Add default code property. * page layout / screens - app output * backend and fronend save seperately Co-authored-by: pngwn <pnda007@gmail.com>pull/91/head
committed by
GitHub
36 changed files with 13561 additions and 11651 deletions
File diff suppressed because it is too large
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
File diff suppressed because one or more lines are too long
@ -0,0 +1,20 @@ |
|||
const { readJSON, readdir } = require("fs-extra") |
|||
const { join } = require("path") |
|||
|
|||
module.exports = async appPath => { |
|||
const pages = {} |
|||
|
|||
const pageFolders = await readdir(join(appPath, "pages")) |
|||
for (let pageFolder of pageFolders) { |
|||
try { |
|||
pages[pageFolder] = await readJSON( |
|||
join(appPath, "pages", pageFolder, "page.json") |
|||
) |
|||
pages[pageFolder].name = pageFolder |
|||
} catch (_) { |
|||
// ignore error
|
|||
} |
|||
} |
|||
|
|||
return pages |
|||
} |
|||
@ -0,0 +1,48 @@ |
|||
const { appPackageFolder } = require("../createAppPackage") |
|||
const { readJSON, readdir, stat } = require("fs-extra") |
|||
const { join } = require("path") |
|||
const { keyBy } = require("lodash/fp") |
|||
|
|||
module.exports = async (config, appname, pagename) => { |
|||
const appPath = appPackageFolder(config, appname) |
|||
return keyBy("name")(await fetchscreens(appPath, pagename)) |
|||
} |
|||
|
|||
const fetchscreens = async (appPath, pagename, relativePath = "") => { |
|||
const currentDir = join(appPath, "pages", pagename, "screens", relativePath) |
|||
|
|||
const contents = await readdir(currentDir) |
|||
|
|||
const screens = [] |
|||
|
|||
for (let item of contents) { |
|||
const itemRelativePath = join(relativePath, item) |
|||
const itemFullPath = join(currentDir, item) |
|||
const stats = await stat(itemFullPath) |
|||
|
|||
if (stats.isFile()) { |
|||
if (!item.endsWith(".json")) continue |
|||
|
|||
const component = await readJSON(itemFullPath) |
|||
|
|||
component.name = itemRelativePath |
|||
.substring(0, itemRelativePath.length - 5) |
|||
.replace(/\\/g, "/") |
|||
|
|||
component.props = component.props || {} |
|||
|
|||
screens.push(component) |
|||
} else { |
|||
const childComponents = await fetchscreens( |
|||
appPath, |
|||
join(relativePath, item) |
|||
) |
|||
|
|||
for (let c of childComponents) { |
|||
screens.push(c) |
|||
} |
|||
} |
|||
} |
|||
|
|||
return screens |
|||
} |
|||
@ -0,0 +1,3 @@ |
|||
const { join } = require("path") |
|||
|
|||
module.exports = (appPath, pageName) => join(appPath, "public", pageName) |
|||
@ -0,0 +1,28 @@ |
|||
const getPages = require("./getPages") |
|||
const { appPackageFolder } = require("../createAppPackage") |
|||
const { writeJSON, writeFile } = require("fs-extra") |
|||
const { join } = require("path") |
|||
const publicPath = require("./publicPath") |
|||
|
|||
module.exports = async (config, appname, appDefinition, accessLevels) => { |
|||
const appPath = appPackageFolder(config, appname) |
|||
|
|||
await writeJSON(`${appPath}/appDefinition.json`, appDefinition, { |
|||
spaces: 2, |
|||
}) |
|||
|
|||
await writeJSON(`${appPath}/access_levels.json`, accessLevels, { |
|||
spaces: 2, |
|||
}) |
|||
|
|||
const pages = await getPages(appPath) |
|||
for (let pageName in pages) { |
|||
const pagePublicPath = publicPath(appPath, pageName) |
|||
const filename = join(pagePublicPath, "clientBackendDefinition.js") |
|||
const appDefString = JSON.stringify(appDefinition) |
|||
await writeFile( |
|||
filename, |
|||
`window['##BUDIBASE_FRONTEND_DEINITION##'] = ${appDefString};` |
|||
) |
|||
} |
|||
} |
|||
@ -1,30 +0,0 @@ |
|||
const { appPackageFolder } = require("../createAppPackage") |
|||
const { writeJSON } = require("fs-extra") |
|||
const { join } = require("path") |
|||
|
|||
const buildPage = require("./buildPage") |
|||
|
|||
module.exports = async (config, appname, pageName, pkg) => { |
|||
const appPath = appPackageFolder(config, appname) |
|||
pkg.pageName = pageName |
|||
|
|||
await writeJSON(`${appPath}/appDefinition.json`, pkg.appDefinition, { |
|||
spaces: 2, |
|||
}) |
|||
|
|||
await writeJSON(`${appPath}/access_levels.json`, pkg.accessLevels, { |
|||
spaces: 2, |
|||
}) |
|||
|
|||
await buildPage(config, appname, pkg) |
|||
|
|||
const pageFile = join(appPath, "pages", pageName, "page.json") |
|||
|
|||
if (pkg.page._css) { |
|||
delete pkg.page._css |
|||
} |
|||
|
|||
await writeJSON(pageFile, pkg.page, { |
|||
spaces: 2, |
|||
}) |
|||
} |
|||
File diff suppressed because one or more lines are too long
Loading…
Reference in new issue