Default app template - added screens

This commit is contained in:
Michael Shanks 2020-07-09 14:47:54 +01:00
parent 237bad8bd5
commit 006c965b70
4 changed files with 190 additions and 29 deletions

View File

@ -147,7 +147,10 @@ const createEmptyAppPackage = async (ctx, app) => {
app app
) )
await buildPage(ctx.config, app._id, "main", { page: mainJson }) await buildPage(ctx.config, app._id, "main", {
page: mainJson,
screens: await loadScreens(newAppFolder, "main"),
})
const unauthenticatedJson = await updateJsonFile( const unauthenticatedJson = await updateJsonFile(
join(appsFolder, app._id, "pages", "unauthenticated", "page.json"), join(appsFolder, app._id, "pages", "unauthenticated", "page.json"),
@ -156,11 +159,26 @@ const createEmptyAppPackage = async (ctx, app) => {
await buildPage(ctx.config, app._id, "unauthenticated", { await buildPage(ctx.config, app._id, "unauthenticated", {
page: unauthenticatedJson, page: unauthenticatedJson,
screens: await loadScreens(newAppFolder, "unauthenticated"),
}) })
return newAppFolder return newAppFolder
} }
const loadScreens = async (appFolder, page) => {
const screensFolder = join(appFolder, "pages", page, "screens")
const screenFiles = (await fs.readdir(screensFolder)).filter(s =>
s.endsWith(".json")
)
let screens = []
for (let file of screenFiles) {
screens.push(await fs.readJSON(join(screensFolder, file)))
}
return screens
}
const lookupClientId = async appId => { const lookupClientId = async appId => {
const masterDb = new CouchDB("client_app_lookup") const masterDb = new CouchDB("client_app_lookup")
const { clientId } = await masterDb.get(appId) const { clientId } = await masterDb.get(appId)

View File

@ -3,47 +3,84 @@
"favicon": "./_shared/favicon.png", "favicon": "./_shared/favicon.png",
"stylesheets": [], "stylesheets": [],
"componentLibraries": ["@budibase/standard-components", "@budibase/materialdesign-components"], "componentLibraries": ["@budibase/standard-components", "@budibase/materialdesign-components"],
"props" : { "props": {
"_id": "private-master-root", "_id": "private-master-root",
"_component": "@budibase/standard-components/container", "_component": "@budibase/standard-components/container",
"_children": [ "_children": [
{ {
"_id": "c32dd256-a61c-4c41-876e-95e91c5e3a43", "_id": "49e0e519-9e5e-4127-885a-ee6a0a49e2c1",
"_component": "@budibase/standard-components/container", "_component": "@budibase/standard-components/Navigation",
"_styles": { "_styles": {
"normal": { "normal": {},
"background": "#e8e8ef",
"padding": "8px",
"color": "#393C44",
"display": "N/A",
"flex-direction": "column"
},
"hover": {}, "hover": {},
"active": {}, "active": {},
"selected": {} "selected": {}
}, },
"_code": "", "_code": "",
"className": "", "logoUrl": "http://acmelogos.com/images/logo-8.svg",
"onLoad": [], "title": "",
"type": "div", "backgroundColor": "",
"_instanceId": "inst_1808f0d_e1277174d255421784ef2467d470abc8", "color": "",
"_instanceName": "Container", "borderWidth": "",
"borderColor": "",
"borderStyle": "",
"_instanceId": "inst_cf8ace4_69efc0d72e6f443db2d4c902c14d9394",
"_instanceName": "Navigation",
"_children": [ "_children": [
{ {
"_id": "fbd9520f-6b34-4e3e-828d-0197144568a1", "_id": "48b35328-4c91-4343-a6a3-1a1fd77b3386",
"_component": "@budibase/standard-components/heading", "_component": "@budibase/standard-components/link",
"_styles": { "_styles": {
"normal": {}, "normal": {
"font-family": "Inter",
"font-weight": "400",
"color": "#000000",
"text-decoration-line": "none",
"font-size": "16px"
},
"hover": {}, "hover": {},
"active": {}, "active": {},
"selected": {} "selected": {}
}, },
"_code": "", "_code": "",
"className": "", "url": "/",
"text": "{{ name }}", "openInNewTab": false,
"type": "h1", "text": "Home",
"_instanceId": "inst_1808f0d_e1277174d255421784ef2467d470abc8", "color": "",
"_instanceName": "Heading", "hoverColor": "",
"underline": false,
"fontSize": "",
"fontFamily": "initial",
"_instanceId": "inst_cf8ace4_69efc0d72e6f443db2d4c902c14d9394",
"_instanceName": "Home Link",
"_children": []
},
{
"_id": "d3325634-0945-4387-8bb3-d9d9be186c1c",
"_component": "@budibase/standard-components/link",
"_styles": {
"normal": {
"font-family": "Inter",
"font-weight": "400",
"color": "#000000",
"text-decoration-line": "none",
"font-size": "16px"
},
"hover": {},
"active": {},
"selected": {}
},
"_code": "",
"url": "/screen1",
"openInNewTab": false,
"text": "Screen 1",
"color": "",
"hoverColor": "",
"underline": false,
"fontSize": "",
"fontFamily": "initial",
"_instanceId": "inst_cf8ace4_69efc0d72e6f443db2d4c902c14d9394",
"_instanceName": "Screen 1 Link",
"_children": [] "_children": []
} }
] ]
@ -53,9 +90,10 @@
"_component": "##builtin/screenslot", "_component": "##builtin/screenslot",
"_styles": { "_styles": {
"normal": { "normal": {
"padding": "8px", "padding": "0px",
"align-items": "flex-start", "align-items": "flex-start",
"height": "100vh" "height": "100vh",
"background-image": "None"
}, },
"hover": {}, "hover": {},
"active": {}, "active": {},
@ -74,14 +112,17 @@
"flex-direction": "column", "flex-direction": "column",
"align-items": "stretch", "align-items": "stretch",
"justify-content": "flex-start", "justify-content": "flex-start",
"height": "100vh" "height": "",
"max-width": "",
"margin-right": "auto",
"margin-left": "auto"
}, },
"selected": {} "selected": {}
}, },
"_code": "", "_code": "",
"className": "", "className": "",
"onLoad": [] "onLoad": []
}, },
"_css": "", "_css": "",
"uiFunctions": "" "uiFunctions": ""
} }

View File

@ -0,0 +1,61 @@
{
"description": "",
"url": "",
"props": {
"_id": "d834fea2-1b3e-4320-ab34-f9009f5ecc59",
"_component": "@budibase/standard-components/container",
"_styles": {
"normal": {},
"hover": {},
"active": {},
"selected": {}
},
"_code": "",
"className": "",
"onLoad": [],
"type": "div",
"_children": [
{
"_id": "ef60083f-4a02-4df3-80f3-a0d3d16847e7",
"_component": "@budibase/standard-components/heading",
"_styles": {
"normal": {},
"hover": {},
"active": {},
"selected": {}
},
"_code": "",
"className": "",
"text": "Home",
"type": "h1",
"_instanceId": "inst_cf8ace4_69efc0d72e6f443db2d4c902c14d9394",
"_instanceName": "Heading",
"_children": []
},
{
"_id": "6c256e06-784c-4ac0-a644-ed2f9b91d459",
"_component": "@budibase/standard-components/image",
"_styles": {
"normal": {
"width": "100%"
},
"hover": {},
"active": {},
"selected": {}
},
"_code": "",
"url": "https://source.unsplash.com/Vun-71Vy2hc",
"className": "",
"description": "",
"height": "",
"width": "",
"_instanceId": "inst_cf8ace4_69efc0d72e6f443db2d4c902c14d9394",
"_instanceName": "Image",
"_children": []
}
],
"_instanceName": "Home"
},
"route": "/*",
"name": "d834fea2-1b3e-4320-ab34-f9009f5ecc59"
}

View File

@ -0,0 +1,41 @@
{
"description": "",
"url": "",
"_css": "",
"props": {
"_id": "f684460e-1f79-42b4-8ffd-1f708bca93ed",
"_component": "@budibase/standard-components/container",
"_styles": {
"normal": {},
"hover": {},
"active": {},
"selected": {}
},
"_code": "",
"className": "",
"onLoad": [],
"type": "div",
"_children": [
{
"_id": "7d1d6b43-b444-46a5-a75c-267fd6b5baf6",
"_component": "@budibase/standard-components/heading",
"_styles": {
"normal": {},
"hover": {},
"active": {},
"selected": {}
},
"_code": "",
"className": "",
"text": "Screen1",
"type": "h1",
"_instanceId": "inst_cf8ace4_69efc0d72e6f443db2d4c902c14d9394",
"_instanceName": "Heading",
"_children": []
}
],
"_instanceName": "Screen 1"
},
"route": "/screen1",
"name": "f684460e-1f79-42b4-8ffd-1f708bca93ed"
}