mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-09-12 08:05:44 +00:00
118 lines
2.7 KiB
Svelte
118 lines
2.7 KiB
Svelte
<script lang="ts">
|
|
import { Button } from '$lib/components/common'
|
|
import { Webhook, Route, Unplug, Mail, Plus, Database } from 'lucide-svelte'
|
|
import KafkaIcon from '$lib/components/icons/KafkaIcon.svelte'
|
|
import { enterpriseLicense } from '$lib/stores'
|
|
import { type CaptureTriggerKind } from '$lib/gen'
|
|
import { createEventDispatcher } from 'svelte'
|
|
import { captureTriggerKindToTriggerKind } from '../triggers'
|
|
import CaptureIcon from './CaptureIcon.svelte'
|
|
import NatsIcon from '../icons/NatsIcon.svelte'
|
|
import AwsIcon from '../icons/AwsIcon.svelte'
|
|
import DropdownV2 from '$lib/components/DropdownV2.svelte'
|
|
import MqttIcon from '../icons/MqttIcon.svelte'
|
|
import GoogleCloudIcon from '../icons/GoogleCloudIcon.svelte'
|
|
|
|
interface Props {
|
|
small?: boolean
|
|
}
|
|
|
|
let { small = false }: Props = $props()
|
|
|
|
const dispatch = createEventDispatcher()
|
|
|
|
function handleClick(kind: CaptureTriggerKind) {
|
|
dispatch('openTriggers', {
|
|
kind: captureTriggerKindToTriggerKind(kind),
|
|
config: {}
|
|
})
|
|
}
|
|
|
|
let items = $derived([
|
|
{
|
|
icon: Webhook,
|
|
displayName: 'Webhook',
|
|
action: () => handleClick('webhook')
|
|
},
|
|
{
|
|
icon: Route,
|
|
displayName: 'HTTP',
|
|
action: () => handleClick('http')
|
|
},
|
|
{
|
|
icon: Unplug,
|
|
displayName: 'Websocket',
|
|
action: () => handleClick('websocket')
|
|
},
|
|
{
|
|
icon: AwsIcon,
|
|
displayName: 'SQS',
|
|
action: () => handleClick('sqs'),
|
|
disabled: !$enterpriseLicense
|
|
},
|
|
{
|
|
icon: GoogleCloudIcon,
|
|
displayName: 'GCP Pub/Sub',
|
|
action: () => handleClick('gcp'),
|
|
disabled: !$enterpriseLicense
|
|
},
|
|
{
|
|
icon: MqttIcon,
|
|
displayName: 'MQTT',
|
|
action: () => handleClick('mqtt')
|
|
},
|
|
{
|
|
icon: Database,
|
|
displayName: 'Postgres',
|
|
action: () => handleClick('postgres')
|
|
},
|
|
{
|
|
icon: Mail,
|
|
displayName: 'Email',
|
|
action: () => handleClick('email')
|
|
},
|
|
{
|
|
icon: KafkaIcon,
|
|
displayName: 'Kafka',
|
|
action: () => handleClick('kafka'),
|
|
disabled: !$enterpriseLicense
|
|
},
|
|
{
|
|
icon: NatsIcon,
|
|
displayName: 'Nats',
|
|
action: () => handleClick('nats'),
|
|
disabled: !$enterpriseLicense
|
|
}
|
|
])
|
|
</script>
|
|
|
|
<DropdownV2 {items} placement="bottom-start" fixedHeight={false}>
|
|
{#snippet buttonReplacement()}
|
|
{#if small}
|
|
<Button
|
|
color="light"
|
|
size="xs"
|
|
variant="border"
|
|
wrapperClasses="h-full"
|
|
nonCaptureEvent
|
|
title="Test trigger"
|
|
>
|
|
<div class="flex flex-row items-center gap-1">
|
|
<CaptureIcon variant="redDot" />
|
|
<Plus size={10} class="text-red" />
|
|
</div>
|
|
</Button>
|
|
{:else}
|
|
<Button
|
|
color="dark"
|
|
btnClasses="!rounded-l-none"
|
|
wrapperClasses="h-full"
|
|
nonCaptureEvent
|
|
title="Test trigger"
|
|
>
|
|
<CaptureIcon variant="redDot" />
|
|
</Button>
|
|
{/if}
|
|
{/snippet}
|
|
</DropdownV2>
|