Skip to content

Commit

Permalink
[Doc] Update doc for adding fieldDependency specDescriptor
Browse files Browse the repository at this point in the history
  • Loading branch information
Tony Wu committed Jan 31, 2020
1 parent 0f80bdc commit 3ddfb87
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 2 deletions.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ specDescriptors:
17. [Select](#17-select)
18. [Advanced](#18-advanced)
19. [Endpoint List](#19-endpoint-list)
20. [DEPRECATED Descriptors](#20-deprecated-descriptors)
20. [Field Dependency](#20-field-dependency)
21. [DEPRECATED Descriptors](#20-deprecated-descriptors)

statusDescriptors:
- [ToDo]
Expand Down Expand Up @@ -676,7 +677,63 @@ This descriptor is created specifically for Prometheus Operator to specify a lis
</table>


### 20. DEPRECATED Descriptors
### 20. Field Dependency

**x-descriptors**

This descriptor allows you to specify a field as the dependent of a Control Field and shows the field when the current value of the Control Field is equal to the expected value:
```yaml
'urn:alm:descriptor:com.tectonic.ui:fieldDependency:CONTROL_FIELD_PATH:EXPECTED_VALUE'
```

**Usage**
1. Add “fieldDependency” to 'x-descriptors' array of the Dependent Field(s).
2. Replace “CONTROL_FIELD_PATH” with the 'path' property of the Control Field object.
3. Replace “EXPECTED_VALUE” with the actual expected value.

The Dependent Field(s) will be displayed only when the current value of the Control Field is equal to the expected value.

**Example**
```yaml
- displayName: Enable Upgrades
description: >-
Set true to enable automatic micro version product upgrades, it is disabled by default.
path: upgrades.enabled
x-descriptors:
- 'urn:alm:descriptor:com.tectonic.ui:booleanSwitch'
- displayName: Include minor version upgrades
description: >-
Set true to enable automatic minor product version upgrades, it is
disabled by default. Requires spec.upgrades.enabled to be true.
path: upgrades.minor
x-descriptors:
- 'urn:alm:descriptor:com.tectonic.ui:fieldDependency:upgrades.enabled:true'
- 'urn:alm:descriptor:com.tectonic.ui:booleanSwitch'
```

**UI**
<table style="width:100%">
<tr style="vertical-align:top">
<td width="50%">CREATION VIEW
<img src="img/20-1_fielddependency-new.png" />
<br>
<small><b>* </b><i> When "Enable Upgrades" (CONTROL FIELD) is TRUE:</i></small>
<img src="img/20-2_fielddependency-new.png" />
</td></td>
<td width="50%">DISPLAY VIEW
<img src="img/20-2_fielddependency-dis.png" /></td>
</tr>
<tr style="vertical-align:top">
<td colspan="2">MODIFY VIEW
<p><small><b>* </b><i>Currently, this descriptor does not provide “Modify View”.</i></small></p>
</td>
</tr>
</table>


### 21. DEPRECATED Descriptors

#### Label **[DEPRECATED]**

Expand Down

0 comments on commit 3ddfb87

Please sign in to comment.