drilldown complete, deleting model fields

This commit is contained in:
Martin McKeaveney 2020-03-26 17:39:42 +00:00
parent 161e6271f3
commit c543cb143a
5 changed files with 37 additions and 16 deletions

View File

@ -56,7 +56,7 @@ export const getBackendUiStore = () => {
},
views: {
select: view => store.update(state => {
state.selectedView = { ...state.selectedView, ...view }
state.selectedView = view
return state
})
},

View File

@ -74,7 +74,7 @@
)
async function fetchRecordsForView(view, instance) {
if (!view.name) return
if (!view || !view.name) return
const viewName = $backendUiStore.selectedRecord
? `${$backendUiStore.selectedRecord.key}/${view.name}`

View File

@ -59,4 +59,10 @@
left: 0;
background: #fafafa;
}
select {
width: 100%;
}
option {
padding: 10px;
}
</style>

View File

@ -29,7 +29,10 @@
$: models = $store.hierarchy.children
$: parent = record && record.parent()
$: isChildModel = parent.name !== "root"
$: modelExistsInHierarchy = getNode($store.hierarchy, $store.currentNode.nodeId)
$: modelExistsInHierarchy = getNode(
$store.hierarchy,
$store.currentNode.nodeId
)
store.subscribe($store => {
record = $store.currentNode
@ -112,7 +115,7 @@
<form class="uk-form-stacked">
<Textbox label="Name" bind:text={record.name} on:change={nameChanged} />
<Textbox label="Name" bind:text={record.name} on:change={nameChanged} />
{#if isChildModel}
<div>
<label class="uk-form-label">Parent</label>
@ -133,6 +136,7 @@
<th>Name</th>
<th>Type</th>
<th>Values</th>
<th />
</tr>
</thead>
<tbody>
@ -146,24 +150,32 @@
</td>
<td>{field.type}</td>
<td>{field.typeOptions.values}</td>
<td>
<i
class="ri-delete-bin-6-line hoverable"
on:click={() => deleteField(field)} />
</td>
</tr>
{/each}
</tbody>
</table>
<ActionsHeader>
{#if modelExistsInHierarchy}
{#if modelExistsInHierarchy}
<div class="uk-margin">
<ActionButton color="primary" on:click={store.newChildRecord}>
Create Child Model on {record.name}
</ActionButton>
<ActionButton color="primary" on:click={async () => {
backendUiStore.actions.modals.show("VIEW")
await tick()
store.newChildIndex()
}}>
<ActionButton
color="primary"
on:click={async () => {
backendUiStore.actions.modals.show('VIEW')
await tick()
store.newChildIndex()
}}>
Create Child View on {record.name}
</ActionButton>
{/if}
</ActionsHeader>
</div>
{/if}
<ActionsHeader />
{:else}
<FieldView
field={fieldToEdit}

View File

@ -1,14 +1,17 @@
<script>
import { tick } from "svelte";
import { store, backendUiStore } from "../builderStore"
import getIcon from "../common/icon"
import { CheckIcon } from "../common/Icons"
$: instances = $store.appInstances
$: views = $store.hierarchy.indexes
function selectDatabase(database) {
backendUiStore.actions.database.select(database)
backendUiStore.actions.records.select(null)
async function selectDatabase(database) {
backendUiStore.actions.navigate("DATABASE")
backendUiStore.actions.records.select(null)
backendUiStore.actions.views.select(views[0])
backendUiStore.actions.database.select(database)
}
</script>