Fix for #6501 - don't fail to publish app when cron expression is empty in any automation, just don't publish that automation. Also adding an error to automation to make it clear an expression is required.

This commit is contained in:
mike12345567 2022-07-15 14:15:16 +01:00
parent cda958e0b7
commit c149139253
2 changed files with 11 additions and 4 deletions

View File

@ -1,5 +1,5 @@
<script>
import { Button, Select, Input } from "@budibase/bbui"
import { Button, Select, Input, Label } from "@budibase/bbui"
import { createEventDispatcher } from "svelte"
const dispatch = createEventDispatcher()
@ -9,6 +9,7 @@
dispatch("change", e.detail)
}
let touched = false
let presets = false
const CRON_EXPRESSIONS = [
@ -36,8 +37,10 @@
</script>
<div class="block-field">
<Input on:change={onChange} {value} />
<Input on:change={onChange} {value} on:blur={() => (touched = true)} />
{#if touched && !value}
<Label><div class="error">Please specify a CRON expression</div></Label>
{/if}
<div class="presets">
<Button on:click={() => (presets = !presets)}
>{presets ? "Hide" : "Show"} Presets</Button
@ -62,4 +65,8 @@
.block-field {
padding-top: var(--spacing-s);
}
.error {
padding-top: var(--spacing-xs);
color: var(--spectrum-global-color-red-500);
}
</style>

View File

@ -97,7 +97,7 @@ export async function enableCronTrigger(appId: any, automation: any) {
)
}
// need to create cron job
if (isCronTrigger(automation)) {
if (isCronTrigger(automation) && trigger?.inputs.cron) {
// make a job id rather than letting Bull decide, makes it easier to handle on way out
const jobId = `${appId}_cron_${newid()}`
const job: any = await queue.add(