rename buildPage
This commit is contained in:
parent
0c8bd319f3
commit
bdfd80fc03
|
@ -1,5 +1,5 @@
|
|||
const CouchDB = require("../../db")
|
||||
const { buildPage } = require("../../utilities/builder")
|
||||
const { compileStaticAssetsForPage } = require("../../utilities/builder")
|
||||
const env = require("../../environment")
|
||||
const { copy, existsSync, readFile, writeFile } = require("fs-extra")
|
||||
const { budibaseAppsDir } = require("../../utilities/budibaseDir")
|
||||
|
@ -230,13 +230,13 @@ const createEmptyAppPackage = async (ctx, app) => {
|
|||
unauthPage.props._children[0]._children.title = `Log in to ${app.name}`
|
||||
const homeScreen = cloneDeep(HOME_SCREEN)
|
||||
homeScreen._id = generateScreenID(mainPage._id)
|
||||
const response = await db.bulkDocs([mainPage, unauthPage, homeScreen])
|
||||
await db.bulkDocs([mainPage, unauthPage, homeScreen])
|
||||
|
||||
await buildPage(app._id, "main", {
|
||||
await compileStaticAssetsForPage(app._id, "main", {
|
||||
page: mainPage,
|
||||
screens: [homeScreen],
|
||||
})
|
||||
await buildPage(app._id, "unauthenticated", {
|
||||
await compileStaticAssetsForPage(app._id, "unauthenticated", {
|
||||
page: unauthPage,
|
||||
screens: [],
|
||||
})
|
||||
|
|
|
@ -1,14 +1,17 @@
|
|||
const CouchDB = require("../../db/client")
|
||||
const { generatePageID } = require("../../db/utils")
|
||||
const { buildPage } = require("../../utilities/builder")
|
||||
const { compileStaticAssetsForPage } = require("../../utilities/builder")
|
||||
|
||||
exports.save = async function(ctx) {
|
||||
const db = new CouchDB(ctx.user.appId)
|
||||
|
||||
const appPackage = ctx.request.body
|
||||
|
||||
// TODO: rename to something more descriptive
|
||||
await buildPage(ctx.user.appId, ctx.params.pageId, ctx.request.body)
|
||||
await compileStaticAssetsForPage(
|
||||
ctx.user.appId,
|
||||
ctx.params.pageId,
|
||||
ctx.request.body
|
||||
)
|
||||
|
||||
// remove special doc props which couch will complain about
|
||||
delete appPackage.page._css
|
||||
|
|
|
@ -5,7 +5,7 @@ const Joi = require("joi")
|
|||
const {
|
||||
listScreens,
|
||||
saveScreen,
|
||||
buildPage,
|
||||
compileStaticAssetsForPage,
|
||||
deleteScreen,
|
||||
} = require("../../utilities/builder")
|
||||
const authorized = require("../../middleware/authorized")
|
||||
|
@ -44,7 +44,11 @@ router.post(
|
|||
"/_builder/api/:appId/pages/:pageName",
|
||||
authorized(BUILDER),
|
||||
async ctx => {
|
||||
await buildPage(ctx.params.appId, ctx.params.pageName, ctx.request.body)
|
||||
await compileStaticAssetsForPage(
|
||||
ctx.params.appId,
|
||||
ctx.params.pageName,
|
||||
ctx.request.body
|
||||
)
|
||||
ctx.response.status = StatusCodes.OK
|
||||
}
|
||||
)
|
||||
|
|
|
@ -11,13 +11,13 @@
|
|||
// const { join } = require("../centralPath")
|
||||
// const { dirname } = require("path")
|
||||
|
||||
const buildPage = require("./buildPage")
|
||||
const compileStaticAssetsForPage = require("./compileStaticAssetsForPage")
|
||||
// const getPages = require("./getPages")
|
||||
// const listScreens = require("./listScreens")
|
||||
// const { budibaseAppsDir } = require("../budibaseDir")
|
||||
// const { budibaseAppsDir } = require("../budibaseDir")
|
||||
|
||||
module.exports.buildPage = buildPage
|
||||
module.exports.compileStaticAssetsForPage = compileStaticAssetsForPage
|
||||
// module.exports.listScreens = listScreens
|
||||
|
||||
// const getAppDefinition = async appPath =>
|
||||
|
@ -76,5 +76,5 @@ module.exports.buildPage = buildPage
|
|||
// space: 2,
|
||||
// })
|
||||
// const appDefinition = await getAppDefinition(appPath)
|
||||
// await buildPage(appId, appDefinition, pagename, page)
|
||||
// await compileStaticAssetsForPage(appId, appDefinition, pagename, page)
|
||||
// }
|
||||
|
|
Loading…
Reference in New Issue