diff --git a/packages/builder/package.json b/packages/builder/package.json
index fa92be46a2..70a9602309 100644
--- a/packages/builder/package.json
+++ b/packages/builder/package.json
@@ -47,6 +47,7 @@
"safe-buffer": "^5.1.2",
"shortid": "^2.2.8",
"string_decoder": "^1.2.0",
+ "svelte-routing": "^1.4.2",
"uikit": "^3.1.7"
},
"devDependencies": {
diff --git a/packages/builder/rollup.config.js b/packages/builder/rollup.config.js
index 5a607720d8..bbc1d3c5fc 100644
--- a/packages/builder/rollup.config.js
+++ b/packages/builder/rollup.config.js
@@ -165,7 +165,7 @@ export default {
svelte({
// enable run-time checks when not in production
dev: !production,
- include: "src/**/*.svelte",
+ include: ["src/**/*.svelte", "node_modules/**/*.svelte"],
// we'll extract any component CSS out into
// a separate file — better for performance
css: css => {
diff --git a/packages/builder/src/App.svelte b/packages/builder/src/App.svelte
index 81e74e8543..69bddc225c 100644
--- a/packages/builder/src/App.svelte
+++ b/packages/builder/src/App.svelte
@@ -29,16 +29,16 @@
{/await}
+ {#if $store.useAnalytics}
+
+ {/if}
+ -->
diff --git a/packages/builder/src/database/ModelDataTable/ModelDataTable.svelte b/packages/builder/src/database/ModelDataTable/ModelDataTable.svelte
index 30d243d984..8651306c07 100644
--- a/packages/builder/src/database/ModelDataTable/ModelDataTable.svelte
+++ b/packages/builder/src/database/ModelDataTable/ModelDataTable.svelte
@@ -1,6 +1,11 @@
+
+
+
- Shoe database
-
-
Create new record
+
Shoe database
+
@@ -32,7 +54,25 @@
{#each data as row}
-
+
|
{#each headers as header}
{row[header]} |
@@ -41,13 +81,7 @@
{/each}
-
+
diff --git a/packages/builder/src/database/ModelDataTable/TablePagination.svelte b/packages/builder/src/database/ModelDataTable/TablePagination.svelte
new file mode 100644
index 0000000000..8e8c8072e2
--- /dev/null
+++ b/packages/builder/src/database/ModelDataTable/TablePagination.svelte
@@ -0,0 +1,44 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/packages/builder/src/database/ModelDataTable/api.js b/packages/builder/src/database/ModelDataTable/api.js
new file mode 100644
index 0000000000..410c155140
--- /dev/null
+++ b/packages/builder/src/database/ModelDataTable/api.js
@@ -0,0 +1,24 @@
+ import api from "../../builderStore/api";
+
+ export async function deleteRecord(appName, appInstanceId, record) {
+ const DELETE_RECORDS_URL = `/_builder/instance/${appName}/${appInstanceId}/api/record/${record.name}/${record.id}`
+ const response = await api.delete({
+ url: DELETE_RECORDS_URL
+ });
+ }
+
+ export async function createNewRecord(record) {
+ console.log(record);
+ }
+
+ export async function fetchDataForView(viewName) {
+ console.log(viewName);
+ // const FETCH_RECORDS_URL = `/_builder/instance/${}/${}/api/listRecords/`
+
+ // const response = await api.get({ url: FETCH_RECORDS_URL });
+
+ // console.log(response);
+
+ // GET /_builder/instance/:appname/:instanceid/api/listRecords/contacts/abcd1234/all_deals
+
+ }
\ No newline at end of file
diff --git a/packages/builder/src/database/ModelDataTable/modals/CreateEditField.svelte b/packages/builder/src/database/ModelDataTable/modals/CreateEditField.svelte
new file mode 100644
index 0000000000..695a0b1903
--- /dev/null
+++ b/packages/builder/src/database/ModelDataTable/modals/CreateEditField.svelte
@@ -0,0 +1,23 @@
+
+
+
+
+
+
Cancel
+
api.createNewRecord(recordInfo)}>
+ Save
+
+
+
diff --git a/packages/builder/src/database/ModelDataTable/modals/CreateEditModel.svelte b/packages/builder/src/database/ModelDataTable/modals/CreateEditModel.svelte
new file mode 100644
index 0000000000..d5b1189daf
--- /dev/null
+++ b/packages/builder/src/database/ModelDataTable/modals/CreateEditModel.svelte
@@ -0,0 +1,23 @@
+
+
+
+ Create / Edit Record
+
+
Cancel
+
api.createNewRecord(recordInfo)}>
+ Save
+
+
+
diff --git a/packages/builder/src/database/ModelDataTable/modals/CreateEditRecord.svelte b/packages/builder/src/database/ModelDataTable/modals/CreateEditRecord.svelte
new file mode 100644
index 0000000000..0d4f4abf72
--- /dev/null
+++ b/packages/builder/src/database/ModelDataTable/modals/CreateEditRecord.svelte
@@ -0,0 +1,60 @@
+
+
+
+ Create / Edit Record
+
+
+
Cancel
+
api.createNewRecord(recordInfo)}>
+ Save
+
+
+
diff --git a/packages/builder/src/database/ModelDataTable/modals/CreateEditView.svelte b/packages/builder/src/database/ModelDataTable/modals/CreateEditView.svelte
new file mode 100644
index 0000000000..6e9449149b
--- /dev/null
+++ b/packages/builder/src/database/ModelDataTable/modals/CreateEditView.svelte
@@ -0,0 +1,23 @@
+
+
+
+
+
+
Cancel
+
api.createNewRecord(recordInfo)}>
+ Save
+
+
+
diff --git a/packages/builder/src/database/ModelDataTable/modals/DeleteRecord.svelte b/packages/builder/src/database/ModelDataTable/modals/DeleteRecord.svelte
new file mode 100644
index 0000000000..5ed084fb5d
--- /dev/null
+++ b/packages/builder/src/database/ModelDataTable/modals/DeleteRecord.svelte
@@ -0,0 +1,24 @@
+
+
+
+ Delete Record
+ Are you sure you want to delete this record? All of your data will be permanently removed. This action cannot be undone.
+
+
Cancel
+
api.deleteRecord(recordInfo)}>
+ Delete
+
+
+
diff --git a/packages/builder/src/database/ModelDataTable/modals/index.js b/packages/builder/src/database/ModelDataTable/modals/index.js
new file mode 100644
index 0000000000..fc9ba75f08
--- /dev/null
+++ b/packages/builder/src/database/ModelDataTable/modals/index.js
@@ -0,0 +1,2 @@
+export { default as DeleteRecordModal } from "./DeleteRecord.svelte";
+export { default as CreateEditRecordModal } from "./CreateEditRecord.svelte";
\ No newline at end of file
diff --git a/packages/builder/src/database/RecordView.svelte b/packages/builder/src/database/ModelView.svelte
similarity index 58%
rename from packages/builder/src/database/RecordView.svelte
rename to packages/builder/src/database/ModelView.svelte
index 035c7e2223..d0f0c32605 100644
--- a/packages/builder/src/database/RecordView.svelte
+++ b/packages/builder/src/database/ModelView.svelte
@@ -24,11 +24,14 @@
record = $store.currentNode
const flattened = h.getFlattenedHierarchy($store.hierarchy)
getIndexAllowedRecords = index =>
- pipe(index.allowedRecordNodeIds, [
- filter(id => some(n => n.nodeId === id)(flattened)),
- map(id => find(n => n.nodeId === id)(flattened).name),
- join(", "),
- ])
+ pipe(
+ index.allowedRecordNodeIds,
+ [
+ filter(id => some(n => n.nodeId === id)(flattened)),
+ map(id => find(n => n.nodeId === id)(flattened).name),
+ join(", "),
+ ]
+ )
newField = () => {
isNewField = true
@@ -72,16 +75,19 @@
}
let getTypeOptions = typeOptions =>
- pipe(typeOptions, [
- keys,
- map(
- k =>
- `${k}: ${getTypeOptionsValueText(
- typeOptions[k]
- )}`
- ),
- join("
"),
- ])
+ pipe(
+ typeOptions,
+ [
+ keys,
+ map(
+ k =>
+ `${k}: ${getTypeOptionsValueText(
+ typeOptions[k]
+ )}`
+ ),
+ join("
"),
+ ]
+ )
const nameChanged = ev => {
const pluralName = n => `${n}s`
@@ -93,68 +99,78 @@
-
-
+
+ Fields
+
Add new field
+
+
- {#if record.fields.length > 0}
-
-
+
+
+
+ Edit |
+ Name |
+ Type |
+ Values |
+ |
+
+
+
+ {#each record.fields as field}
- Name |
- Type |
- Options |
- |
+
+ editField(field)} />
+ |
+
+ {field.name}
+ |
+ {field.type} |
+ ({console.log(field.typeOptions)}) {field.typeOptions.values} |
+
+
+ deleteField(field)}>
+ {@html getIcon('trash')}
+
+ |
-
-
- {#each record.fields as field}
-
-
- {field.label}
-
- {field.name}
-
- |
- {field.type} |
-
- {@html getTypeOptions(field.typeOptions)}
- |
-
- editField(field)}>
- {@html getIcon('edit')}
-
- deleteField(field)}>
- {@html getIcon('trash')}
-
- |
-
- {/each}
-
-
- {:else}(no fields added){/if}
+ {/each}
+
+
{#if editingField}
onFinishedFieldEdit(false)}>
+
+
+
+ Create / Edit Field
+
{/if}
- Indexes
+
- {#each record.indexes as index}
+
@@ -213,10 +229,6 @@
border-collapse: collapse;
}
- .add-field-button {
- cursor: pointer;
- }
-
.edit-button {
cursor: pointer;
color: var(--secondary25);
@@ -227,35 +239,6 @@
color: var(--secondary75);
}
- th {
- text-align: left;
- }
-
- td {
- padding: 1rem 5rem 1rem 0rem;
- margin: 0;
- font-size: 14px;
- font-weight: 500;
- }
-
- .field-label {
- font-size: 14px;
- font-weight: 500;
- }
-
- thead > tr {
- border-width: 0px 0px 1px 0px;
- border-style: solid;
- border-color: var(--secondary75);
- margin-bottom: 20px;
- }
-
- tbody > tr {
- border-width: 0px 0px 1px 0px;
- border-style: solid;
- border-color: var(--primary10);
- }
-
tbody > tr:hover {
background-color: var(--primary10);
}
@@ -264,38 +247,17 @@
color: var(--secondary75);
}
- .index-container {
- border-style: solid;
- border-width: 0 0 1px 0;
- border-color: var(--secondary25);
- padding: 10px;
- margin-bottom: 5px;
+ .table-controls {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
}
- .index-label {
- color: var(--slate);
+ .ri-more-line:hover {
+ cursor: pointer;
}
- .index-name {
- font-weight: bold;
- color: var(--primary100);
- }
-
- .index-container code {
+ h4 {
margin: 0;
- display: inline;
- background-color: var(--primary10);
- color: var(--secondary100);
- padding: 3px;
- }
-
- .index-field-row {
- margin: 1rem 0rem 0rem 0rem;
- }
-
- .no-indexes {
- margin: 1rem 0rem 0rem 0rem;
- font-family: var(--fontnormal);
- font-size: 14px;
}
diff --git a/packages/builder/src/global.css b/packages/builder/src/global.css
index 745dee014c..4c713a8460 100644
--- a/packages/builder/src/global.css
+++ b/packages/builder/src/global.css
@@ -102,4 +102,8 @@ h5 {
font-family: var(--fontblack);
font-size: 12pt;
color: var(--darkslate);
+}
+
+.hoverable:hover {
+ cursor: pointer;
}
\ No newline at end of file
diff --git a/packages/builder/src/main.js b/packages/builder/src/main.js
index 0fadfc0bdc..7cf0e0d8f0 100644
--- a/packages/builder/src/main.js
+++ b/packages/builder/src/main.js
@@ -15,5 +15,5 @@ import "codemirror/theme/monokai.css"
/* eslint-disable */
const app = new App({
- target: document.getElementById("app"),
+ target: document.getElementById("app")
})
diff --git a/packages/builder/src/nav/BackendNav.svelte b/packages/builder/src/nav/BackendNav.svelte
index 55d35ecb33..3fc3d5cd0c 100644
--- a/packages/builder/src/nav/BackendNav.svelte
+++ b/packages/builder/src/nav/BackendNav.svelte
@@ -1,5 +1,5 @@
@@ -11,14 +20,14 @@
{#each $store.appInstances as { id, name }}
- {#if id === $store.currentPageName}
+ {#if id === $store.currentlySelectedDatabase}
{/if}
diff --git a/packages/builder/src/nav/HierarchyRow.svelte b/packages/builder/src/nav/HierarchyRow.svelte
index abfe34b134..9c6d2adbd1 100644
--- a/packages/builder/src/nav/HierarchyRow.svelte
+++ b/packages/builder/src/nav/HierarchyRow.svelte
@@ -16,8 +16,7 @@
store.subscribe(state => {
if (state.currentNode) {
- navActive =
- getContext("activeNav") === "database" && node.nodeId === state.currentNode.nodeId
+ navActive = node.nodeId === state.currentNode.nodeId
}
})
diff --git a/packages/builder/src/nav/SchemaManagementDrawer.svelte b/packages/builder/src/nav/SchemaManagementDrawer.svelte
index b25f36bccb..4276a591d2 100644
--- a/packages/builder/src/nav/SchemaManagementDrawer.svelte
+++ b/packages/builder/src/nav/SchemaManagementDrawer.svelte
@@ -70,7 +70,19 @@
diff --git a/packages/core/src/indexing/indexSchemaCreator.js b/packages/core/src/indexing/indexSchemaCreator.js
index e46f8f7cbb..1111b56838 100644
--- a/packages/core/src/indexing/indexSchemaCreator.js
+++ b/packages/core/src/indexing/indexSchemaCreator.js
@@ -44,7 +44,7 @@ export const generateSchema = (hierarchy, indexNode) => {
keys,
map(k => ({ name: k, type: schema[k].name })),
filter(s => s.name !== "sortKey"),
- orderBy("name", ["desc"]), // reverse aplha
+ orderBy("name", ["desc"]), // reverse alpha
concat([{ name: "sortKey", type: all.string.name }]), // sortKey on end
reverse, // sortKey first, then rest are alphabetical
])