activations
This commit is contained in:
parent
a781239632
commit
8ceba79a12
|
@ -8,23 +8,23 @@
|
||||||
const CRON_EXPRESSIONS = [
|
const CRON_EXPRESSIONS = [
|
||||||
{
|
{
|
||||||
label: "Every Minute",
|
label: "Every Minute",
|
||||||
value: "* * * * *"
|
value: "* * * * *",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "Every Hour",
|
label: "Every Hour",
|
||||||
value: "0 * * * *"
|
value: "0 * * * *",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "Every Morning at 8AM",
|
label: "Every Morning at 8AM",
|
||||||
value: "0 8 * * *"
|
value: "0 8 * * *",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "Every Night at Midnight",
|
label: "Every Night at Midnight",
|
||||||
value: "0 0 * * *"
|
value: "0 0 * * *",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "Every Budibase Reboot",
|
label: "Every Budibase Reboot",
|
||||||
value: "@reboot"
|
value: "@reboot",
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
</script>
|
</script>
|
||||||
|
@ -33,18 +33,26 @@
|
||||||
<Input bind:value />
|
<Input bind:value />
|
||||||
|
|
||||||
<div class="presets">
|
<div class="presets">
|
||||||
<Button on:click={() => (presets = !presets)}>{presets ? "Hide" : "Show"} Presets</Button>
|
<Button on:click={() => (presets = !presets)}
|
||||||
|
>{presets ? "Hide" : "Show"} Presets</Button
|
||||||
|
>
|
||||||
{#if presets}
|
{#if presets}
|
||||||
<Select bind:value secondary extraThin label="Presets" options={CRON_EXPRESSIONS} />
|
<Select
|
||||||
|
bind:value
|
||||||
|
secondary
|
||||||
|
extraThin
|
||||||
|
label="Presets"
|
||||||
|
options={CRON_EXPRESSIONS}
|
||||||
|
/>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.presets {
|
.presets {
|
||||||
margin-top: var(--spacing-m);
|
margin-top: var(--spacing-m);
|
||||||
}
|
}
|
||||||
.block-field {
|
.block-field {
|
||||||
padding-top: var(--spacing-s);
|
padding-top: var(--spacing-s);
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -39,8 +39,6 @@ function cleanAutomationInputs(automation) {
|
||||||
* @param {string} appId The ID of the app in which we are checking for webhooks
|
* @param {string} appId The ID of the app in which we are checking for webhooks
|
||||||
* @param {object|undefined} oldAuto The old automation object if updating/deleting
|
* @param {object|undefined} oldAuto The old automation object if updating/deleting
|
||||||
* @param {object|undefined} newAuto The new automation object if creating/updating
|
* @param {object|undefined} newAuto The new automation object if creating/updating
|
||||||
* @returns {Promise<object|undefined>} After this is complete the new automation object may have been updated and should be
|
|
||||||
* written to DB (this does not write to DB as it would be wasteful to repeat).
|
|
||||||
*/
|
*/
|
||||||
async function checkForCronTriggers({ appId, oldAuto, newAuto }) {
|
async function checkForCronTriggers({ appId, oldAuto, newAuto }) {
|
||||||
const oldTrigger = oldAuto ? oldAuto.definition.trigger : null
|
const oldTrigger = oldAuto ? oldAuto.definition.trigger : null
|
||||||
|
@ -53,11 +51,13 @@ async function checkForCronTriggers({ appId, oldAuto, newAuto }) {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const isLive = auto => auto && auto.live
|
||||||
|
|
||||||
const cronTriggerRemoved =
|
const cronTriggerRemoved =
|
||||||
isCronTrigger(oldAuto) && !isCronTrigger(newAuto) && oldTrigger.cronJobId
|
isCronTrigger(oldAuto) && !isCronTrigger(newAuto) && oldTrigger.cronJobId
|
||||||
const cronTriggerDeactivated = !newAuto.live && oldAuto.live
|
const cronTriggerDeactivated = !isLive(newAuto) && isLive(oldAuto)
|
||||||
|
|
||||||
const cronTriggerActivated = newAuto.live && !oldAuto.live
|
const cronTriggerActivated = isLive(newAuto) && !isLive(oldAuto)
|
||||||
|
|
||||||
if (cronTriggerRemoved || cronTriggerDeactivated) {
|
if (cronTriggerRemoved || cronTriggerDeactivated) {
|
||||||
await triggers.automationQueue.removeRepeatableByKey(oldTrigger.cronJobId)
|
await triggers.automationQueue.removeRepeatableByKey(oldTrigger.cronJobId)
|
||||||
|
|
Loading…
Reference in New Issue