mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-09-10 08:07:03 +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 * 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 * clean * fix z index and render --------- Co-authored-by: pyranota <92104930+pyranota@users.noreply.github.com> Co-authored-by: Ruben Fiszel <ruben@windmill.dev>
85 lines
2.5 KiB
Svelte
85 lines
2.5 KiB
Svelte
<script lang="ts">
|
|
import Dropdown from '$lib/components/DropdownV2.svelte'
|
|
import { classNames } from '$lib/utils'
|
|
import { createEventDispatcher, getContext } from 'svelte'
|
|
import type { AppViewerContext } from '../types'
|
|
import { Bug } from 'lucide-svelte'
|
|
|
|
export let tabs: any[] = []
|
|
export let id: string
|
|
|
|
export let isConditionalDebugMode: boolean = false
|
|
export let isSmall = false
|
|
|
|
const { componentControl } = getContext<AppViewerContext>('AppViewerContext')
|
|
const dispatch = createEventDispatcher()
|
|
|
|
export let isManuallySelected: boolean = false
|
|
let selected: number | null = null
|
|
|
|
async function getItems() {
|
|
return [
|
|
...tabs.map((_, index) => ({
|
|
displayName:
|
|
index === tabs.length - 1
|
|
? isConditionalDebugMode
|
|
? `Debug default condition`
|
|
: `Debug tab ${index + 1}`
|
|
: `Debug ${isConditionalDebugMode ? 'condition' : 'tab'} ${index + 1}`,
|
|
action: () => {
|
|
$componentControl?.[id]?.setTab?.(index)
|
|
selected = index
|
|
isManuallySelected = true
|
|
},
|
|
type: 'action' as const
|
|
})),
|
|
{
|
|
displayName: 'Reset debug mode',
|
|
action: () => {
|
|
$componentControl?.[id]?.setTab?.(-1)
|
|
selected = null
|
|
isManuallySelected = false
|
|
},
|
|
type: 'delete' as const
|
|
}
|
|
]
|
|
}
|
|
</script>
|
|
|
|
{#key tabs}
|
|
<Dropdown items={getItems} class="w-fit h-auto" usePointerDownOutside>
|
|
<svelte:fragment slot="buttonReplacement">
|
|
<button
|
|
title={isConditionalDebugMode ? 'Debug conditions' : 'Debug tabs'}
|
|
class={classNames(
|
|
'px-1 text-2xs font-bold w-fit h-full cursor-pointer rounded',
|
|
isManuallySelected
|
|
? 'hover:bg-red-200 hover:text-red-800'
|
|
: 'text-blue-600 hover:bg-blue-300 hover:text-blue-800'
|
|
)}
|
|
on:click={() => dispatch('triggerInlineEditor')}
|
|
on:pointerdown|stopPropagation
|
|
>
|
|
{#if isManuallySelected}
|
|
<div class="whitespace-nowrap">
|
|
{#if selected === tabs.length - 1}
|
|
{#if isSmall}
|
|
{isConditionalDebugMode ? `df` : `t ${selected + 1}`}
|
|
{:else}
|
|
{isConditionalDebugMode ? `Debug default condition` : `Debug tab ${selected + 1}`}
|
|
{/if}
|
|
{:else if isSmall}
|
|
{`${isConditionalDebugMode ? 'c' : 't'} ${(selected ?? 0) + 1}`}
|
|
{:else}
|
|
{`Debugging ${isConditionalDebugMode ? 'condition' : 'tab'} ${
|
|
(selected ?? 0) + 1
|
|
}`}{/if}
|
|
</div>
|
|
{:else if isSmall}<Bug size={11} />{:else}
|
|
{isConditionalDebugMode ? `Debug conditions` : `Debug tabs`}
|
|
{/if}
|
|
</button>
|
|
</svelte:fragment>
|
|
</Dropdown>
|
|
{/key}
|