modal restructuring

This commit is contained in:
Martin McKeaveney 2020-03-17 00:20:13 +00:00
parent fa95ba2d79
commit 38d7623862
4 changed files with 22 additions and 20 deletions

View File

@ -9,7 +9,11 @@
import DropdownButton from "../common/DropdownButton.svelte" import DropdownButton from "../common/DropdownButton.svelte"
import ActionButton from "../common/ActionButton.svelte" import ActionButton from "../common/ActionButton.svelte"
import Modal from "../common/Modal.svelte" import Modal from "../common/Modal.svelte"
import { CreateEditRecordModal } from "./ModelDataTable/modals" import {
CreateEditRecordModal,
CreateEditModelModal,
CreateEditViewModal,
} from "./ModelDataTable/modals"
let modalOpen let modalOpen
let selectedRecord let selectedRecord
@ -18,10 +22,14 @@
selectedRecord = record selectedRecord = record
modalOpen = true modalOpen = true
} }
$: recordOpen = $store.currentNode && $store.currentNode.type === 'record'
$: viewOpen = $store.currentNode && $store.currentNode.type === 'index'
</script> </script>
<CreateEditRecordModal bind:modalOpen record={selectedRecord} /> <CreateEditRecordModal bind:modalOpen record={selectedRecord} />
<!-- <DeleteRecordModal modalOpen={deleteRecordModal} record={selectedRecord} /> --> <CreateEditModelModal modalOpen={recordOpen} />
<CreateEditViewModal modalOpen={viewOpen} />
<div class="root"> <div class="root">
<div class="node-view"> <div class="node-view">
@ -35,17 +43,6 @@
Create new record Create new record
</ActionButton> </ActionButton>
<ModelDataTable {selectRecord} /> <ModelDataTable {selectRecord} />
{#if $store.currentNode}
<Modal isOpen={$store.currentNode}>
{#if $store.currentNode.type === 'record'}
<ModelView />
<ActionsHeader />
{:else}
<IndexView />
<ActionsHeader />
{/if}
</Modal>
{/if}
</div> </div>
</div> </div>

View File

@ -1,6 +1,8 @@
<script> <script>
import Modal from "../../common/Modal.svelte" import Modal from "../../../common/Modal.svelte"
import ActionButton from "../../common/ActionButton.svelte" import ActionButton from "../../../common/ActionButton.svelte"
import ModelView from "../../ModelView.svelte"
import ActionsHeader from "../../ActionsHeader.svelte"
import * as api from "./api" import * as api from "./api"
export let modalOpen = false export let modalOpen = false
@ -13,11 +15,13 @@
<Modal {onClosed} bind:isOpen={modalOpen} title={'Record'}> <Modal {onClosed} bind:isOpen={modalOpen} title={'Record'}>
<h4 class="budibase__title--4">Create / Edit Model</h4> <h4 class="budibase__title--4">Create / Edit Model</h4>
<div class="actions"> <div class="actions">
<ActionButton alert on:click={onClosed}>Cancel</ActionButton> <ModelView />
<ActionsHeader />
<!-- <ActionButton alert on:click={onClosed}>Cancel</ActionButton>
<ActionButton <ActionButton
disabled={false} disabled={false}
on:click={() => api.createNewRecord(recordInfo)}> on:click={() => api.createNewRecord(recordInfo)}>
Save Save
</ActionButton> </ActionButton> -->
</div> </div>
</Modal> </Modal>

View File

@ -1,2 +1,3 @@
export { default as DeleteRecordModal } from "./DeleteRecord.svelte"; export { default as DeleteRecordModal } from "./DeleteRecord.svelte";
export { default as CreateEditRecordModal } from "./CreateEditRecord.svelte"; export { default as CreateEditRecordModal } from "./CreateEditRecord.svelte";
export { default as CreateEditModelModal } from "./CreateEditModel.svelte";

View File

@ -74,10 +74,10 @@
<i class="ri-add-line hoverable" /> <i class="ri-add-line hoverable" />
<div uk-dropdown="mode: click"> <div uk-dropdown="mode: click">
<ul class="uk-nav uk-dropdown-nav"> <ul class="uk-nav uk-dropdown-nav">
<li class="hoverable" on:click={() => {}}> <li class="hoverable" on:click={newRootRecord}>
Model Model
</li> </li>
<li class="hoverable" on:click={() => {}}> <li class="hoverable" on:click={newRootIndex}>
View View
</li> </li>
</ul> </ul>