1
0
Fork 0
mirror of synced 2024-06-14 16:35:02 +12:00
budibase/packages/builder/src/components/deploy/CreateWebhookDeploymentModal.svelte
2022-03-23 14:47:27 +01:00

82 lines
1.7 KiB
Svelte

<script>
import { automationStore } from "builderStore"
import { ModalContent } from "@budibase/bbui"
import { onMount } from "svelte"
import WebhookDisplay from "../automation/Shared/WebhookDisplay.svelte"
let webhookUrls = []
$: automations = $automationStore.automations
onMount(() => {
webhookUrls = automations.map(automation => {
const trigger = automation.definition.trigger
if (trigger?.stepId === "WEBHOOK" && trigger.inputs) {
return {
type: "Automation",
name: automation.name,
url: trigger.inputs.triggerUrl,
}
}
})
})
</script>
<ModalContent
title="Webhook Endpoints"
confirmText="OK"
showCancelButton={false}
>
<p>See below the list of deployed webhook URLs.</p>
{#each webhookUrls as webhookUrl}
<div>
<h5>{webhookUrl.type} - {webhookUrl.name}</h5>
<WebhookDisplay value={webhookUrl.url} production={true} />
</div>
{/each}
{#if webhookUrls.length === 0}
<h5>No webhooks found.</h5>
{/if}
<a
slot="footer"
target="_blank"
href="https://docs.budibase.com/docs/trigger"
>
<i class="ri-information-line" />
<span>Learn about webhooks</span>
</a>
</ModalContent>
<style>
a {
color: var(--ink);
font-size: 14px;
vertical-align: middle;
display: flex;
align-items: center;
text-decoration: none;
}
a span {
text-decoration: underline;
}
i {
font-size: 20px;
margin-right: var(--spacing-m);
text-decoration: none;
}
p {
margin-top: 0;
margin-bottom: 0;
padding-top: 0;
text-align: justify;
}
h5 {
margin-top: 0;
padding-top: 0;
}
</style>