Deprecate old JS script block, mark new one as... well, new.
This commit is contained in:
parent
bf281fdff5
commit
96869c2b4d
|
@ -186,6 +186,12 @@
|
||||||
</div>
|
</div>
|
||||||
{:else if isDisabled}
|
{:else if isDisabled}
|
||||||
<Icon name="Help" tooltip={disabled()[idx].message} />
|
<Icon name="Help" tooltip={disabled()[idx].message} />
|
||||||
|
{:else if action.new}
|
||||||
|
<div class="tag-color">
|
||||||
|
<Tags>
|
||||||
|
<Tag>New</Tag>
|
||||||
|
</Tags>
|
||||||
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -15,6 +15,7 @@ import { EventEmitter } from "events"
|
||||||
|
|
||||||
export const definition: AutomationStepDefinition = {
|
export const definition: AutomationStepDefinition = {
|
||||||
name: "JS Scripting",
|
name: "JS Scripting",
|
||||||
|
deprecated: true,
|
||||||
tagline: "Execute JavaScript Code",
|
tagline: "Execute JavaScript Code",
|
||||||
icon: "Code",
|
icon: "Code",
|
||||||
description: "Run a piece of JavaScript code in your automation",
|
description: "Run a piece of JavaScript code in your automation",
|
||||||
|
|
|
@ -12,12 +12,13 @@ import {
|
||||||
import { processStringSync } from "@budibase/string-templates"
|
import { processStringSync } from "@budibase/string-templates"
|
||||||
|
|
||||||
export const definition: AutomationStepDefinition = {
|
export const definition: AutomationStepDefinition = {
|
||||||
name: "JS Scripting V2",
|
name: "JS Scripting",
|
||||||
tagline: "Execute JavaScript Code",
|
tagline: "Execute JavaScript Code",
|
||||||
icon: "Code",
|
icon: "Code",
|
||||||
description: "Run a piece of JavaScript code in your automation",
|
description: "Run a piece of JavaScript code in your automation",
|
||||||
type: AutomationStepType.ACTION,
|
type: AutomationStepType.ACTION,
|
||||||
internal: true,
|
internal: true,
|
||||||
|
new: true,
|
||||||
stepId: AutomationActionStepId.EXECUTE_SCRIPT_V2,
|
stepId: AutomationActionStepId.EXECUTE_SCRIPT_V2,
|
||||||
inputs: {},
|
inputs: {},
|
||||||
features: {
|
features: {
|
||||||
|
@ -57,7 +58,9 @@ export async function run({
|
||||||
inputs: ExecuteScriptStepInputs
|
inputs: ExecuteScriptStepInputs
|
||||||
context: Record<string, any>
|
context: Record<string, any>
|
||||||
}): Promise<ExecuteScriptStepOutputs> {
|
}): Promise<ExecuteScriptStepOutputs> {
|
||||||
if (inputs.code == null) {
|
let { code } = inputs
|
||||||
|
|
||||||
|
if (code == null) {
|
||||||
return {
|
return {
|
||||||
success: false,
|
success: false,
|
||||||
response: {
|
response: {
|
||||||
|
@ -66,6 +69,17 @@ export async function run({
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
code = code.trim()
|
||||||
|
|
||||||
|
if (!code.startsWith("{{ js ")) {
|
||||||
|
return {
|
||||||
|
success: false,
|
||||||
|
response: {
|
||||||
|
message: "Expected code to be a {{ js }} template block",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return {
|
return {
|
||||||
success: true,
|
success: true,
|
||||||
|
|
|
@ -154,6 +154,7 @@ export interface AutomationStepSchemaBase {
|
||||||
type: AutomationStepType
|
type: AutomationStepType
|
||||||
internal?: boolean
|
internal?: boolean
|
||||||
deprecated?: boolean
|
deprecated?: boolean
|
||||||
|
new?: boolean
|
||||||
blockToLoop?: string
|
blockToLoop?: string
|
||||||
schema: {
|
schema: {
|
||||||
inputs: InputOutputBlock
|
inputs: InputOutputBlock
|
||||||
|
|
Loading…
Reference in New Issue