mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-09-09 16:05:42 +00:00
* use melt menu in sidebar * stop keyboard navigation for disabled items * use melt menu for FavoriteMenu and WorkspaceMenu * fix popover placement for menuButton * use melt menu for operator menu * fix notification * fix operator menu * Use melt menu in FlowJobsMenu * use melt menu for AppMenu * clean code * clean code * add use clickOutside option to Menu * use pointerdown_outside * use pointerdown_outside # Conflicts: # frontend/src/lib/components/meltComponents/Menu.svelte * use pointerdown in menus * add max-h to app dropdown menu * keep more open in operator menu * add a MenuItem component * clean * nit * nit * clean code * put conditionalMelt as utility function * remove unused Portal * Add debounce effect in operator menu * fix component jumping due to z-index * format pages * migrate dropdown to melt * migrate popup to melt popover * feat: remove `pip` fallback option for python and ansible (#5186) * refactor!: Remove `pip` fallback option for python and ansible BREAKING CHANGE: pip was deprecated since 1.425.0 (2024-11-15) * fix errors in main.rs * fix tests * remove nsjail for pip * fix imports * fix compilation error * reinforce melt types * fix racing condition issue in closing operator menu * nit * fix id conflix with melt element * nit * clean code * use melt dropdown instead of menubar * prevent modal from closing on click outside button in menu * fix nit * nit * close dropdown when opening a new one * replace MenuV2 with melt Menu (1/4) (#5214) * use melt menu in sidebar * stop keyboard navigation for disabled items * use melt menu for FavoriteMenu and WorkspaceMenu * fix popover placement for menuButton * use melt menu for operator menu * fix notification * fix operator menu * Use melt menu in FlowJobsMenu * use melt menu for AppMenu * clean code * clean code * add use clickOutside option to Menu * use pointerdown_outside * use pointerdown_outside # Conflicts: # frontend/src/lib/components/meltComponents/Menu.svelte * use pointerdown in menus * add max-h to app dropdown menu * keep more open in operator menu * add a MenuItem component * clean * nit * nit * clean code * put conditionalMelt as utility function * remove unused Portal * Add debounce effect in operator menu * fix component jumping due to z-index * feat: remove `pip` fallback option for python and ansible (#5186) * refactor!: Remove `pip` fallback option for python and ansible BREAKING CHANGE: pip was deprecated since 1.425.0 (2024-11-15) * fix errors in main.rs * fix tests * remove nsjail for pip * fix imports * fix compilation error * reinforce melt types * fix racing condition issue in closing operator menu * nit * fix id conflix with melt element * nit * prevent modal from closing on click outside button in menu --------- Co-authored-by: pyranota <92104930+pyranota@users.noreply.github.com> Co-authored-by: Ruben Fiszel <ruben@windmill.dev> # Conflicts: # frontend/src/lib/components/meltComponents/MenuItem.svelte # frontend/src/lib/utils.ts * clean * fix z index and render * fix initialize of dropdownmenu after melt migration * feat: add support for | None and Optional in python (#5361) * feat: add support for | None and Optional in python * update python parser package * add local rooting for MenuItem * fix z index * clean * nit * nit * clean code * nit --------- Co-authored-by: pyranota <92104930+pyranota@users.noreply.github.com> Co-authored-by: Ruben Fiszel <ruben@windmill.dev> Co-authored-by: HugoCasa <hugo@casademont.ch>
151 lines
3.9 KiB
Svelte
151 lines
3.9 KiB
Svelte
<script lang="ts">
|
|
import { Pencil } from 'lucide-svelte'
|
|
import { createEventDispatcher } from 'svelte'
|
|
import Button from './common/button/Button.svelte'
|
|
import Popover from './meltComponents/Popover.svelte'
|
|
import { offset, flip, shift } from 'svelte-floating-ui/dom'
|
|
import ChangeInstanceUsernameInner from './ChangeInstanceUsernameInner.svelte'
|
|
import { UserService } from '$lib/gen'
|
|
import { sendUserToast } from '$lib/toast'
|
|
|
|
export let value: string | undefined
|
|
export let email: string
|
|
export let username: string | undefined = undefined
|
|
export let automateUsernameCreation: boolean = false
|
|
export let login_type: string
|
|
|
|
let password: string = ''
|
|
|
|
const dispatch = createEventDispatcher()
|
|
|
|
function saveName() {
|
|
dispatch('save', value)
|
|
}
|
|
async function savePassword() {
|
|
if (password.length < 5) {
|
|
sendUserToast('Password must be at least 5 characters long', true)
|
|
return
|
|
}
|
|
await UserService.setPasswordForUser({ user: email, requestBody: { password } })
|
|
sendUserToast(`Password updated for ${email}`)
|
|
}
|
|
|
|
async function saveLoginType() {
|
|
await UserService.setLoginTypeForUser({ user: email, requestBody: { login_type } })
|
|
sendUserToast(`Login type updated for ${email}`)
|
|
dispatch('refresh')
|
|
}
|
|
</script>
|
|
|
|
<Popover
|
|
floatingConfig={{
|
|
strategy: 'fixed',
|
|
placement: 'left-end',
|
|
middleware: [offset(8), flip(), shift()]
|
|
}}
|
|
closeButton
|
|
>
|
|
<svelte:fragment slot="trigger">
|
|
<Button nonCaptureEvent={true} size="xs" color="light" endIcon={{ icon: Pencil }}>Edit</Button>
|
|
</svelte:fragment>
|
|
<svelte:fragment slot="content">
|
|
<div class="flex flex-col gap-8 max-w-sm p-4">
|
|
{#if automateUsernameCreation && username}
|
|
<ChangeInstanceUsernameInner {email} {username} on:renamed noPadding />
|
|
{/if}
|
|
<label class="block text-primary">
|
|
<div class="pb-2 text-sm font-semibold text-primary">Name</div>
|
|
<div class="flex w-full">
|
|
<input
|
|
type="text"
|
|
bind:value
|
|
class="!w-auto grow"
|
|
on:click|stopPropagation={() => {}}
|
|
on:keydown|stopPropagation
|
|
on:keypress|stopPropagation={({ key }) => {
|
|
if (key === 'Enter') {
|
|
saveName()
|
|
}
|
|
}}
|
|
/>
|
|
</div>
|
|
<Button
|
|
size="xs"
|
|
color="blue"
|
|
buttonType="button"
|
|
btnClasses="mt-2 "
|
|
aria-label="Save ID"
|
|
on:click={() => {
|
|
saveName()
|
|
}}
|
|
>
|
|
Update name
|
|
</Button>
|
|
</label>
|
|
<label class="block text-primary">
|
|
<div class="pb-2 text-sm font-semibold text-primary">Password</div>
|
|
<div class="flex w-full">
|
|
<input
|
|
type="password"
|
|
bind:value={password}
|
|
class="!w-auto grow"
|
|
on:click|stopPropagation={() => {}}
|
|
on:keydown|stopPropagation
|
|
on:keypress|stopPropagation={({ key }) => {
|
|
if (key === 'Enter') {
|
|
savePassword()
|
|
}
|
|
}}
|
|
/>
|
|
</div>
|
|
<Button
|
|
size="xs"
|
|
color="blue"
|
|
buttonType="button"
|
|
btnClasses="mt-2 "
|
|
aria-label="Save ID"
|
|
on:click={() => {
|
|
savePassword()
|
|
}}
|
|
>
|
|
Update password
|
|
</Button>
|
|
</label>
|
|
<label class="block text-primary">
|
|
<div class="pb-2 text-sm font-semibold text-primary">Login type</div>
|
|
<div class="text-xs text-secondary mb-2">
|
|
Must match exact SSO name, "password" or "saml". Examples: password, google, saml,
|
|
microsoft
|
|
</div>
|
|
|
|
<div class="flex w-full">
|
|
<input
|
|
type="text"
|
|
bind:value={login_type}
|
|
class="!w-auto grow"
|
|
on:click|stopPropagation={() => {}}
|
|
on:keydown|stopPropagation
|
|
on:keypress|stopPropagation={({ key }) => {
|
|
if (key === 'Enter') {
|
|
saveLoginType()
|
|
}
|
|
}}
|
|
/>
|
|
</div>
|
|
<Button
|
|
size="xs"
|
|
color="blue"
|
|
buttonType="button"
|
|
btnClasses="mt-2 "
|
|
aria-label="Save login type"
|
|
on:click={() => {
|
|
saveLoginType()
|
|
}}
|
|
>
|
|
Update login type
|
|
</Button>
|
|
</label>
|
|
</div>
|
|
</svelte:fragment>
|
|
</Popover>
|