Skip to content

Update TTL picker on add replication secondary#9271

Merged
chelshaw merged 9 commits into
masterfrom
ui/replication-secondary-ttl
Jul 1, 2020
Merged

Update TTL picker on add replication secondary#9271
chelshaw merged 9 commits into
masterfrom
ui/replication-secondary-ttl

Conversation

@chelshaw
Copy link
Copy Markdown
Contributor

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.

BEFORE
ttl-secondary-old

AFTER (default)
replication-secondary-ttl-default

AFTER (enabled/custom)
replication-secondary-ttl-enabled

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
@chelshaw chelshaw force-pushed the ui/replication-secondary-ttl branch from 8ca25e3 to e037544 Compare June 19, 2020 16:21
@chelshaw chelshaw added this to the 1.5 milestone Jun 29, 2020
@helperTextDisabled="If not set, the default value (30 minutes) will be used"
@helperTextEnabled="After this period, the generated token will no longer be valid."
@onChange={{action "updateTtl"}}
@changeOnInit={{true}}
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added this param because I found that if you make a secondary with a custom TTL, and then immediately make another secondary without touching the TTL picker, it uses the previous value instead of the actual default (which is passed here as initialValue

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💨🦁🐑

Comment thread ui/lib/core/addon/components/ttl-picker2.js Outdated
Comment thread ui/tests/integration/components/ttl-picker2-test.js
Copy link
Copy Markdown
Contributor

@Monkeychip Monkeychip left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Address a couple of the questions and you should be good. I think this get's backported because they cut the release branch for 1.5, but you can confirm if you see the release/1.5 branch on master

@andaley andaley added the ui label Jun 29, 2020
This is the Time To Live for the generated secondary token. After this period, the generated token will no longer be valid.
</p>
<TtlPicker2
@initialValue="30m"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

image

Judging from the code here I'd expect to see the initial value as 30 minutes, but for some reason I'm seeing 1800 seconds in the UI. I know these values are equal, but everywhere else in the UI we default to "minutes" as the unit. If possible it'd be great to fix this so it's consistent.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is expected behavior for the current design, but not ideal so I went ahead and updated it (with test coverage!) so that the unit matches what is passed in on the value

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I updated the TTL picker UI to match the unit passed in, but the unit being passed to the API is being standardized to seconds for a couple reasons:

  1. Some of the APIs expect units, and others don't (defaulting to seconds), so the new TTL picker was designed to account for either of those
  2. None of the APIs accept 'days' as a unit, but we provide that as a dropdown option, so always converting to seconds when we send to the API ensures that we are consistent at that level.

Copy link
Copy Markdown
Contributor

@andaley andaley Jun 30, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

awesome, thank you for tracking that down and adding more tests! i think the explanation makes sense.

unfortunately in testing this though i found another bug when adding a secondary:

  1. toggle the TTL picker on
  2. enter a value (i.e. 3 minutes)
  3. toggle the TTL picker off
  4. the value from step 2 still gets sent to the API 🙈

let me know if you need any help!

Copy link
Copy Markdown
Contributor

@andaley andaley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

had one request since it looks like the initial value isn't working as expected; otherwise everything looks great!

@chelshaw chelshaw merged commit b88e94b into master Jul 1, 2020
@chelshaw chelshaw deleted the ui/replication-secondary-ttl branch July 1, 2020 17:50
chelshaw added a commit that referenced this pull request Jul 1, 2020
* 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
chelshaw added a commit that referenced this pull request Jul 1, 2020
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
andaley pushed a commit that referenced this pull request Jul 17, 2020
* 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants