mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-08-23 16:00:38 +00:00
5d79f33590
* Remove $$props.field usage * Rename slots to ensure no hyphen * _props * _trigger * OnSelectedIteration type correct capitalization * rename _content * Remove afterUpdate * Migrate everything to svelte 5 * array bind * Fix popover * type never * nit fixes * Fixed many trivial errors * onClick * Fix errors * use let: * nit typing * fix: wrap state_referenced_locally vars with untrack() Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Add untrack import * Fix all syntax errors due to untrack migration * Fix undefined errors * Fix more undefined errors * untrack(() => initialOpen) * svelte-ignore * Fix state_descriptors_fixed error in Chart.svelte Use $state.snapshot() to pass plain copies of data/options to Chart.js instead of $state proxies. Chart.js's listenArrayEvents tries to define property descriptors on data arrays, which Svelte 5 proxies reject. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * nit typing * Merge issue * Fix "path is not set" error in resource picker / editor * Fix InputTransformForm error when rerunning some flows * fix npm run check --------- Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
70 lines
2.0 KiB
Svelte
70 lines
2.0 KiB
Svelte
<script lang="ts">
|
|
import { sendUserToast } from '$lib/toast'
|
|
import { createEventDispatcher } from 'svelte'
|
|
import { UserService } from '$lib/gen'
|
|
import { Button } from './common'
|
|
import TextInput from './text_input/TextInput.svelte'
|
|
import Toggle from './Toggle.svelte'
|
|
import { generateRandomString } from '$lib/utils'
|
|
import { globalEmailInvite } from '$lib/stores'
|
|
|
|
interface Props {
|
|
close?: (() => void) | undefined;
|
|
}
|
|
|
|
let { close = undefined }: Props = $props();
|
|
|
|
const dispatch = createEventDispatcher()
|
|
|
|
let is_super_admin = $state(false)
|
|
let password: string = $state(generateRandomString(10))
|
|
let name: string | undefined = $state()
|
|
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')
|
|
close?.()
|
|
}
|
|
</script>
|
|
|
|
<div class="p-4 flex flex-col gap-3 w-80">
|
|
<h3 class="text-sm font-semibold text-emphasis">Add new user to instance</h3>
|
|
<label class="block">
|
|
<span class="text-xs font-semibold text-emphasis">Email</span>
|
|
<TextInput
|
|
inputProps={{ type: 'email', placeholder: 'email' }}
|
|
bind:value={$globalEmailInvite}
|
|
/>
|
|
</label>
|
|
<label class="block">
|
|
<span class="text-xs font-semibold text-emphasis">Password</span>
|
|
<TextInput bind:value={password} />
|
|
</label>
|
|
<label class="block">
|
|
<span class="text-xs font-semibold text-emphasis">Name (optional)</span>
|
|
<TextInput inputProps={{ type: 'text', placeholder: 'name (optional)' }} bind:value={name} />
|
|
</label>
|
|
<Toggle bind:checked={is_super_admin} options={{ right: 'Superadmin' }} />
|
|
<Button
|
|
variant="accent"
|
|
size="sm"
|
|
on:click={addUser}
|
|
disabled={$globalEmailInvite == '' || password == undefined}
|
|
>
|
|
Add user to instance
|
|
</Button>
|
|
<div class="text-2xs text-secondary text-right">Email will be sent if SMTP configured</div>
|
|
</div>
|