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

Wrap secrets #5664

Merged
merged 35 commits into from
Nov 12, 2018
Merged

Wrap secrets #5664

merged 35 commits into from
Nov 12, 2018

Conversation

madalynrose
Copy link
Contributor

@madalynrose madalynrose commented Nov 1, 2018

wrap-secrets

Renewable: resp.renewable,
'Lease Duration': resp.lease_duration,
};
props = assign({}, props, { unwrap_data: secret }, { details: details });
Copy link
Contributor

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.

updateWrappedSecret() {
this.store
.adapterFor('tools')
.toolAction('wrap', this.secretDataAsJSON, { wrapTTL: 1800 })
Copy link
Contributor

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>
Copy link
Contributor

@meirish meirish Nov 1, 2018

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>
Copy link
Contributor

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.

ui/yarn.lock Outdated Show resolved Hide resolved
{{/if}}
{{#if (and (eq @mode "show") this.isV2)}}
<div class="control">
<SecretVersionMenu @version={{this.modelForData}} />
</div>
<div class="control">
<BasicDropdown
Copy link
Contributor

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",
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 still need this? (if no may want to reset yarn.lock too)

this.set('wrappedData', resp.wrap_info.token);
this.flashMessages.success('Secret Successfully Wrapped!');
this.set('showWrapButton', false);
this.set('isWrapping', false);
Copy link
Contributor

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);
Copy link
Contributor

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"}}
Copy link
Contributor

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"}}>
Copy link
Contributor

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 lis - li isn't an interactive element so it feels kinda weird to add click handlers to it.

meirish
meirish previously approved these changes Nov 9, 2018
Copy link
Contributor

@meirish meirish left a comment

Choose a reason for hiding this comment

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

Looks awesome! 🎁 🔒🎉

@madalynrose madalynrose merged commit 5fcd87a into master Nov 12, 2018
@madalynrose madalynrose deleted the wrap-secrets branch November 12, 2018 16:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants