small tidy ups

This commit is contained in:
Martin McKeaveney 2020-11-06 13:40:00 +00:00
parent 96c18d574c
commit a8b5c3c255
2 changed files with 6 additions and 7 deletions

View File

@ -62,7 +62,7 @@
</div> </div>
</div> </div>
<TemplateList onSelect={selectTemplate} /> <!-- <TemplateList onSelect={selectTemplate} /> -->
<AppList /> <AppList />
</div> </div>

View File

@ -76,10 +76,8 @@ exports.fetchAppPackage = async function(ctx) {
) )
pages = pages.rows.map(row => row.doc) pages = pages.rows.map(row => row.doc)
const mainPage = pages.filter(page => page.name === PageTypes.MAIN)[0] const mainPage = pages.find(page => page.name === PageTypes.MAIN)
const unauthPage = pages.filter( const unauthPage = pages.find(page => page.name === PageTypes.UNAUTHENTICATED)
page => page.name === PageTypes.UNAUTHENTICATED
)[0]
ctx.body = { ctx.body = {
application, application,
pages: { pages: {
@ -139,7 +137,6 @@ exports.delete = async function(ctx) {
const result = await db.destroy() const result = await db.destroy()
// remove top level directory // remove top level directory
// TODO: look into why this isn't a callback
await fs.rmdir(join(budibaseAppsDir(), ctx.params.appId), { await fs.rmdir(join(budibaseAppsDir(), ctx.params.appId), {
recursive: true, recursive: true,
}) })
@ -160,14 +157,16 @@ const createEmptyAppPackage = async (ctx, app) => {
} }
fs.mkdirpSync(newAppFolder) fs.mkdirpSync(newAppFolder)
const mainPage = cloneDeep(MAIN) const mainPage = cloneDeep(MAIN)
mainPage._id = generatePageID() mainPage._id = generatePageID()
mainPage.title = app.name mainPage.title = app.name
const unauthPage = cloneDeep(UNAUTHENTICATED) const unauthPage = cloneDeep(UNAUTHENTICATED)
unauthPage._id = generatePageID() unauthPage._id = generatePageID()
// TODO: fix - handlebars etc
unauthPage.title = app.name unauthPage.title = app.name
unauthPage.props._children[0].title = `Log in to ${app.name}` unauthPage.props._children[0].title = `Log in to ${app.name}`
const homeScreen = cloneDeep(HOME_SCREEN) const homeScreen = cloneDeep(HOME_SCREEN)
homeScreen._id = generateScreenID(mainPage._id) homeScreen._id = generateScreenID(mainPage._id)
await db.bulkDocs([mainPage, unauthPage, homeScreen]) await db.bulkDocs([mainPage, unauthPage, homeScreen])