move constant to shared-core

This commit is contained in:
Peter Clement 2024-02-13 15:14:03 +00:00
parent 46903e36ef
commit 2660149fea
3 changed files with 6 additions and 7 deletions

View File

@ -2,15 +2,13 @@
import { Button, Select, Input, Label } from "@budibase/bbui" import { Button, Select, Input, Label } from "@budibase/bbui"
import { onMount, createEventDispatcher } from "svelte" import { onMount, createEventDispatcher } from "svelte"
import { flags } from "stores/backend" import { flags } from "stores/backend"
import { helpers } from "@budibase/shared-core" import { helpers, REBOOT_CRON } from "@budibase/shared-core"
const dispatch = createEventDispatcher() const dispatch = createEventDispatcher()
export let value export let value
let error let error
const reboot = "@reboot"
$: { $: {
const exists = CRON_EXPRESSIONS.some(cron => cron.value === value) const exists = CRON_EXPRESSIONS.some(cron => cron.value === value)
const customIndex = CRON_EXPRESSIONS.findIndex( const customIndex = CRON_EXPRESSIONS.findIndex(
@ -25,7 +23,7 @@
} }
const onChange = e => { const onChange = e => {
if (value !== reboot) { if (value !== REBOOT_CRON) {
error = helpers.cron.validate(e.detail).err error = helpers.cron.validate(e.detail).err
} }
if (e.detail === value || error) { if (e.detail === value || error) {
@ -62,7 +60,7 @@
if (!$flags.cloud) { if (!$flags.cloud) {
CRON_EXPRESSIONS.push({ CRON_EXPRESSIONS.push({
label: "Every Budibase Reboot", label: "Every Budibase Reboot",
value: reboot, value: REBOOT_CRON,
}) })
} }
}) })

View File

@ -16,10 +16,9 @@ import {
} from "@budibase/types" } from "@budibase/types"
import sdk from "../sdk" import sdk from "../sdk"
import { automationsEnabled } from "../features" import { automationsEnabled } from "../features"
import { helpers } from "@budibase/shared-core" import { helpers, REBOOT_CRON } from "@budibase/shared-core"
import tracer from "dd-trace" import tracer from "dd-trace"
const REBOOT_CRON = "@reboot"
const WH_STEP_ID = definitions.WEBHOOK.stepId const WH_STEP_ID = definitions.WEBHOOK.stepId
const CRON_STEP_ID = definitions.CRON.stepId const CRON_STEP_ID = definitions.CRON.stepId
let Runner: Thread let Runner: Thread

View File

@ -99,6 +99,8 @@ export const SocketSessionTTL = 60
export const ValidQueryNameRegex = /^[^()]*$/ export const ValidQueryNameRegex = /^[^()]*$/
export const ValidColumnNameRegex = /^[_a-zA-Z0-9\s]*$/g export const ValidColumnNameRegex = /^[_a-zA-Z0-9\s]*$/g
export const REBOOT_CRON = "@reboot"
export const InvalidFileExtensions = [ export const InvalidFileExtensions = [
"7z", "7z",
"action", "action",