Browse Source

Merge pull request #415 from mjashanks/bugfixes

Bugfixes from #387
gh-pages
Michael Shanks 6 years ago
committed by GitHub
parent
commit
9936471dca
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 126
      packages/builder/src/components/userInterface/AppPreview/CurrentItemPreview.svelte
  2. 10
      packages/builder/src/components/userInterface/AppPreview/iframeTemplate.js
  3. 4
      packages/builder/src/pages/[application]/backend/model/[selectedModel]/index.svelte
  4. 75
      packages/server/src/utilities/appDirectoryTemplate/pages/main/page.json
  5. 12
      packages/standard-components/src/DataTable.svelte

126
packages/builder/src/components/userInterface/AppPreview/CurrentItemPreview.svelte

@ -25,16 +25,10 @@
name: "Screen Placeholder", name: "Screen Placeholder",
route: "*", route: "*",
props: { props: {
"_id": "49c3d0a2-7028-46f0-b004-7eddf62ad01c", "_id": "screenslot-placeholder",
"_component": "@budibase/standard-components/container", "_component": "@budibase/standard-components/container",
"_styles": { "_styles": {
"normal": { "normal": {},
"padding": "0px",
"font-family": "Roboto",
"border-width": "0",
"border-style": "None",
"text-align": "center"
},
"hover": {}, "hover": {},
"active": {}, "active": {},
"selected": {} "selected": {}
@ -45,47 +39,87 @@
"type": "div", "type": "div",
"_children": [ "_children": [
{ {
"_id": "335428f7-f9ca-4acd-9e76-71bc8ad27324", "_id": "51a1b494-0fa4-49c3-90cc-c2a6c7a3f888",
"_component": "@budibase/standard-components/container", "_component": "@budibase/standard-components/container",
"_styles": { "_styles": {
"normal": { "normal": {
"padding": "16px", "display": "flex",
"border-style": "Dashed", "flex-direction": "column",
"border-width": "2px", "align-items": "center"
"border-color": "#8a8989fa" },
"hover": {},
"active": {},
"selected": {}
},
"_code": "",
"className": "",
"onLoad": [],
"type": "div",
"_instanceId": "inst_40d9036_4c81114e2bf145ab8721978c66e09a10",
"_instanceName": "Container",
"_children": [
{
"_id": "90a52cd0-f215-46c1-b29b-e28f9e7edf72",
"_component": "@budibase/standard-components/heading",
"_styles": {
"normal": {
"width": "500px",
"padding": "8px"
},
"hover": {},
"active": {},
"selected": {}
}, },
"hover": {}, "_code": "",
"active": {}, "className": "",
"selected": {} "text": "Screenslot",
"type": "h1",
"_instanceId": "inst_40d9036_4c81114e2bf145ab8721978c66e09a10",
"_instanceName": "Heading",
"_children": []
}, },
"_code": "", {
"className": "", "_id": "71a3da65-72c6-4c43-8c6a-49871c07b77d",
"onLoad": [], "_component": "@budibase/standard-components/text",
"type": "div", "_styles": {
"_instanceId": "inst_b3b4e95_ab0df02dda3f4d8eb4b35eea2968bad3", "normal": {
"_instanceName": "Container", "max-width": "",
"_children": [ "text-align": "left",
{ "width": "500px",
"_id": "ddb6a225-33ba-4ba8-91da-bc6a2697ebf9", "padding": "8px"
"_component": "@budibase/standard-components/heading",
"_styles": {
"normal": {
"font-family": "Roboto"
},
"hover": {},
"active": {},
"selected": {}
}, },
"_code": "", "hover": {},
"className": "", "active": {},
"text": "Your screens go here", "selected": {}
"type": "h1", },
"_instanceId": "inst_b3b4e95_ab0df02dda3f4d8eb4b35eea2968bad3", "_code": "",
"_instanceName": "Heading", "text": "The screens that you create will be displayed inside this box.",
"_children": [] "type": "none",
} "_instanceId": "inst_40d9036_4c81114e2bf145ab8721978c66e09a10",
] "_instanceName": "Text"
} },
{
"_id": "8af80374-460d-497b-a5d8-7dd2ec4a7bbc",
"_component": "@budibase/standard-components/text",
"_styles": {
"normal": {
"max-width": "",
"text-align": "left",
"width": "500px",
"padding": "8px"
},
"hover": {},
"active": {},
"selected": {}
},
"_code": "",
"text": "This box is just a placeholder, to show you the position of screens.",
"type": "none",
"_instanceId": "inst_40d9036_4c81114e2bf145ab8721978c66e09a10",
"_instanceName": "Text"
}
]
}
], ],
"_instanceName": "Content Placeholder" "_instanceName": "Content Placeholder"
}, },

10
packages/builder/src/components/userInterface/AppPreview/iframeTemplate.js

@ -24,6 +24,16 @@ export default `<html>
text-transform: uppercase; text-transform: uppercase;
font-weight: bold; font-weight: bold;
} }
.container-screenslot-placeholder {
padding: 20px;
text-align: center;
border-style: dashed !important;
border-width: 1px;
color: #806fde;
background: #e9e6ff44;
height: 100%;
}
</style> </style>
<script src='/assets/budibase-client.js'></script> <script src='/assets/budibase-client.js'></script>
<script> <script>

4
packages/builder/src/pages/[application]/backend/model/[selectedModel]/index.svelte

@ -23,9 +23,7 @@
} }
</script> </script>
{#if selectedModel.schema && Object.keys(selectedModel.schema).length === 0} {#if $backendUiStore.selectedDatabase._id && selectedModel.name}
<EmptyModel />
{:else if $backendUiStore.selectedDatabase._id && selectedModel.name}
<ModelDataTable /> <ModelDataTable />
{:else} {:else}
<i style="color: var(--grey-4)">create your first table to start building</i> <i style="color: var(--grey-4)">create your first table to start building</i>

75
packages/server/src/utilities/appDirectoryTemplate/pages/main/page.json

@ -5,13 +5,58 @@
"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",
"_component": "@budibase/standard-components/container",
"_styles": {
"normal": {
"background": "#e8e8ef",
"padding": "8px",
"color": "#393C44",
"display": "N/A",
"flex-direction": "column"
},
"hover": {},
"active": {},
"selected": {}
},
"_code": "",
"className": "",
"onLoad": [],
"type": "div",
"_instanceId": "inst_1808f0d_e1277174d255421784ef2467d470abc8",
"_instanceName": "Container",
"_children": [
{
"_id": "fbd9520f-6b34-4e3e-828d-0197144568a1",
"_component": "@budibase/standard-components/heading",
"_styles": {
"normal": {},
"hover": {},
"active": {},
"selected": {}
},
"_code": "",
"className": "",
"text": "{{ name }}",
"type": "h1",
"_instanceId": "inst_1808f0d_e1277174d255421784ef2467d470abc8",
"_instanceName": "Heading",
"_children": []
}
]
},
{ {
"_id": "7fcf11e4-6f5b-4085-8e0d-9f3d44c98967", "_id": "7fcf11e4-6f5b-4085-8e0d-9f3d44c98967",
"_component": "##builtin/screenslot", "_component": "##builtin/screenslot",
"_styles": { "_styles": {
"normal": {}, "normal": {
"padding": "8px",
"align-items": "flex-start",
"height": "100vh"
},
"hover": {}, "hover": {},
"active": {}, "active": {},
"selected": {} "selected": {}
@ -20,14 +65,22 @@
"_children": [] "_children": []
} }
], ],
"type": "div", "type": "div",
"_styles": { "_styles": {
"active": {}, "active": {},
"hover": {}, "hover": {},
"normal": {}, "normal": {
"selected": {} "display": "flex",
}, "flex-direction": "column",
"_code": "" "align-items": "stretch",
"justify-content": "flex-start",
"height": "100vh"
},
"selected": {}
},
"_code": "",
"className": "",
"onLoad": []
}, },
"_css": "", "_css": "",
"uiFunctions": "" "uiFunctions": ""

12
packages/standard-components/src/DataTable.svelte

@ -8,6 +8,16 @@
let headers = [] let headers = []
let store = _bb.store let store = _bb.store
const shouldDisplayField = name => {
if (name.startsWith("_")) return false
// always 'record'
if (name === "type") return false
// tables are always tied to a single modelId, this is irrelevant
if (name === "modelId") return false
return true
}
async function fetchData() { async function fetchData() {
const FETCH_RECORDS_URL = `/api/views/all_${model}` const FETCH_RECORDS_URL = `/api/views/all_${model}`
@ -20,7 +30,7 @@
return state return state
}) })
headers = Object.keys(json[0]).filter(key => !key.startsWith("_")) headers = Object.keys(json[0]).filter(shouldDisplayField)
} else { } else {
throw new Error("Failed to fetch records.", response) throw new Error("Failed to fetch records.", response)
} }

Loading…
Cancel
Save