-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Wrap secrets #5664
Wrap secrets #5664
Conversation
madalynrose
commented
Nov 1, 2018
•
edited
Loading
edited
Renewable: resp.renewable, | ||
'Lease Duration': resp.lease_duration, | ||
}; | ||
props = assign({}, props, { unwrap_data: secret }, { details: details }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You won't need these changes if we move to reading with wrapTTL
.
ui/app/components/secret-edit.js
Outdated
updateWrappedSecret() { | ||
this.store | ||
.adapterFor('tools') | ||
.toolAction('wrap', this.secretDataAsJSON, { wrapTTL: 1800 }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we want to allow them to input the ttl for wrapping too... probably a question for @joshuaogle
<nav class="tabs"> | ||
<ul> | ||
<li class="{{if (eq unwrapActiveTab "data") "is-active"}}"> | ||
<a href="#" {{action "updateUnwrapTab" "data"}} class="link link-plain has-text-weight-semibold {{if (eq unwrapActiveTab "data") "is-active"}}">Data</a> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These should be <button type="button">
s - anchors w/o an href are bad for a11y.
<a href="#" {{action "updateUnwrapTab" "data"}} class="link link-plain has-text-weight-semibold {{if (eq unwrapActiveTab "data") "is-active"}}">Data</a> | ||
</li> | ||
<li class="{{if (eq unwrapActiveTab "details") "is-active"}}"> | ||
<a href="#" {{action "updateUnwrapTab" "details"}} class="link link-plain has-text-weight-semibold {{if (eq unwrapActiveTab "details") "is-active"}}">Wrap Details</a> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use the mut
helper here if don't want to add the action to the component file. Something like {{action (mut unwrapActiveTab) "details"}}
- here's the docs for it https://www.emberjs.com/api/ember/3.5/classes/Ember.Templates.helpers/methods/mut?anchor=mut and we use it quite a bit if you search around the code base.
{{/if}} | ||
{{#if (and (eq @mode "show") this.isV2)}} | ||
<div class="control"> | ||
<SecretVersionMenu @version={{this.modelForData}} /> | ||
</div> | ||
<div class="control"> | ||
<BasicDropdown |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yikes not sure why I had all of this trailing whitespace the first time
ui/package.json
Outdated
@@ -44,6 +44,7 @@ | |||
"broccoli-sri-hash": "meirish/broccoli-sri-hash#rooturl", | |||
"bulma": "^0.5.2", | |||
"bulma-switch": "^0.0.1", | |||
"clipboard-polyfill": "^2.7.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we still need this? (if no may want to reset yarn.lock too)
ui/app/components/secret-edit.js
Outdated
this.set('wrappedData', resp.wrap_info.token); | ||
this.flashMessages.success('Secret Successfully Wrapped!'); | ||
this.set('showWrapButton', false); | ||
this.set('isWrapping', false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should probably be done in a finally
in case the call errors.
.adapterFor('secret') | ||
.queryRecord(null, null, { backend: this.model.backend, id: this.modelForData.id, wrapTTL: 1800 }) | ||
.then(resp => { | ||
this.set('wrappedData', resp.wrap_info.token); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this get reset or nulled out somewhere? Just thinking through how/why it doesn't stay through multiple popup openings.
@class="popup-menu" | ||
@horizontalPosition="auto-right" | ||
@verticalPosition="below" | ||
@onClose={{action "hideWrappedData"}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aha I see how it's working now. What do you think about this clearing out wrappedData
and then you could have showWrapButton: not('wrappedData')
- not a big deal but you wouldn't have to set showWrapButton
in 3 places then, it'd update automatically.
}} | ||
<nav class="tabs"> | ||
<ul> | ||
<li role="tab" aria-selected={{if (eq unwrapActiveTab "data") "true" "false"}} class="{{if (eq unwrapActiveTab "data") "is-active"}}" {{action (mut unwrapActiveTab) "data" on="click"}}> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there should be <button>
s with the actions inside these li
s - li
isn't an interactive element so it feels kinda weird to add click handlers to it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks awesome! 🎁 🔒🎉