mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-11-02 11:38:02 +00:00
* Update TTL picker on add replication secondary This change updates the TTL picker to the new version to match most updated designs. The component also allows the default value to be more obvious * Remove erroneous else * Add changeOnInit param for TtlPicker2 and use it on add secondary page * Update ttlPicker2 docs and add tests for new param * Calculate value in unit provided on init for ttl-picker2, with tests * Cleanup and make ttl-picker2 test more specific
3.9 KiB
3.9 KiB
TtlPicker2
TtlPicker2 components are used to enable and select time to live values. Use this TtlPicker2 instead of TtlPicker if you:
- Want the TTL to be enabled or disabled
- Want to have the time recalculated by default when the unit changes (eg 60s -> 1m)
Params
| Param | Type | Default | Description |
|---|---|---|---|
| onChange | function |
This function will be passed a TTL object, which includes enabled{bool}, seconds{number}, timeString{string}. | |
| label | String |
"Time to live (TTL)" |
Label is the main label that lives next to the toggle. |
| helperTextDisabled | String |
"Allow tokens to be used indefinitely" |
This helper text is shown under the label when the toggle is switched off |
| helperTextEnabled | String |
"Disable the use of the token after" |
This helper text is shown under the label when the toggle is switched on |
| description | |
Longer description about this value, what it does, and why it is useful. Shows up in tooltip next to helpertext | |
| time | Number |
30 |
The time (in the default units) which will be adjustable by the user of the form |
| unit | String |
"s" |
This is the unit key which will show by default on the form. Can be one of s (seconds), m (minutes), h (hours), d (days) |
| recalculationTimeout | Number |
5000 |
This is the time, in milliseconds, that recalculateSeconds will be be true after time is updated |
| initialValue | String |
|
This is the value set initially (particularly from a string like '30h') |
| initialEnabled | Boolean |
|
Set this value if you want the toggle on when component is mounted |
| changeOnInit | Boolean |
false |
set this value if you'd like the passed onChange function to be called on component initialization |
Example
<TtlPicker2 @onChange={{handleChange}} @time={{defaultTime}} @unit={{defaultUnit}}/>
See