convert createuser component to use new modal

This commit is contained in:
kevmodrome 2020-04-06 15:53:32 +02:00
parent a0aa2f03a8
commit 85289889f4
4 changed files with 31 additions and 26 deletions

View File

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

View File

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

View File

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

View File

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