Files
windmill/frontend/src/lib/toast.ts
T
Diego Imbertandclaude[bot] 9b28c85469 feat: Unified filters and new runs page (#8027)
* RunsPage redesign v0

* nit

* Remove manualdatepicker

* remove shadow

* ui nits

* nit scrollbar bg

* prettier cards

* nit

* Remove code

* command/meta multi select

* Shift select

* RightClickPopover

* nit

* Ctrl A

* nit card

* DropdownMenu

* nit

* count hint

* fix stuck keys

* opacity UX

* error toasts pickhubscript

* Improve UX

* fix undefined error

* keyboard nav

* nit batch rerun fixes

* nit fix scroll / height

* Batch reruns actions + nits

* nit

* Cancel selected jobs

* Cancel / re-run all filtered jobs

* Go to job / flow / script action

* nit

* add batch actions back

* nit

* nit

* bar on splitpane hover

* nit

* New Timeframe system

* reset btn

* nit fixes

* dead code

* nits

* typecheck

* naming clarity

* Update frontend/src/lib/components/RightClickPopover.svelte

Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com>

* unnecessary json stringify

* dedup 'the'

* Code deletion to prepare for changes

* filter types

* ui

* fix bug with maxTs

* stuck with melt

* GenericDropdown

* filters onclick

* iterate

* iter

* add all filters

* Descriptions

* focus position

* stash

* TaggedTextInput works much much better

* placeholder

* currentTag suggestion

* improve

* nit

* Keyboard nav

* buildRunsFilterSearchbarSchema

* nit naming

* assignObjInPlace

* Escaping + pretty dates

* nit empty

* fix cursor

* nit space

* Filter filtering

* escape pasted value

* nit

* escape spaces

* nit undefined

* add space at end if right arrow

* escape all spaces

* arrow skips escape chars

* escape \ too

* delete whole escaped characters

* double space to escape tag

* code refactor

* Ensure cursor visible

* fix keyboard nav

* safety

* filterSchemaRecToZodSchema

* URL Sync

* fix readonly

* fix typing

* start replacing old filter logic

* use new filter impl

* nit

* nit reactivity

* nit fix

* no more localStorage

* Add back status and kind toggles

* Nit fix

* style nit

* focus at end on click

* clearn btn + fixes

* fix broken date uri

* nit

* useSyncedTimeframe

* negative filter button

* negative filters helpers rust

* Negated filters backed

* nit

* highlight

* New useSearchParams

* Accept comma separated list

* nit allowNegative

* openapi update

* Fix trigger kind list/negation not working

* nit oipenpai

* Presets

* DebouncedTempValue

* remove presets from list when already applied

* UI nit improvements

* allowMultiple

* hint

* validateFilterInstance fn

* nit fix

* error highlights

* nit ux selecting negative list

* nit

* on clear btn

* SimpleEditor for JSON

* nit

* flop

* Pass presets as param

* nit delete

* preventCursorMoveOnNextSync

* responsive layout

* Escape \n

* Inline calendar input

* mm/dd or dd/mm depending on US or not

* onClickBehavior

* infiniteRange

* other nits

* Wiring with runs filter

* formatDateRange better

* inits on right page

* style

* min hour support

* Time input

* use our components

* Improve SKILL.md

* dd mm yyyy numeric input

* TimeframeSelect with new date picker

* fixes

* ensure date is in view when value changes externally

* fixes

* nit select all on focus

* select year + nits

* nit layout shift

* nit negative when starting with !

* nit

* SelectDropdown uses GenericDropdown now

* Fix blank select dropdown rendering bug

* icons

* Reset btn + shorter date range formatting

* overflow fix

* unnecessary absolute

* fix clear btn overlap

* Update routes for new filters (assets, schedule, resource, variables)

* update openapi

* Impl for other pages

* ui nits

* nit fixes

* Fix columns filter

* super nits

---------

Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com>
2026-02-23 17:53:09 +00:00

69 lines
1.5 KiB
TypeScript

import Toast from '$lib/components/Toast.svelte'
import { toast } from '@zerodevx/svelte-toast'
import type { ComponentProps } from 'svelte'
import type { Button } from './components/common'
import type { AlertType } from '$lib/components/common/alert/model'
export type ToastType = AlertType
export type ToastAction = {
label: string
callback: () => void
buttonType?: ComponentProps<typeof Button>['variant']
}
export function sendUserToast(
message: string,
_type: boolean | ToastType = 'success',
actions: ToastAction[] = [],
errorMessage: string | undefined = undefined,
duration: number = 5000
): {
destroy: () => void
} {
const type = typeof _type === 'boolean' ? (_type ? 'error' : 'success') : _type
const error = type === 'error'
if (globalThis.windmillToast) {
globalThis.windmillToast({
message,
error,
type,
actions,
errorMessage,
duration
})
return { destroy: () => {} }
}
const id = toast.push({
component: {
// https://github.com/zerodevx/svelte-toast/issues/115
// Svelte 5 changed its component type and svelte-toast is not up to date yet
// @ts-ignore
src: Toast,
props: {
message,
type,
actions,
errorMessage,
duration
},
sendIdTo: 'toastId'
},
dismissable: false,
initial: 0,
theme: {
'--toastPadding': '0',
'--toastMsgPadding': '0',
'--toastBackground': '#00000000',
'--toastBorderRadius': '0.4rem',
'--toastWidth': '34rem',
'--toastMinHeight': '1rem',
'--toastBoxShadow': 'none'
}
})
return {
destroy: () => toast.pop(id)
}
}