allow creation of child views

This commit is contained in:
Martin McKeaveney 2020-03-26 10:10:18 +00:00
parent 6ac63dfdf9
commit ff0ecda010
3 changed files with 15 additions and 6 deletions

View File

@ -4,6 +4,7 @@
import Button from "../common/Button.svelte" import Button from "../common/Button.svelte"
import Dropdown from "../common/Dropdown.svelte" import Dropdown from "../common/Dropdown.svelte"
import { store } from "../builderStore" import { store } from "../builderStore"
import ActionsHeader from "./ActionsHeader.svelte"
import { filter, some, map, compose } from "lodash/fp" import { filter, some, map, compose } from "lodash/fp"
import { hierarchy as hierarchyFunctions, common } from "../../../core/src" import { hierarchy as hierarchyFunctions, common } from "../../../core/src"
import ErrorsBox from "../common/ErrorsBox.svelte" import ErrorsBox from "../common/ErrorsBox.svelte"
@ -98,6 +99,7 @@
<CodeArea bind:text={index.getShardName} label="Shard Name" /> <CodeArea bind:text={index.getShardName} label="Shard Name" />
{/if} {/if}
<ActionsHeader />
</form> </form>
<style> <style>

View File

@ -6,5 +6,4 @@
<section> <section>
<IndexView /> <IndexView />
<ActionsHeader />
</section> </section>

View File

@ -1,4 +1,5 @@
<script> <script>
import { tick } from "svelte"
import Textbox from "../common/Textbox.svelte" import Textbox from "../common/Textbox.svelte"
import Button from "../common/Button.svelte" import Button from "../common/Button.svelte"
import Select from "../common/Select.svelte" import Select from "../common/Select.svelte"
@ -7,7 +8,7 @@
import FieldView from "./FieldView.svelte" import FieldView from "./FieldView.svelte"
import Modal from "../common/Modal.svelte" import Modal from "../common/Modal.svelte"
import { map, join, filter, some, find, keys, isDate } from "lodash/fp" import { map, join, filter, some, find, keys, isDate } from "lodash/fp"
import { store } from "../builderStore" import { store, backendUiStore } from "../builderStore"
import { common, hierarchy } from "../../../core/src" import { common, hierarchy } from "../../../core/src"
import { getNode } from "../common/core" import { getNode } from "../common/core"
import { templateApi, pipe, validate } from "../common/core" import { templateApi, pipe, validate } from "../common/core"
@ -111,7 +112,7 @@
<form class="uk-form-stacked"> <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} {#if isChildModel}
<div> <div>
<label class="uk-form-label">Parent</label> <label class="uk-form-label">Parent</label>
@ -151,9 +152,16 @@
</table> </table>
<ActionsHeader> <ActionsHeader>
{#if modelExistsInHierarchy} {#if modelExistsInHierarchy}
<ActionButton color="primary" on:click={store.newChildRecord}> <ActionButton color="primary" on:click={store.newChildRecord}>
Create Child Model on {record.name} Create Child Model on {record.name}
</ActionButton> </ActionButton>
<ActionButton color="primary" on:click={async () => {
backendUiStore.actions.modals.show("VIEW")
await tick()
store.newChildIndex()
}}>
Create Child View on {record.name}
</ActionButton>
{/if} {/if}
</ActionsHeader> </ActionsHeader>
{:else} {:else}