Skip to content

Commit

Permalink
Merge pull request #701 from RizaFarheen/main
Browse files Browse the repository at this point in the history
Inline doc update
  • Loading branch information
nhandt2021 authored Jun 14, 2024
2 parents aa00040 + b482c24 commit 4a20ae1
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 32 deletions.
69 changes: 37 additions & 32 deletions docs/reference-docs/system-tasks/inline.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,31 +7,36 @@ import TabItem from '@theme/TabItem';

# Inline

The inline task helps execute necessary logic at the workflow run-time using an evaluator. The two supported evaluator types are javascript and graaljs.
Inline tasks enable the execution of essential logic during workflow runtime by evaluating a JavaScript expression using an evaluator like GraalJS.

## Definitions
```json
{
"name": "inline_task_example",
"taskReferenceName": "inline_task_example_ref",
"type": "INLINE",
"inputParameters": {
"expression": "(function () {\n return $.value1 + $.value2;\n})();",
"evaluatorType": "graaljs",
"value1": 1,
"value2": 2
}
}
{
"name": "inline",
"taskReferenceName": "inline_ref",
"type": "INLINE",
"inputParameters": {
"expression": "(function () {\n return $.value1 + $.value2;\n})();",
"evaluatorType": "graaljs",
"value1": 1,
"value2": 2
}
}
```

### Input Parameters

| Attribute | Desciption |
|---------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| evaluatorType | Choose the type of evaluator. Supported evaluators are **graaljs** & **javascript**. Graaljs evaluates the expression using graaljs, and javascript evaluates the expression using nashorn to compute the value. |
| expression | Indicates the expression associated with the type of evaluator. For the javascript evaluator, the Javascript evaluation engine is used to evaluate the expression defined as a string. It must return a value. For the graaljs evaluator, graalvm is used to evaluate the expression. |
| Attribute | Description |
| --------- | ----------- |
| expression | Specifies the JavaScript expression to be evaluated by the GraalJS evaluator. |
| evaluatorType | Supports GraalJS evaluator. |
| Script params | Provide the parameters for evaluating the script. Any properties can be accessed as **$.value** for the expression to evaluate. |

Besides the expression, any of the properties in the input values is accessible as **$.value** for the expression to evaluate.
### Output Parameters

| Attribute | Description |
| --------- | ----------- |
| result | Returns the results of the evaluated script. |

## Examples

Expand All @@ -45,8 +50,8 @@ Besides the expression, any of the properties in the input values is accessible
<br/>
<br/>

1. Add task type `Inline`.
2. Write the inline script using Javascript.
1. Add task type **Inline**.
2. Write the inline ECMAScript.

</div>
<div className="col">
Expand All @@ -64,22 +69,22 @@ Besides the expression, any of the properties in the input values is accessible
<TabItem value="JSON" label="JSON">

```json
{
"name": "inline_task_example",
"taskReferenceName": "inline_task_example_ref",
"type": "INLINE",
"inputParameters": {
"expression": "(function () {\n return $.value1 + $.value2;\n})();",
"evaluatorType": "graaljs",
"value1": 1,
"value2": 2
}
}
{
"name": "inline",
"taskReferenceName": "inline_ref",
"type": "INLINE",
"inputParameters": {
"expression": "(function () {\n return $.value1 + $.value2;\n})();",
"evaluatorType": "graaljs",
"value1": 1,
"value2": 2
}
}
```

</TabItem>
</Tabs>

:::tip
The JSON definition shows a string format of the script; however, on the UI, it will retain the formatting we used and is more readable.
:::info
The JSON definition provides a concise string representation of the script. In contrast, the UI representation typically includes formatted indentation and line breaks for better user readability.
:::
Binary file modified static/img/ui-guide-inline-task.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 4a20ae1

Please sign in to comment.