Skip to content

Commit 81bf575

Browse files
[CUB-5407] Support onSuccess and onError in workflow sendCommand action (#700)
### [CUB-5407] ### Description <!-- Please summarize **all** changes introduced in this PR. Add explanations where needed. --> ### Manual PR Checklist - [x] All related Jira tickets added to PR title - [x] Description in Jira ticket is clear and up-to-date [CUB-5407]: https://labforward.atlassian.net/browse/CUB-5407?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
2 parents 73025ac + f905374 commit 81bf575

File tree

7 files changed

+202
-0
lines changed

7 files changed

+202
-0
lines changed

dist/index.d.ts

Lines changed: 58 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/workflow-step-template-schema.json

Lines changed: 31 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/workflow-template-schema.json

Lines changed: 31 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
type: object
3+
title: Command Handler
4+
description: |
5+
A Command handler always consists of an [action](/schemas/definitions/workflow-template/actions/).
6+
required: [do]
7+
additionalProperties: false
8+
properties:
9+
and:
10+
$ref: '#/definitions/script'
11+
do:
12+
$ref: '#/definitions/workflow-template/actions'
13+
else:
14+
$ref: '#/definitions/workflow-template/actions'

src/schemata/definitions/workflow-template/action-objects/send-command.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,9 @@ additionalProperties:
2424
description: |
2525
The command to execute. Available commands are device
2626
specific.
27+
onSuccess:
28+
description: The handler for success response
29+
$ref: '#/definitions/step/command-handler'
30+
onError:
31+
description: The handler for error response
32+
$ref: '#/definitions/step/command-handler'

src/workflow-step-template-schema.json

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1619,6 +1619,16 @@
16191619
"type": "string",
16201620
"description": "The command to execute. Available commands are device\nspecific.\n",
16211621
"markdownDescription": "The command to execute. Available commands are device\nspecific.\n\n\nSee more: [Send Command Schema](https://schema.laboperator.com/schemas/definitions/workflow-template/action-objects/send-command) "
1622+
},
1623+
"onSuccess": {
1624+
"description": "The handler for success response",
1625+
"$ref": "#/definitions/step/command-handler",
1626+
"markdownDescription": "The handler for success response\n\nSee more: [Send Command Schema](https://schema.laboperator.com/schemas/definitions/workflow-template/action-objects/send-command) "
1627+
},
1628+
"onError": {
1629+
"description": "The handler for error response",
1630+
"$ref": "#/definitions/step/command-handler",
1631+
"markdownDescription": "The handler for error response\n\nSee more: [Send Command Schema](https://schema.laboperator.com/schemas/definitions/workflow-template/action-objects/send-command) "
16221632
}
16231633
}
16241634
},
@@ -3240,6 +3250,27 @@
32403250
"markdownDescription": "Rules can be leveraged to dynamically change both the behavior and appearance of a table.\n\nWhen a rule condition is fulfilled, the `editable` and `selectable` behavior of cells, rows, columns, or tabs can be set. Likewise, the background color or text color can be changed to visualize a certain state or change of behavior to the user. For example:\n\n  - When a cell number value is negative, change the background color to red.\n  - When a cell number value is positive, change the background color to green, make it selectable, but no longer editable.\n  - When all cells in a column have no value, the column cells are not selectable or editable across all other tabs of the table.\n\n\nSee more: [Rules Schema](https://schema.laboperator.com/schemas/definitions/step/table-attributes/rules) "
32413251
}
32423252
},
3253+
"command-handler": {
3254+
"type": "object",
3255+
"title": "Command Handler",
3256+
"description": "A Command handler always consists of an [action](/schemas/definitions/workflow-template/actions/).\n",
3257+
"required": [
3258+
"do"
3259+
],
3260+
"additionalProperties": false,
3261+
"properties": {
3262+
"and": {
3263+
"$ref": "#/definitions/script"
3264+
},
3265+
"do": {
3266+
"$ref": "#/definitions/workflow-template/actions"
3267+
},
3268+
"else": {
3269+
"$ref": "#/definitions/workflow-template/actions"
3270+
}
3271+
},
3272+
"markdownDescription": "A Command handler always consists of an [action](https://schema.laboperator.com/schemas/definitions/workflow-template/actions/).\n\n\nSee more: [Command Handler Schema](https://schema.laboperator.com/schemas/definitions/step/command-handler) "
3273+
},
32433274
"webhook-handler": {
32443275
"type": "object",
32453276
"title": "Webhook Handler",

src/workflow-template-schema.json

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1440,6 +1440,27 @@
14401440
],
14411441
"markdownDescription": "Define accessors for selector options. You can map the selector options to fields defined in a field.\n\n\nSee more: [Selector Accessors Schema](https://schema.laboperator.com/schemas/definitions/step/selector-accessors) "
14421442
},
1443+
"command-handler": {
1444+
"type": "object",
1445+
"title": "Command Handler",
1446+
"description": "A Command handler always consists of an [action](/schemas/definitions/workflow-template/actions/).\n",
1447+
"required": [
1448+
"do"
1449+
],
1450+
"additionalProperties": false,
1451+
"properties": {
1452+
"and": {
1453+
"$ref": "#/definitions/script"
1454+
},
1455+
"do": {
1456+
"$ref": "#/definitions/workflow-template/actions"
1457+
},
1458+
"else": {
1459+
"$ref": "#/definitions/workflow-template/actions"
1460+
}
1461+
},
1462+
"markdownDescription": "A Command handler always consists of an [action](https://schema.laboperator.com/schemas/definitions/workflow-template/actions/).\n\n\nSee more: [Command Handler Schema](https://schema.laboperator.com/schemas/definitions/step/command-handler) "
1463+
},
14431464
"webhook-handler": {
14441465
"type": "object",
14451466
"title": "Webhook Handler",
@@ -2750,6 +2771,16 @@
27502771
"type": "string",
27512772
"description": "The command to execute. Available commands are device\nspecific.\n",
27522773
"markdownDescription": "The command to execute. Available commands are device\nspecific.\n\n\nSee more: [Send Command Schema](https://schema.laboperator.com/schemas/definitions/workflow-template/action-objects/send-command) "
2774+
},
2775+
"onSuccess": {
2776+
"description": "The handler for success response",
2777+
"$ref": "#/definitions/step/command-handler",
2778+
"markdownDescription": "The handler for success response\n\nSee more: [Send Command Schema](https://schema.laboperator.com/schemas/definitions/workflow-template/action-objects/send-command) "
2779+
},
2780+
"onError": {
2781+
"description": "The handler for error response",
2782+
"$ref": "#/definitions/step/command-handler",
2783+
"markdownDescription": "The handler for error response\n\nSee more: [Send Command Schema](https://schema.laboperator.com/schemas/definitions/workflow-template/action-objects/send-command) "
27532784
}
27542785
}
27552786
},

0 commit comments

Comments
 (0)