Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
425 commits
Select commit Hold shift + click to select a range
e432295
migrate postgresEditorInner to svelte 5 syntaxe
Guilhem-lm Apr 23, 2025
dbd28ca
Add postgress
Guilhem-lm Apr 23, 2025
da6cf2c
add postgres capture section
Guilhem-lm Apr 23, 2025
be6727f
migrate kafka trigger config to svelte 5
Guilhem-lm Apr 23, 2025
9e2e0c9
use snippets in kafka config
Guilhem-lm Apr 23, 2025
d032e69
feat: Update KafkaTriggerEditorInner with editMode, hideTarget and ot…
Guilhem-lm Apr 28, 2025
207f2ab
feat: Create KafkaTriggerPanelV2 following WebsocketTriggersPanelV2 m…
Guilhem-lm Apr 28, 2025
2018369
feat: Integrate KafkaTriggerPanelV2 into TriggersEditorV2
Guilhem-lm Apr 28, 2025
6a3a733
feat: add kafka capture panel
Guilhem-lm Apr 28, 2025
800ef6d
use svelte 5 syntaxe for nats config
Guilhem-lm Apr 28, 2025
5ae6ac4
use snippet in nats config
Guilhem-lm Apr 28, 2025
4738491
feat: add editMode for nats trigger config
Guilhem-lm Apr 28, 2025
7c720ff
fix import
Guilhem-lm Apr 28, 2025
ba42e67
create NatsTriggerPanelV2.svelte for NATS trigger
Guilhem-lm Apr 28, 2025
8fbf6a2
integrate NatsTriggerPanelV2 into TriggersEditorV2.svelte
Guilhem-lm Apr 28, 2025
d49f863
Create NatsCapture.svelte and update CaptureWrapperV2.svelte to use it
Guilhem-lm Apr 28, 2025
6dd7909
migrate MqttTriggerEditorInner to svelte 5
Guilhem-lm Apr 28, 2025
d42d962
add mqtt trigger to new trigger panel
Guilhem-lm Apr 28, 2025
3ecb9df
migrate SqsTriggerEditorInner to svelte 5 syntaxe
Guilhem-lm Apr 28, 2025
dc8ba4f
feat: add sqs triggers panel
Guilhem-lm Apr 28, 2025
05fe600
Add badge to MQTT config section
Guilhem-lm Apr 28, 2025
9af173b
remove unnecessary binding
Guilhem-lm Apr 28, 2025
6a8661f
add gcp to the trigger list
Guilhem-lm Apr 28, 2025
df34d78
add prop size to GCP icon
Guilhem-lm Apr 28, 2025
58f0df9
add gcp trigger utils
Guilhem-lm Apr 28, 2025
80ed599
migrate GcpTriggerEditorInner to svelte5 syntaxe
Guilhem-lm Apr 28, 2025
a3d5d14
add gcp trigger panel
Guilhem-lm Apr 28, 2025
68255ef
Revert "add gcp trigger utils"
Guilhem-lm Apr 28, 2025
1ad680b
fix type error
Guilhem-lm Apr 28, 2025
b689e1c
add gcp to trigger bar
Guilhem-lm Apr 28, 2025
854fd27
add capture gcp panel
Guilhem-lm Apr 28, 2025
025ae78
add schedule poll panel
Guilhem-lm Apr 28, 2025
32fe3b0
feat: add trigger table horizontal bar
Guilhem-lm Apr 28, 2025
bb63ec4
add http trigger label
Guilhem-lm Apr 28, 2025
1286e5c
make triggerbar vertical
Guilhem-lm Apr 28, 2025
71ad434
nit
Guilhem-lm Apr 29, 2025
b12eb08
add trigger delete button for drafts
Guilhem-lm Apr 29, 2025
9979791
enable edit from table for all triggers
Guilhem-lm Apr 29, 2025
b280293
fix automatic edit mode for draft trigger
Guilhem-lm Apr 29, 2025
bb82aaa
fix proxy dispatching issue
Guilhem-lm Apr 29, 2025
b01bb93
fix primary star positionning
Guilhem-lm Apr 29, 2025
30d7dd6
fix apply args to preprocessor
Guilhem-lm Apr 29, 2025
c1be940
automatically load bigpayloads
Guilhem-lm Apr 29, 2025
14aa5d8
clean capture wrapper code
Guilhem-lm Apr 29, 2025
50a31c0
nit
Guilhem-lm Apr 29, 2025
fb69f99
fix capture config not passed
Guilhem-lm Apr 29, 2025
527f2fd
use Url component
Guilhem-lm Apr 29, 2025
7b0065e
remove unused prop captureTable
Guilhem-lm Apr 29, 2025
8ab41ae
use new schedule panel for scheduled poll
Guilhem-lm Apr 29, 2025
395d707
update triggersWrapperV2
Guilhem-lm Apr 29, 2025
7ff47d2
improve webhook capture panel
Guilhem-lm Apr 29, 2025
cb91cd9
remove debug log
Guilhem-lm Apr 29, 2025
e45c432
save draft with flow draft
Guilhem-lm Apr 29, 2025
e5ce851
add path in draft label when available
Guilhem-lm Apr 30, 2025
8bb7809
remove flowcard title
Guilhem-lm Apr 30, 2025
7c4c838
use trigger label for trigger badge dropdown
Guilhem-lm Apr 30, 2025
895fc05
break from table to sidebar at 1000px
Guilhem-lm Apr 30, 2025
3615ae0
remove triggers badge allways show sidebar behavior
Guilhem-lm Apr 30, 2025
003c3cc
fix multiple primary addition
Guilhem-lm Apr 30, 2025
b509a4f
improve primary schedule deploy logic
Guilhem-lm Apr 30, 2025
9db5bbc
remove debug logs
Guilhem-lm Apr 30, 2025
a87e397
gather imports
Guilhem-lm Apr 30, 2025
d9c3811
add path for draft primary schedule
Guilhem-lm Apr 30, 2025
91bb076
handle redirection
Guilhem-lm Apr 30, 2025
efdf0ea
Add confirmation modal to deploy triggers
Guilhem-lm Apr 30, 2025
9680b55
remove debug log
Guilhem-lm Apr 30, 2025
52ce503
Save draft route trigger on deploy
Guilhem-lm Apr 30, 2025
52ee9ec
Allow draft for deployed triggers
Guilhem-lm Apr 30, 2025
4d6e65f
add component trigger editor toolbar
Guilhem-lm Apr 30, 2025
7545e1d
improve update trigger utility function
Guilhem-lm Apr 30, 2025
902c348
Add reset button for deployed draft triggers
Guilhem-lm Apr 30, 2025
0424dc1
allow draft trigger for kafka triggers
Guilhem-lm Apr 30, 2025
c52db29
allow draft trigger for websocket triggers
Guilhem-lm Apr 30, 2025
22e8908
allow draft trigger for postgres triggers
Guilhem-lm Apr 30, 2025
6423c0c
Add toggle to trigger toolbar
Guilhem-lm May 4, 2025
338a939
allow draft for nats triggers
Guilhem-lm May 4, 2025
fe3049a
allow draft for mqtt triggers
Guilhem-lm May 4, 2025
d7fa3a6
allow draft sqs triggers
Guilhem-lm May 4, 2025
3cc9bd9
allow draft for gcp triggers
Guilhem-lm May 4, 2025
2fc6cc6
revert changes on the schedule editor
Guilhem-lm May 4, 2025
0205a76
update all triggers to use the same toolbar
Guilhem-lm May 4, 2025
8fd9a74
remove debug logs
Guilhem-lm May 4, 2025
a194428
remove PrimarySchedule Panel and merge primary schedule logic with al…
Guilhem-lm May 4, 2025
b419b91
load schema from draft when editing a draft schedule
Guilhem-lm May 4, 2025
1f099d3
prevent overflow in trigger table
Guilhem-lm May 4, 2025
877b18e
fix path saving for draft schedule
Guilhem-lm May 4, 2025
02f15ee
fix trigger badge dropdown display
Guilhem-lm May 4, 2025
f956323
get draft status from trigger
Guilhem-lm May 4, 2025
9de5bab
remove unused event
Guilhem-lm May 4, 2025
223465b
nit
Guilhem-lm May 5, 2025
fee725f
Add deploy badge to trigger
Guilhem-lm May 5, 2025
b0e3a2f
replace checkbox with toggle for the modal
Guilhem-lm May 5, 2025
740b721
fix selection of triggers with draft
Guilhem-lm May 5, 2025
9cce372
fix nit
Guilhem-lm May 5, 2025
e57efa0
fix nit
Guilhem-lm May 5, 2025
0ab6775
add missing config for loading schedule
Guilhem-lm May 5, 2025
bd4c62b
save schedule from config
Guilhem-lm May 5, 2025
fc4d63c
save http route from cfg
Guilhem-lm May 5, 2025
6e384fd
save websocket trigger from cfg
Guilhem-lm May 5, 2025
3a25fe5
save postgres trigger from cfg
Guilhem-lm May 5, 2025
ac3bf29
save kafka trigger from cfg
Guilhem-lm May 5, 2025
39d6feb
save sqs trigger from cfg
Guilhem-lm May 5, 2025
46156cc
save nats trigger from cfg
Guilhem-lm May 5, 2025
c2d3e34
save mqtt triggers from cfg
Guilhem-lm May 5, 2025
7ad4a46
save gcp trigger from config
Guilhem-lm May 5, 2025
ad2cd0f
nit
Guilhem-lm May 5, 2025
5018591
fix path update when editing a trigger
Guilhem-lm May 5, 2025
8297cbe
remove unused saveCb
Guilhem-lm May 5, 2025
9f0af20
fix trigger node navigation
Guilhem-lm May 5, 2025
dbc61ee
remove debug log
Guilhem-lm May 5, 2025
e02fd16
add min size for trigger editor capture panel
Guilhem-lm May 5, 2025
08a9a6a
Integrate new triggers Editor to script builder
Guilhem-lm May 5, 2025
daed257
remove previous triggersEdior page
Guilhem-lm May 5, 2025
bf3e49b
Remove former triggers Editor
Guilhem-lm May 5, 2025
e69c6b0
Migrate detail page to new triggers editor UI
Guilhem-lm May 6, 2025
188ce32
Remove unused dev TriggersBadge
Guilhem-lm May 6, 2025
b0cda11
migrate triggers to V2
Guilhem-lm May 6, 2025
f1185fc
Migrate capture components to V2
Guilhem-lm May 6, 2025
6899bfa
improve triggers badge UI
Guilhem-lm May 6, 2025
a0a72cc
fix trigger panel with scheduled poll
Guilhem-lm May 6, 2025
5c8e4eb
fix auto select all draft on deploy
Guilhem-lm May 6, 2025
6f2def2
simplify permission check
Guilhem-lm May 6, 2025
ee1f269
Add custom label to every trigger editor
Guilhem-lm May 6, 2025
9d40b9f
fix draft not deleting when saving triggers and add option to deploy now
Guilhem-lm May 6, 2025
58e4fe1
remove unused utility function
Guilhem-lm May 6, 2025
8bb915f
fix triggers loading from draft
Guilhem-lm May 6, 2025
402afd5
make advanced route section collapsible
Guilhem-lm May 7, 2025
3023b43
handle subflow triggers display
Guilhem-lm May 7, 2025
422e9fb
center triggers badge
Guilhem-lm May 7, 2025
b3b2d1b
fix panel redirection when adding a new triggers from node
Guilhem-lm May 7, 2025
365f23e
Remove unnecessary alerts
Guilhem-lm May 7, 2025
e03c836
Fix proxy issue in schedule editor inner
Guilhem-lm May 7, 2025
46e7298
Remove unused schedule pages
Guilhem-lm May 7, 2025
1c7d887
nit
Guilhem-lm May 7, 2025
b49aa70
nit cli panel
Guilhem-lm May 7, 2025
60d5c65
Migrate selectedTrigger store to V2
Guilhem-lm May 7, 2025
ceabac1
handle extra header button for trigger editor panel
Guilhem-lm May 7, 2025
6008a68
prevent reload on toggle schedule enable
Guilhem-lm May 7, 2025
e164262
remove unused utility function
Guilhem-lm May 7, 2025
dc5b985
remove primaryScheduleStore
Guilhem-lm May 7, 2025
cf58e71
handle triggerCount with drafts
Guilhem-lm May 7, 2025
f0406d0
fix editing in Schedule Poll Mode
Guilhem-lm May 7, 2025
4ab3521
Remove triggers default value context store
Guilhem-lm May 7, 2025
dd537ac
fix triggers label max width
Guilhem-lm May 7, 2025
e309c92
Remove dbg logs
Guilhem-lm May 7, 2025
bae8094
improve no trigger selected message
Guilhem-lm May 7, 2025
e636a7f
nit
Guilhem-lm May 7, 2025
e1ef39e
Do not show enable toggle for http triggers
Guilhem-lm May 7, 2025
021580e
Adapt ui to dark mode
Guilhem-lm May 7, 2025
5f861f2
nit
Guilhem-lm May 7, 2025
4b7d6c3
remove captureOn context value
Guilhem-lm May 7, 2025
11dc509
improve dark mode
Guilhem-lm May 7, 2025
0a2ec60
Merge remote-tracking branch 'origin/main' into glm/capture-refactor-ui
Guilhem-lm May 7, 2025
aabb473
fix nit
Guilhem-lm May 7, 2025
e4a4331
fix merge issue
Guilhem-lm May 7, 2025
8175f2b
nit
Guilhem-lm May 7, 2025
a966a67
Merge remote-tracking branch 'origin/main' into glm/capture-refactor-ui
Guilhem-lm May 8, 2025
ceddda3
nit
Guilhem-lm May 8, 2025
9a83563
fix schedule permission initialisation
Guilhem-lm May 8, 2025
4d67ddc
nit
Guilhem-lm May 8, 2025
5f15fd9
Disable deploy now if needed
Guilhem-lm May 8, 2025
e102d08
Improve utilitu function for handling with triggers
Guilhem-lm May 8, 2025
ba3f67d
improve trigger badge look
Guilhem-lm May 8, 2025
1f16193
fix kafka
Guilhem-lm May 8, 2025
3349eb5
nit
Guilhem-lm May 8, 2025
6590f3b
fix schedule display
Guilhem-lm May 8, 2025
1237645
fix toggling edit mode
Guilhem-lm May 9, 2025
2815c67
fix edit/cancel edit
Guilhem-lm May 9, 2025
4334096
nit
Guilhem-lm May 11, 2025
4c94fba
prevent capture config update in editor
Guilhem-lm May 12, 2025
c935c1b
migrate webhook panel to svelte 5
Guilhem-lm May 12, 2025
fbdf9a6
fix postgres trigger creation
Guilhem-lm May 12, 2025
4551ff8
fix bind issue in nats triggers
Guilhem-lm May 12, 2025
c00f11a
fix modal triggers message flow/script
Guilhem-lm May 12, 2025
1fc96df
fix apply args for script
Guilhem-lm May 12, 2025
2eed755
fix gcp triggers update when creating
Guilhem-lm May 12, 2025
bac5b84
fix gcp capture
Guilhem-lm May 12, 2025
6418f21
nits
dieriba May 12, 2025
b13e738
Merge branch 'glm/capture-refactor-ui' of github.com:windmill-labs/wi…
dieriba May 12, 2025
6b245ed
add loading state for deploying all triggers
Guilhem-lm May 12, 2025
1a00667
remove default mqtt
dieriba May 12, 2025
bb25b39
Merge branch 'glm/capture-refactor-ui' of github.com:windmill-labs/wi…
dieriba May 12, 2025
00a1f09
update base_endpoint for gcp
Guilhem-lm May 12, 2025
84aa9a5
nit
Guilhem-lm May 12, 2025
616c538
fix
dieriba May 12, 2025
38dd293
fix
dieriba May 12, 2025
1c9eda5
remove base endpoint
dieriba May 12, 2025
a4100c4
add catch in case of error while creating a trigger
Guilhem-lm May 12, 2025
4b9e65e
Add animation is capture panels
Guilhem-lm May 12, 2025
1a6ef36
show preprocessor extra when there is a preprocessor
Guilhem-lm May 12, 2025
8fc5d14
Add loading state for captures
Guilhem-lm May 12, 2025
c9a7fdb
add missing fields for capture
Guilhem-lm May 12, 2025
03c1613
migrate URL to svelte 5
Guilhem-lm May 12, 2025
e2c1324
show icon by default in confirmation modal
Guilhem-lm May 12, 2025
3c7611b
do not show draft triggers in detail badge list
Guilhem-lm May 12, 2025
0d5513e
Merge remote-tracking branch 'origin/main' into glm/capture-refactor-ui
Guilhem-lm May 12, 2025
c842b2a
migrate to new captures
Guilhem-lm May 12, 2025
0acfe0e
revert unwanted change
Guilhem-lm May 12, 2025
6e6dd0a
migrate to preprocesor v2
Guilhem-lm May 12, 2025
79ea72d
nit
Guilhem-lm May 13, 2025
f31dd3c
fix email capture
Guilhem-lm May 13, 2025
4f38a7b
nits and fix
dieriba May 13, 2025
c3de144
nits
dieriba May 13, 2025
923ae7b
Merge branch 'main' into glm/capture-refactor-ui
dieriba May 13, 2025
d8fb849
update repo ref
dieriba May 13, 2025
25742d9
Feat: auto save draft instad of save button
Guilhem-lm May 15, 2025
cd2ed1f
use triggerIndex as selection
Guilhem-lm May 18, 2025
83a525a
Add modified tag to triggers
Guilhem-lm May 18, 2025
78cf86c
Update trigger modal
Guilhem-lm May 18, 2025
1d58671
fix trigger node select
Guilhem-lm May 18, 2025
3d69bf7
fix schedule page
Guilhem-lm May 18, 2025
c4d36b3
migrate TriggersEditor to svelte 5
Guilhem-lm May 18, 2025
f8109b4
remove unused props
Guilhem-lm May 18, 2025
4f17452
fix schedule editor init
Guilhem-lm May 19, 2025
ea601f9
fix store reactivity issue
Guilhem-lm May 19, 2025
9805b28
use class instead of store for triggers context
Guilhem-lm May 19, 2025
a17dae3
nit
Guilhem-lm May 19, 2025
12a4a2c
nit
Guilhem-lm May 19, 2025
7b8b5cc
fix schedule init
Guilhem-lm May 19, 2025
34036db
Add postgres error message
Guilhem-lm May 19, 2025
15dd758
nit
Guilhem-lm May 19, 2025
ff27a9a
Merge remote-tracking branch 'origin/main' into glm/capture-refactor-ui
Guilhem-lm May 19, 2025
e11015a
fix deploy new script
Guilhem-lm May 19, 2025
8b19ed0
load schema in shedule editor
Guilhem-lm May 19, 2025
4d8d092
improve transitions
Guilhem-lm May 19, 2025
799424b
Improve capture indication
Guilhem-lm May 19, 2025
1a97d23
Merge remote-tracking branch 'origin/main' into glm/capture-refactor-ui
Guilhem-lm May 19, 2025
0541f24
revert unwanted changes
Guilhem-lm May 19, 2025
515d391
improve update
Guilhem-lm May 19, 2025
03f7071
nit
Guilhem-lm May 19, 2025
7043c53
migrate captures section to svelte 5
Guilhem-lm May 19, 2025
38a0409
Merge remote-tracking branch 'origin/main' into glm/capture-refactor-ui
Guilhem-lm May 19, 2025
2d793b7
only show trash on hover triggers row
Guilhem-lm May 19, 2025
5165458
Add token count
Guilhem-lm May 19, 2025
e20f7cc
improve trigger display
Guilhem-lm May 19, 2025
fd3e25f
Add relevent naming for triggers
Guilhem-lm May 20, 2025
c9ba519
Use wrapper div insted of width binding in flow card
Guilhem-lm May 20, 2025
8cd093e
add trigger sorting
Guilhem-lm May 20, 2025
a9aa662
nit
Guilhem-lm May 20, 2025
1894a3d
Merge branch 'main' into glm/capture-refactor-ui
rubenfiszel May 20, 2025
1d20ba8
handle reload from URL for draft triggers
Guilhem-lm May 20, 2025
b620033
dirty script and flow draft with draft triggers
Guilhem-lm May 20, 2025
b38a33d
handle cloud hosted triggers
Guilhem-lm May 21, 2025
6f00588
nit
Guilhem-lm May 21, 2025
20dbb5d
nit
Guilhem-lm May 21, 2025
d2c470e
fix nats reactivity
Guilhem-lm May 21, 2025
5d92d6f
remove debug log
Guilhem-lm May 21, 2025
be4c666
handle deployed draft triggers in the flow editor
Guilhem-lm May 21, 2025
c639821
Add warning for event stream capture
Guilhem-lm May 21, 2025
324eb75
Merge remote-tracking branch 'origin/main' into glm/capture-refactor-ui
Guilhem-lm May 21, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions backend/windmill-api/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
* Please see the included NOTICE for copyright information and
* LICENSE-AGPL for a copy of the license.
*/

use std::fmt::Display;

use axum::{body::Body, response::Response};
use regex::Regex;
use serde::{Deserialize, Deserializer};
Expand Down Expand Up @@ -35,6 +38,16 @@ pub enum RunnableKind {
Flow,
}

impl Display for RunnableKind {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
let runnable_kind = match self {
RunnableKind::Script => "script",
RunnableKind::Flow => "flow"
};
write!(f, "{}", runnable_kind)
}
}

pub async fn require_super_admin(db: &DB, email: &str) -> error::Result<()> {
let is_admin = is_super_admin_email(db, email).await?;

Expand Down
4 changes: 3 additions & 1 deletion frontend/src/lib/components/Description.svelte
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
<script lang="ts">
import { twMerge } from 'tailwind-merge'

export let link: string | undefined = undefined
</script>

<div class="text-xs text-tertiary font-normal">
<div class={twMerge('text-xs text-tertiary font-normal opacity-80', $$props.class)}>
<slot />
{#if link}
<a href={link} target="_blank">Learn more</a>
Expand Down
14 changes: 4 additions & 10 deletions frontend/src/lib/components/Dev.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,11 @@
parseTypescriptDeps
} from '$lib/relative_imports'
import Tooltip from './Tooltip.svelte'
import type { ScheduleTrigger, TriggerContext } from './triggers'
import type { TriggerContext } from './triggers'
import { workspaceAIClients } from './copilot/lib'
import type { FlowPropPickerConfig, PropPickerContext } from './prop_picker'
import type { PickableProperties } from './flows/previousResults'
import { Triggers } from './triggers/triggers.svelte'
$: token = $page.url.searchParams.get('wm_token') ?? undefined
$: workspace = $page.url.searchParams.get('workspace') ?? undefined
$: themeDarkRaw = $page.url.searchParams.get('activeColorTheme')
Expand Down Expand Up @@ -493,20 +494,13 @@

const testStepStore = writable<Record<string, any>>({})
const selectedIdStore = writable('settings-metadata')
const selectedTriggerStore = writable<
'webhooks' | 'emails' | 'schedules' | 'cli' | 'routes' | 'websockets' | 'scheduledPoll'
>('webhooks')

const primaryScheduleStore = writable<ScheduleTrigger | undefined | false>(undefined)
const triggersCount = writable<TriggersCount | undefined>(undefined)
setContext<TriggerContext>('TriggerContext', {
primarySchedule: primaryScheduleStore,
selectedTrigger: selectedTriggerStore,
triggersCount: triggersCount,
simplifiedPoll: writable(false),
defaultValues: writable(undefined),
captureOn: writable(undefined),
showCaptureHint: writable(undefined)
showCaptureHint: writable(undefined),
triggersState: new Triggers()
})
setContext<FlowEditorContext>('FlowEditorContext', {
selectedId: selectedIdStore,
Expand Down
10 changes: 1 addition & 9 deletions frontend/src/lib/components/DisplayResult.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import PdfViewer from './display/PdfViewer.svelte'
import type { DisplayResultUi } from './custom_ui'
import { getContext, hasContext, createEventDispatcher, onDestroy } from 'svelte'
import { toJsonStr } from '$lib/utils'
import { createDispatcherIfMounted } from '$lib/createDispatcherIfMounted'

export let result: any
Expand Down Expand Up @@ -269,15 +270,6 @@
let jsonViewer: Drawer
let s3FileViewer: S3FilePicker

function toJsonStr(result: any) {
try {
// console.log(result)
return JSON.stringify(result ?? null, null, 4) ?? 'null'
} catch (e) {
return 'error stringifying object: ' + e.toString()
}
}

function checkIfHasBigInt(result: any) {
if (typeof result === 'number' && Number.isInteger(result) && !Number.isSafeInteger(result)) {
return true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
}
</script>

<div class={twMerge('flex flex-row gap-2.5 z-10 text-tertiary -mt-1')}>
<div class={twMerge('flex flex-row gap-2.5 z-10 text-tertiary -mt-1 items-center')}>
{#if customUi?.disableDownload !== true}
<a
download="{filename ?? 'result'}.json"
Expand Down
19 changes: 13 additions & 6 deletions frontend/src/lib/components/DropdownV2.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
export let fixedHeight = true
export let hidePopup = false
export let open = false
export let customWidth: number | undefined = undefined
export let customMenu = false

const {
elements: { menu, item, trigger },
Expand Down Expand Up @@ -106,11 +108,16 @@
</button>

{#if open && !hidePopup}
<div use:melt={$menu} data-menu class="z-[6000]">
<div
class="bg-surface border w-56 origin-top-right rounded-md shadow-md focus:outline-none overflow-y-auto py-1 max-h-[50vh]"
>
<DropdownV2Inner items={computeItems} meltItem={item} />
</div>
<div use:melt={$menu} data-menu class="z-[6000] transition-all duration-100">
{#if customMenu}
<slot name="menu" />
{:else}
<div
class="bg-surface border w-56 origin-top-right rounded-md shadow-md focus:outline-none overflow-y-auto py-1 max-h-[50vh]"
style={customWidth ? `width: ${customWidth}px` : ''}
>
<DropdownV2Inner items={computeItems} meltItem={item} />
</div>
{/if}
</div>
{/if}
18 changes: 13 additions & 5 deletions frontend/src/lib/components/DropdownV2Inner.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,15 @@
import { twMerge } from 'tailwind-merge'
import type { MenubarMenuElements } from '@melt-ui/svelte'
import type { Item } from '$lib/utils'
export let items: Item[] | (() => Item[]) | (() => Promise<Item[]>) = []
export let meltItem: MenubarMenuElements['item']

let computedItems: Item[] | undefined = undefined
interface Props {
items?: Item[] | (() => Item[]) | (() => Promise<Item[]>)
meltItem: MenubarMenuElements['item']
}

let { items = [], meltItem }: Props = $props()

let computedItems: Item[] | undefined = $state(undefined)
async function computeItems() {
if (typeof items === 'function') {
computedItems = ((await items()) ?? []).filter((item) => !item.hide)
Expand Down Expand Up @@ -38,9 +43,12 @@
item={meltItem}
>
{#if item.icon}
<svelte:component this={item.icon} size={14} color={item.iconColor} />
<item.icon size={14} color={item.iconColor} />
{/if}
{item.displayName}
<p title={item.displayName} class="truncate grow min-w-0 whitespace-nowrap text-left">
{item.displayName}
</p>
{@render item.extra?.()}
</MenuItem>
{/each}
</div>
Expand Down
Loading
Loading