Files
windmill/frontend/src/lib/components/InviteGlobalUser.svelte
T
Faton Ramadani b39f486c91 Dark mode v0 (#1893)
* feat(frontend): wip

* wip

* wip

* wip

* wip

* add toggle

* correctly handle monaco theme

* wip

* wip

* wip

* wip

* wip

* feat(frontend): Dark mode v0

* feat(frontend): Adap AI gen poppup

* feat(frontend): Adap script metadata labels

* feat(frontend): Fix unreadable texts

* feat(frontend): Fix unreadable texts

* feat(frontend): Fix unreadable texts

* feat(frontend): Fix ressource picker

* feat(frontend): Fix unreadable texts

* feat(frontend): Fix unreadable texts

* feat(frontend): Fix unreadable texts

* feat(frontend): Add theme toggle in the login page

* feat(frontend): Fix unreadable texts

* feat(frontend): Fix language selection

* feat(frontend): Fix FlowStatusViewer colors

* feat(frontend): Fix divide colors

* feat(frontend): Fix flow graph buttons

* feat(frontend): add theme toggle in login modal

* feat(frontend): small ui fix

* feat(frontend): fix graph dark mode toggle
2023-07-25 10:43:04 +02:00

68 lines
1.9 KiB
Svelte

<script lang="ts">
import { sendUserToast } from '$lib/toast'
import { createEventDispatcher } from 'svelte'
import { UserService } from '$lib/gen'
import { Button } from './common'
import Toggle from './Toggle.svelte'
import { generateRandomString } from '$lib/utils'
import { globalEmailInvite } from '$lib/stores'
const dispatch = createEventDispatcher()
let is_super_admin = false
let password: string = generateRandomString(10)
let name: string | undefined
let company: string | undefined
async function addUser() {
await UserService.createUserGlobally({
requestBody: {
email: $globalEmailInvite,
password,
super_admin: is_super_admin,
name,
company
}
})
sendUserToast(`Added ${$globalEmailInvite}`)
$globalEmailInvite = ''
password = generateRandomString(10)
dispatch('new')
}
</script>
<div class="flex flex-row gap-2 mb-2 items-end">
<label class="block shrink min-w-0">
<span class="text-secondary text-sm">Email</span>
<input type="email" placeholder="email" bind:value={$globalEmailInvite} />
</label>
<label class="block shrink min-w-0">
<span class="text-secondary text-sm">Password</span>
<input bind:value={password} />
</label>
<Toggle class="mx-2" bind:checked={is_super_admin} options={{ right: 'Superadmin' }} />
<div class="flex flex-row-reverse grow">
<div class="flex">
<Button
variant="contained"
color="dark"
size="sm"
on:click={addUser}
disabled={$globalEmailInvite == '' || password == undefined}
>
Add user to instance
</Button>
</div>
</div>
</div>
<div class="flex gap-2 items-end">
<div>
<input type="text" placeholder="name (optional)" bind:value={name} />
</div>
<div>
<input type="text" placeholder="company (optional)" bind:value={company} />
</div>
<div class="text-xs text-tertiary grow text-right"> Email will be sent if SMTP configured </div>
</div>