convert createuser component to use new modal

This commit is contained in:
kevmodrome 2020-04-06 15:53:32 +02:00
parent 1f4e5339e4
commit 83c109612c
4 changed files with 31 additions and 26 deletions

View File

@ -35,5 +35,6 @@
footer {
padding: 20px;
background: #fafafa;
border-radius: 0.5rem;
}
</style>

View File

@ -29,6 +29,7 @@
</script>
<form class="uk-form-stacked">
<div>
<label class="uk-form-label" for="form-stacked-text">Username</label>
<input class="uk-input" type="text" bind:value={username} />
<label class="uk-form-label" for="form-stacked-text">Password</label>
@ -39,6 +40,7 @@
<option value={level.name}>{level.name}</option>
{/each}
</select>
</div>
<footer>
<ActionButton alert on:click={onClosed}>Cancel</ActionButton>
<ActionButton disabled={!valid} on:click={createUser}>Save</ActionButton>
@ -46,13 +48,13 @@
</form>
<style>
div {
padding: 30px;
}
footer {
position: absolute;
padding: 20px;
width: 100%;
bottom: 0;
left: 0;
background: #fafafa;
border-radius: 0.5rem;
}
select {
width: 100%;

View File

@ -6,7 +6,10 @@
import UsersList from "./UsersList.svelte"
import NavItem from "./NavItem.svelte"
import getIcon from "components/common/icon"
import { CreateDatabaseModal } from "components/database/ModelDataTable/modals"
import {
CreateDatabaseModal,
CreateUserModal,
} from "components/database/ModelDataTable/modals"
const { open, close } = getContext("simple-modal")
const openDatabaseCreator = () => {
@ -18,6 +21,15 @@
{ styleContent: { padding: "0" } }
)
}
const openUserCreator = () => {
open(
CreateUserModal,
{
onClosed: close,
},
{ styleContent: { padding: "0" } }
)
}
</script>
<div class="items-root">
@ -39,9 +51,7 @@
<div class="components-list-container">
<div class="nav-group-header">
<div class="hierarchy-title">Users</div>
<i
class="ri-add-line hoverable"
on:click={() => backendUiStore.actions.modals.show('USER')} />
<i class="ri-add-line hoverable" on:click={openUserCreator} />
</div>
</div>

View File

@ -31,9 +31,7 @@
$: recordOpen = $backendUiStore.visibleModal === "RECORD"
$: modelOpen = $backendUiStore.visibleModal === "MODEL"
$: viewOpen = $backendUiStore.visibleModal === "VIEW"
$: databaseOpen = $backendUiStore.visibleModal === "DATABASE"
$: deleteRecordOpen = $backendUiStore.visibleModal === "DELETE_RECORD"
$: userOpen = $backendUiStore.visibleModal === "USER"
</script>
<!-- <Modal isOpen={!!$backendUiStore.visibleModal} {onClosed}>
@ -46,15 +44,9 @@
{#if viewOpen}
<CreateEditViewModal {onClosed} />
{/if}
{#if databaseOpen}
<CreateDatabaseModal {onClosed} />
{/if}
{#if deleteRecordOpen}
<DeleteRecordModal record={selectedRecord} {onClosed} />
{/if}
{#if userOpen}
<CreateUserModal {onClosed} />
{/if}
</Modal> -->
<div class="root">