Files
windmill/frontend/src/lib/components/SavedInputsPickerViewer.svelte
Guilhem 802a16743b fix(frontend): improve capture payload preview (#5417)
* improve capture picker

* improve historic input viewer

* open object viewer on open

* Add test page

* fix performance

* fix perf

* handle object with no properties in schema diff

* remove click outside behavior for input editor

* fix

* all

* catch critical alerts errors

* critical alerts modal reactivity

* prevent one from removing himself in folders

* nits

* add standalone bundle support on CE

* fix codebase & bundles on EE

* local codebase in home

* feat(frontend): global recompute helper function (#5408)

* feat(frontend): global recompute helper function

* fixes

* remove unused import

* filteredIds -> excludeIds

* get(recomputeAllContext)?

* deal with circulare recomputes

* consistent naming

* sqlx update script on mac (#5420)

* fix(python): windows worker fails to install 3.10 (#5409)

```
execution error:\nFind python error: error: Failed to inspect Python interpreter from managed installations at `C:\\tmp\\windmill\\cache\\py_runtime\\cpython-3.10.16-windows-x86_64-none\\python.exe`\n  Caused by: Querying Python at `C:\\tmp\\windmill\\cache\\py_runtime\\cpython-3.10.16-windows-x86_64-none\\python.exe` failed with exit status exit code: 1\n\n[stderr]\nFatal Python error: _Py_HashRandomization_Init: failed to get random numbers to initialize Python\nPython runtime state: preinitialized\n"
```

* feat: more controls on setting token duration (#5421)

* allow setting max session length

* more options for expiration

* sqlx

* option to invalidate all old sessions on new session

* sqlx update script on mac

* order

* add audit log

---------

Co-authored-by: Ruben Fiszel <ruben@windmill.dev>

* fix: do not depend on public schema anymore

* feat: add template script for all triggers (#5424)

* nits: add/update create from template for trigger

* fix: remove kafka folder

* chore(main): release 1.474.0 (#5423)

* chore(main): release 1.474.0

* Apply automatic changes

---------

Co-authored-by: rubenfiszel <275584+rubenfiszel@users.noreply.github.com>

* allow ce to run codebase bundles preview

* allow ce to run codebase bundles preview

* feat(frontend): improve flow suspend status display (#5425)

* feat(backend): option to invalidate all sessions on logout (#5419)

* feat(backend): option to invalidate all sessions on logout

* lazy static

* Update backend/.sqlx/query-8cccb31aa56af16af675c692bf4e14b297d2caeafd1c4e4b1584f3bc9ff4c563.json

Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>

* sqlx

* sqlx

* all -> invalidate-all

* add audit log

* rename env var

---------

Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>

* feat: MQTT triggers (#5277)

* first commit

* update migration mqtt

* chore: update dependencies

* add cli support and update schema for mqtt

* update: casing style

* update: rename get_resource function and moving to resource.rs

* feat:

* feat: refactored

* feat: add ready endpoints for workers to enterprise

* feat: handle connection to server

* fix: main.rs

* feat: added support v5

* feat: 🚧 updated .github, handle more case for v5 and handle v3

* feat: handled client, update script helper

* update .sqlx

* refactor: added generic implement and trait to remove redundant code, misses client impleme

* feat: remove optinal property update test function

* feat: done

* handle client certificate

* minor fix

* fix: tls and mtls

* fix: min topic len in frontend

* Update frontend/src/lib/components/triggers/mqtt/MqttEditorConfigSection.svelte

Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>

* Update backend/windmill-api/openapi.yaml

Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>

* Update backend/windmill-api/src/mqtt_triggers.rs

Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>

* update openapi, and script_helper.ts

* fix: toggle button and update mqtt migration

* nits: remove postgres type and only relies on serde

* fix: timeout connection

* fix typo and captures

* fix: capture table reactivity

* handle more mqtt v5 option

* nits: remove clone method

* update: better naming

* nits: display tooltip qos

* fix: hanle tls connection with natively

* update: add documentation links for qos and topics

* fix tooltip and add default value

* update: shoz preprocessor only if selected in capture table

* nits: show mqtt icon in resource related componenets

* update hub link and repo ref

* fix: unused var

* update ee ref

* fix: give good reference id for script hub

---------

Co-authored-by: Ruben Fiszel <ruben@windmill.dev>
Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>
Co-authored-by: Clement Zhang <clement.zhang2@gmail.com>

* accept otel parameters from envs

* nit improvements for CLI

* fix(cli): fix wmill user create-token with email and password

* Add utility function to check object size

* Add disabled option for Button dropdown

* handle big inputs

* clean code

* restore test page

* revert unwanted changes

* lazyload picker viewer

* fix guilhem code

* fix menu

---------

Co-authored-by: Ruben Fiszel <ruben@windmill.dev>
Co-authored-by: Alexander Petric <alpetric@users.noreply.github.com>
Co-authored-by: pyranota <92104930+pyranota@users.noreply.github.com>
Co-authored-by: dieriba <dieriba.pro@gmail.com>
Co-authored-by: rubenfiszel <275584+rubenfiszel@users.noreply.github.com>
Co-authored-by: HugoCasa <hugo@casademont.ch>
Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>
Co-authored-by: Clement Zhang <clement.zhang2@gmail.com>
Co-authored-by: Ruben Fiszel <ruben@rubenfiszel.com>
2025-03-06 17:00:15 +01:00

164 lines
4.3 KiB
Svelte

<script lang="ts">
import { Button } from '$lib/components/common'
import Popover from '$lib/components/meltComponents/Popover.svelte'
import ObjectViewerWrapper from '$lib/components/propertyPicker/ObjectViewerWrapper.svelte'
import { copyToClipboard, isObjectTooBig } from '$lib/utils'
import { Eye, CopyIcon, Loader2 } from 'lucide-svelte'
import { createEventDispatcher } from 'svelte'
export let payloadData: any
export let limitPayloadSize: boolean = false
export let hover: boolean = false
export let viewerOpen: boolean = false
export let maxWidth: number | undefined = undefined
export let editOptions: boolean = true
const dispatch = createEventDispatcher()
const payloadTooBigForPreview = payloadData != 'WINDMILL_TOO_BIG' && isObjectTooBig(payloadData)
const buttonWidth = 34
const floatingConfig = {
placement: 'bottom-end',
strategy: 'fixed',
offset: { mainAxis: 8, crossAxis: -buttonWidth },
gutter: 0,
middleware: [
{
name: 'flip',
options: {
fallbackPlacements: ['bottom-top']
}
}
]
}
const xOffset = editOptions ? 218 : 168 // width of the optional buttons on the right
let popover: Popover | undefined
let popoverOpen = false
let hoverTimeout: ReturnType<typeof setTimeout> | undefined
let objectViewerLoaded = false
let popoverFullyOpened = false
function handlePopoverChange(event: CustomEvent<boolean>) {
const isOpen = event.detail
popoverOpen = isOpen
if (!isOpen) {
objectViewerLoaded = false
popoverFullyOpened = false
} else {
// Set a small delay to ensure the popover is fully rendered before
// marking it as fully opened
setTimeout(() => {
popoverFullyOpened = true
}, 50)
}
dispatch('openChange', isOpen)
}
function handleHoverChange(isHovering: boolean) {
if (isHovering) {
// Start debounce timer when hovering starts
hoverTimeout = setTimeout(() => {
if (viewerOpen && popover && !popoverOpen) {
popover.open()
}
}, 100)
} else {
// Clear timeout if hover ends before debounce period
if (hoverTimeout) {
clearTimeout(hoverTimeout)
hoverTimeout = undefined
}
}
}
$: handleHoverChange(hover)
$: ajustedWidth = maxWidth ? Math.abs(maxWidth - xOffset) : undefined
</script>
<Popover
bind:this={popover}
{floatingConfig}
on:openChange={handlePopoverChange}
on:click={(e) => {
e.stopPropagation()
}}
closeOnOtherPopoverOpen
closeOnClickOutside={false}
usePointerDownOutside
>
<svelte:fragment slot="trigger" let:isOpen>
<Button
variant="contained"
color="light"
btnClasses={hover || isOpen ? 'block -my-2 hover:bg-surface bg-transparent' : 'hidden'}
wrapperClasses="p-0"
size="xs2"
iconOnly
nonCaptureEvent
startIcon={{ icon: Eye }}
/>
</svelte:fragment>
<svelte:fragment slot="content">
<div
class="p-2 overflow-auto"
style="width: {ajustedWidth ? ajustedWidth + 'px' : '50vh'}; max-height: 50vh"
>
{#if payloadData === 'WINDMILL_TOO_BIG'}
<div class="text-center text-tertiary text-xs">
{#if limitPayloadSize}
Payload too big to be used
{:else}
Payload too big to preview but can still be loaded
{/if}
</div>
{:else}
<div
class="relative p-2"
role="button"
tabindex="0"
aria-label="Copy JSON payload to clipboard"
on:click={() => {
copyToClipboard(JSON.stringify(payloadData))
}}
on:keydown
>
{#if !objectViewerLoaded && payloadTooBigForPreview}
<div class="flex justify-center items-center py-4">
<Loader2 size={20} class="animate-spin text-primary" />
<span class="ml-2 text-xs text-tertiary">Loading data...</span>
</div>
{/if}
{#if popoverFullyOpened || !payloadTooBigForPreview}
<div
class={!objectViewerLoaded && payloadTooBigForPreview
? 'invisible h-0 overflow-hidden'
: ''}
>
<ObjectViewerWrapper
json={payloadData}
allowCopy
pureViewer
on:mounted={() => (objectViewerLoaded = true)}
/>
</div>
{/if}
<div class="absolute top-2 right-2 w-full h-full">
<Button
variant="contained"
size="xs2"
class="absolute top-0 right-0"
iconOnly
startIcon={{ icon: CopyIcon }}
nonCaptureEvent
/>
</div>
</div>
{/if}
</div>
</svelte:fragment>
</Popover>