adds users store and moves some components

This commit is contained in:
Keviin Åberg Kultalahti 2021-05-07 09:47:05 +02:00
parent 555cdcd5c4
commit 0a42bce2c0
6 changed files with 82 additions and 4 deletions

View File

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@ -1,5 +1,5 @@
<script> <script>
import GoogleLogo from "./logos/Google.svelte" import GoogleLogo from "./_logos/Google.svelte"
import { import {
Button, Button,
Heading, Heading,

View File

@ -0,0 +1,22 @@
<script>
import { Body, Input, Select, ModalContent } from "@budibase/bbui"
const options = ["Email onboarding", "Basic onboarding"]
let selected = options[0]
</script>
<ModalContent
size="M"
title="Add new user options"
confirmText="Add user"
cancelText="Cancel"
showCloseIcon={false}
>
<Body noPadding
>If you have SMTP configured and an email for the new user, you can use the
automated email onboarding flow. Otherwise, use our basic onboarding process
with autogenerated passwords.</Body
>
<Select bind:value={selected} label="Add new user via:" {options} />
<Input label="Email" />
</ModalContent>

View File

@ -9,7 +9,22 @@
Table, Table,
Label, Label,
Layout, Layout,
Modal,
ModalContent,
} from "@budibase/bbui" } from "@budibase/bbui"
import AddUserModal from "./_components/AddUserModal.svelte"
import { users } from "stores/portal"
users.init()
const schema = {
email: {},
status: {},
// access: {},
// group: {}
}
export let modal
</script> </script>
<Layout> <Layout>
@ -31,14 +46,22 @@
</div> </div>
<div class="buttons"> <div class="buttons">
<ButtonGroup> <ButtonGroup>
<Button secondary>Import users</Button> <Button tooltip="Coming soon." disabled secondary>Import users</Button>
<Button overBackground>Add user</Button> <Button overBackground on:click={modal.show}>Add user</Button>
</ButtonGroup> </ButtonGroup>
</div> </div>
<Table schema /> <Table
{schema}
data={$users}
allowEditColumns={false}
allowEditRows={false}
allowSelectRows={false}
/>
</div> </div>
</Layout> </Layout>
<Modal bind:this={modal}><AddUserModal /></Modal>
<style> <style>
.users { .users {
position: relative; position: relative;

View File

@ -1,2 +1,3 @@
export { organisation } from "./organisation" export { organisation } from "./organisation"
export { users } from "./users"
export { admin } from "./admin" export { admin } from "./admin"

View File

@ -0,0 +1,32 @@
import { writable } from "svelte/store"
import api from "builderStore/api"
export function createUsersStore() {
const { subscribe, set } = writable({})
async function init() {
try {
const response = await api.get(`/api/admin/users`)
const json = await response.json()
set(json)
} catch (error) {
console.log(error)
}
}
return {
subscribe,
// save: async config => {
// try {
// await api.post("/api/admin/configs", { type: "settings", config })
// await init()
// return { status: 200 }
// } catch (error) {
// return { error }
// }
// },
init,
}
}
export const users = createUsersStore()