Merge pull request #3105 from Budibase/feature/smtp-automation-check
Disable action if SMTP has not been setup
This commit is contained in:
commit
6e2d93f151
|
@ -1,11 +1,26 @@
|
|||
<script>
|
||||
import { ModalContent, Layout, Detail, Body, Icon } from "@budibase/bbui"
|
||||
import {
|
||||
ModalContent,
|
||||
Layout,
|
||||
Detail,
|
||||
Body,
|
||||
Icon,
|
||||
Tooltip,
|
||||
} from "@budibase/bbui"
|
||||
import { automationStore } from "builderStore"
|
||||
import { admin } from "stores/portal"
|
||||
import { externalActions } from "./ExternalActions"
|
||||
|
||||
export let blockIdx
|
||||
export let blockComplete
|
||||
|
||||
const disabled = {
|
||||
SEND_EMAIL_SMTP: {
|
||||
disabled: !$admin.checklist.smtp.checked,
|
||||
message: "Please configure SMTP",
|
||||
},
|
||||
}
|
||||
|
||||
let selectedAction
|
||||
let actionVal
|
||||
let actions = Object.entries($automationStore.blockDefinitions.ACTION)
|
||||
|
@ -55,6 +70,7 @@
|
|||
}}
|
||||
>
|
||||
<Body size="XS">Select an app or event.</Body>
|
||||
|
||||
<Layout noPadding>
|
||||
<Body size="S">Apps</Body>
|
||||
|
||||
|
@ -85,6 +101,23 @@
|
|||
|
||||
<div class="item-list">
|
||||
{#each Object.entries(internal) as [idx, action]}
|
||||
{#if disabled[idx] && disabled[idx].disabled}
|
||||
<Tooltip text={disabled[idx].message} direction="bottom">
|
||||
<div
|
||||
class="item"
|
||||
class:selected={selectedAction === action.name}
|
||||
class:disabled={true}
|
||||
on:click={() => selectAction(action)}
|
||||
>
|
||||
<div class="item-body">
|
||||
<Icon name={action.icon} />
|
||||
<span class="icon-spacing">
|
||||
<Body size="XS">{action.name}</Body></span
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
</Tooltip>
|
||||
{:else}
|
||||
<div
|
||||
class="item"
|
||||
class:selected={selectedAction === action.name}
|
||||
|
@ -97,12 +130,17 @@
|
|||
>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
{/each}
|
||||
</div>
|
||||
</Layout>
|
||||
</ModalContent>
|
||||
|
||||
<style>
|
||||
.disabled {
|
||||
opacity: 0.3;
|
||||
pointer-events: none;
|
||||
}
|
||||
.icon-spacing {
|
||||
margin-left: var(--spacing-m);
|
||||
}
|
||||
|
@ -118,7 +156,6 @@
|
|||
|
||||
.item {
|
||||
cursor: pointer;
|
||||
display: grid;
|
||||
grid-gap: var(--spectrum-alias-grid-margin-xsmall);
|
||||
padding: var(--spectrum-alias-item-padding-s);
|
||||
background: var(--spectrum-alias-background-color-secondary);
|
||||
|
|
Loading…
Reference in New Issue