Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UI: TTL picker cleanup #18114

Merged
merged 16 commits into from Dec 1, 2022
Merged

UI: TTL picker cleanup #18114

merged 16 commits into from Dec 1, 2022

Conversation

hashishaw
Copy link
Collaborator

@hashishaw hashishaw commented Nov 23, 2022

This PR does some cleanup with the TTL components. This also finishes up a long-lived project to replace all <TtlPicker> components with <TtlPicker2> which was developed to replace it, and includes a toggle to enable.

  • Replace last usage of TtlPicker with TtlPicker2
  • Consolidate all TtlPicker components (TtlPicker, TtlForm, TtlPicker2) into one component

Because there are so many moving pieces and similarly named files, I highly recommend reviewing this by stepping through the individual commits

TTL Picker with @hideToggle
TtlForm component

TTL Picker
TtlPicker component

@hashishaw hashishaw added the ui label Nov 23, 2022
@hashishaw hashishaw added this to the 1.13.0-rc1 milestone Nov 23, 2022

module('Integration | Component | ttl picker', function (hooks) {
module('Integration | Component | ttl-picker', function (hooks) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Contents of the test from ttl-picker2 replaced this test for a deleted component

* automatically recalculates the time value when unit is updated unless time has been changed recently.
* Once all instances of TtlPicker are replaced with TtlPicker2, this component will be removed and
* TtlPicker2 will be renamed to TtlPicker.
* TtlPicker components are used to enable and select duration values such as TTL. This component renders a toggle by default and:
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Contents of TtlPicker2 component replaced the unused TtlPicker component

@hashishaw hashishaw marked this pull request as ready for review November 30, 2022 18:06
Copy link
Contributor

@zofskeez zofskeez left a comment

Choose a reason for hiding this comment

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

This is great removing the extra ttl component and all the glimmerizing thank you! I'm a bit confused on the ttl-form component and whether or not we could get down to a single component, or at least extend the TtlPicker class perhaps for the form component?

Comment on lines 65 to 67
// initialValue: null,
// changeOnInit: false,
// hideToggle: false,
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we want to keep these commented out values?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I see what you mean with the template being less than ideal when incorporating the toggle but I think it's still worth it to get rid of the form component. Thanks for doing that! It's too bad that the Toggle component has to wrap everything. I thought that it would be standalone similar to a checkbox.

Yeah, it doesn't have to wrap everything, but in order to get behavior where you can click on the label to toggle the content, it does have to wrap. A future update could be something where the parent can override the input ID so that we can match on a custom label, but I think that's out of scope for now.

@@ -108,29 +113,29 @@ export default Component.extend({
time = convertFromSeconds(seconds, unit);
}
} catch (e) {
// if parsing fails leave as default 30s
// if parsing fails leave it empty
return;
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we want to avoid setting unit and enableTTl if the time parsing fails by returning here?

ui/lib/core/addon/components/ttl-form.js Outdated Show resolved Hide resolved
Copy link
Contributor

@zofskeez zofskeez left a comment

Choose a reason for hiding this comment

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

I see what you mean with the template being less than ideal when incorporating the toggle but I think it's still worth it to get rid of the form component. Thanks for doing that! It's too bad that the Toggle component has to wrap everything. I thought that it would be standalone similar to a checkbox.

@hashishaw hashishaw merged commit e34b1d6 into main Dec 1, 2022
@hashishaw hashishaw deleted the ui/ttl-picker-cleanup branch December 1, 2022 15:33
AnPucel pushed a commit that referenced this pull request Jan 14, 2023
jayant07-yb pushed a commit to jayant07-yb/hashicorp-vault-integrations that referenced this pull request Mar 15, 2023
Monkeychip pushed a commit that referenced this pull request May 25, 2023
Monkeychip added a commit that referenced this pull request May 26, 2023
* UI: TTL picker cleanup (#18114)

* Update config-pki.hbs

Unable to make Pki changes because we don't have action handleCrlTtl

* fix space

* remove test

---------

Co-authored-by: Chelsea Shaw <82459713+hashishaw@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants