Skip to content

Commit b1f4b7a

Browse files
authored
Merge pull request #214 from vlobzakov/master
JE-58440 JE-52908 updates approved
2 parents 8686dae + bd68d6a commit b1f4b7a

File tree

3 files changed

+150
-28
lines changed

3 files changed

+150
-28
lines changed

docs/creating-manifest/conditions-and-iterations.md

Lines changed: 98 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,47 @@
11
# Control Flows: Conditions and Iterations
22

3+
**Comparison** and **Logical** operators are used in *conditional* statements and serve to test for `ture` or `false`.
4+
5+
## Comparison Operators
6+
7+
The Comparison operators are used in logical statements to determine equality or difference between variables or values.
8+
9+
Let's assume that `x = 5`. The table below explains the comparison operators:
10+
11+
| Operator | Description | Comparing | Returns |
12+
|--------------------|-------------------------------------|-----------|----------|
13+
| == | equal to | x == 8 | false |
14+
| == | equal to | x == 5 | true |
15+
| == | equal to | x == "5" | true |
16+
| | | | |
17+
| === | equal value and equal type | x === 5 | true |
18+
| === | equal value and equal type | x === "5" | false |
19+
| | | | |
20+
| != | not equal | x != 8 | true |
21+
| | | | |
22+
| !== | not equal value or not equal type | x !== 5 | false |
23+
| !== | not equal value or not equal type | x !== "5" | true |
24+
| !== | not equal value or not equal type | x !== 8 | true |
25+
| | | | |
26+
| > | grater than | x > 8 | false |
27+
| < | less than | x < 8 | true |
28+
| >= | grater than or equal to | x >= 8 | false |
29+
| <= | less than or equal to | x <= 8 | true |
30+
31+
## Logical Operators
32+
33+
The logical operators are used to determine the logic between variables or values. Let's take that `x = 6` and `y = 3`. The table below explains the logical operators:
34+
35+
| Operator | Description | Example |
36+
|--------------------|-------------------------------------|------------------------------|
37+
| && | and | (x < 10 && y > 1) is true |
38+
| == | or | (x == 5 || y == 5) is false |
39+
| == | not | !(x == y) is true |
40+
41+
42+
43+
44+
345
## Conditions
446

547
The main conditional statement is <b>*if*</b>. Within this parameter, all the available <a href="../placeholders/" target="_blank">placeholders</a> and their objective JavaScript mappings can be used.
@@ -204,7 +246,7 @@ onInstall:
204246
```
205247
@@!
206248

207-
### **Else**
249+
### Else
208250

209251
In case the conditional statement should be complemented by the opposite comparison and respective action the ***else*** conditional operator can be accommodated.
210252

@@ -431,6 +473,61 @@ onInstall:
431473
```
432474
@@!
433475

476+
### Single line *if* statement
477+
478+
Another ***if-else*** combination can be represented as a single ***if*** statement when multiple conditions are required to be checked and the statements nesting is not mandatory.
479+
It is applicable if any condition or all of the conditions in the statement may lead to the same outcome.
480+
For example:
481+
482+
@@@
483+
```yaml
484+
type: install
485+
name: '[CS:Conditions] - action single line "if"'
486+
487+
globals:
488+
a: 1
489+
b: 2
490+
491+
onInstall:
492+
- log: "-- single line if test --"
493+
- if ((globals.b == 2) && (globals.a == 1) && (globals.a == 1)):
494+
assert: true
495+
496+
- log: "-- another single line if test --"
497+
- if (globals.a == 2 || globals.a == 3 || globals.a == 1):
498+
assert: true
499+
```
500+
```json
501+
{
502+
"type": "install",
503+
"name": "[CS:Conditions] - action single line \"if\"",
504+
"globals": {
505+
"a": 1,
506+
"b": 2
507+
},
508+
"onInstall": [
509+
{
510+
"log": "-- single line if test --"
511+
},
512+
{
513+
"if ((globals.b == 2) && (globals.a == 1) && (globals.a == 1))": {
514+
"assert": true
515+
}
516+
},
517+
{
518+
"log": "-- another single line if test --"
519+
},
520+
{
521+
"if (globals.a == 2 || globals.a == 3 || globals.a == 1)": {
522+
"assert": true
523+
}
524+
}
525+
]
526+
}
527+
```
528+
@@!
529+
530+
434531
## Iterations
435532

436533
### ForEach

docs/creating-manifest/visual-settings.md

Lines changed: 52 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ where:
8181
* `text` - [multiline](#text) text field
8282
* `list` - drop-down menu with [textboxes](#list)
8383
* `checkbox` - [single checkbox](#checkbox) field
84-
<!-- * `checkboxlist` - [checkbox](#checkboxlist) grouping -->
84+
* `checkboxlist` - [checkbox](#checkboxlist) grouping
8585
* `radiolist` - [radio field](#radiolist) grouping
8686
* `radio-fieldset` - alias to `radiolist`
8787
* `dockertags` - drop-down menu with a list of [docker tags](#dockertags)
@@ -551,47 +551,72 @@ where:
551551
- `hideLabel` *[optional][boolean]* - shows/hides field label. Default value is *'false'*
552552
- `hidden` *[optional]*[boolean] - shows/hides field with its label. Default value is *'false'*.
553553

554-
<!--
555554
### checkboxlist
556555
Checkbox grouping.
557556

558-
![text](/img/checkboxlist.jpg)
557+
![text](/img/checkboxlist.jpg)
558+
559559
@@@
560560
```yaml
561-
fields:
562-
- type: checkboxlist
563-
caption: Checkbox List
564-
values:
565-
value1: hello
566-
value2: world
567-
hideLabel: false
568-
hidden: false
561+
- type: checkboxlist
562+
caption: Options
563+
name: options
564+
columns: 2
565+
values:
566+
- name: option1
567+
caption: Option 1
568+
value: false
569+
570+
- name: option2
571+
caption: Option 2
572+
value: true
573+
574+
- name: option3
575+
caption: Option 3
576+
value: true
569577
```
570578
``` json
571-
{
572-
"fields": [
573-
{
574-
"type": "checkboxlist",
575-
"caption": "Checkbox List",
576-
"values": {
577-
"value1": "hello",
578-
"value2": "world"
579+
[
580+
{
581+
"type": "checkboxlist",
582+
"caption": "Options",
583+
"name": "options",
584+
"columns": 2,
585+
"values": [
586+
{
587+
"name": "option1",
588+
"caption": "Option 1",
589+
"value": false
579590
},
580-
"hideLabel": false,
581-
"hidden": false
582-
}
583-
]
584-
}
591+
{
592+
"name": "option2",
593+
"caption": "Option 2",
594+
"value": true
595+
},
596+
{
597+
"name": "option3",
598+
"caption": "Option 3",
599+
"value": true
600+
}
601+
]
602+
}
603+
]
585604
```
586605
@@!
587606

588-
where:
607+
This example returns values as follows:
608+
609+
*{ "options": "option2,option3", "option1": false, "option2": true, "option3": true }*
610+
611+
Field parameters:
589612

590613
- `caption` *[optional]* - field label
591614
- `values` - checkboxes (*"key"*:*"value"*)
592615
- `hideLabel` *[optional] [boolean]* - shows/hides field label. Default value is *'false'*
593-
- `hidden` *[optional]*[boolean] - shows/hides field with its label. Default value is *'false'*.
594-
-->
616+
- `hidden` *[optional]*[boolean] - shows/hides field with its label. Default value is *'false'*
617+
- `delimiter` *[optional][string]* - a delimiter character to separate list data items. The default value is a comma ','
618+
- `columns` *[optional][Number]* - specifies the number of columns to be created when displaying grouped checkboxlist controls using automatic layout. The default value is 1.
619+
595620

596621
### radiolist
597622
Radio elements grouping.
8.61 KB
Loading

0 commit comments

Comments
 (0)